pkey subsystem is supported if the hardware and kernel has support.
We determine that by checking if allocation of a key succeeds or not.
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/te
<fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/pkey-helpers.h| 14 ++
tools/testing/selftests/vm/protection_keys.c |9 -
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests
detect access-violation on a page to which access-disabled
key is associated much after the page is mapped.
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/protec
detect write-violation on a page to which access-disabled
key is associated much after the page is mapped.
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/protec
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/Makefile |1 +
tools/testing/selftests/vm/pkey-helpers.h | 223
tools/testing/selftests/vm/protect
helper functions to handler shadow pkey register
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/pkey-helpers.h| 27
tools/testing/selftests/vm
some pkru references are named to pkey_reg
and some prku references are renamed to pkey
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/pkey-helpers.h| 85 +--
This is in preparation to accomadate a differing size register
across architectures.
cc: Dave Hansen <dave.han...@intel.com>
cc: Florian Weimer <fwei...@redhat.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/pkey-helpers.h| 27 +--
pkeys.
This patch keeps track of reserved keys, allocated keys
and keys that are currently free.
Also it adds skeletal functions and macros, that the
architecture-independent code expects to be available.
Reviewed-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
Signed-off-by: R
version v1: Initial version
Ram Pai (26):
mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS
is enabled
mm, powerpc, x86: introduce an additional vma bit for powerpc pkey
powerpc: initial pkey plumbing
powerpc: track allocation status of all pkeys
powerpc: helper functi
Basic plumbing to initialize the pkey system.
Nothing is enabled yet. A later patch will enable it
once all the infrastructure is in place.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/Kconfig | 15 +
arch/powerpc/include/asm/mmu_con
VM_PKEY_BITx are defined only if CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
is enabled. Powerpc also needs these bits. Hence lets define the
VM_PKEY_BITx bits for any architecture that enables
CONFIG_ARCH_HAS_PKEYS.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
fs/proc/task_mmu.c
Currently only 4bits are allocated in the vma flags to hold 16
keys. This is sufficient for x86. PowerPC supports 32 keys,
which needs 5bits. This patch allocates an additional bit.
Acked-by: Balbir Singh <bsinghar...@gmail.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/reg.h |1 -
arch/powerpc/kernel/exceptions-64s.S |2 +-
arch/powerpc/mm/fault.c | 22 ++
3 f
Introduce helper functions that can initialize the bits in the AMR,
IAMR and UAMOR register; the bits that correspond to the given pkey.
Reviewed-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/mm/pk
get_mm_addr_key() helper returns the pkey associated with
an address corresponding to a given mm_struct.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/mmu.h |9 +
arch/powerpc/mm/hash_utils_64.c | 24
2 files chang
uer...@linux.vnet.ibm.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/pkeys.h | 12
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h
index 1e8cef2..9964b46 100644
--- a/
This patch provides the implementation for
arch_vma_access_permitted(). Returns true if the
requested access is allowed by pkey associated with the
vma.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/mmu_context.h |5 +++-
arch/powerpc/mm/p
if the architecture support pkeys.
x86 arch_show_smap() function is not needed anymore.
Delete it.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/x86/kernel/setup.c |8
fs/proc/task_mmu.c | 11 ++-
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/ar
Patch provides the ability for a process to
associate a pkey with a address range.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/systbl.h |1 +
arch/powerpc/include/asm/unistd.h |4 +---
arch/powerpc/include/uapi/asm/unistd.h |1 +
3
Arch neutral code needs to know if the architecture supports
protection keys to display protection key in smaps. Hence
introducing arch_pkeys_enabled().
This patch also provides x86 implementation for
arch_pkeys_enabled().
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/x86/inclu
Finally this patch provides the ability for a process to
allocate and free a protection key.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/systbl.h |2 ++
arch/powerpc/include/asm/unistd.h |4 +---
arch/powerpc/include/uapi/asm/unistd.h |2
From: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
The AMR/IAMR/UAMOR are part of the program context.
Allow it to be accessed via ptrace and through core files.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm
Make sure that the kernel does not access user pages without
checking their key-protection.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/book3s/64/pgtable.h | 19 +++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/arch/p
Map the PTE protection key bits to the HPTE key protection bits,
while creating HPTE entries.
Acked-by: Balbir Singh <bsinghar...@gmail.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h |5 +
arch/powerpc/include/asm/m
support for pkeys.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/cputable.h | 16 ++---
arch/powerpc/include/asm/pkeys.h|3 ++
arch/powerpc/mm/pkeys.c | 61 +-
3 files changed, 65 insertions(+), 15 del
powerpc has hardware support to disable execute on a pkey.
This patch enables the ability to create execute-disabled
keys.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/uapi/asm/mman.h |6 ++
arch/powerpc/mm/pkeys.c | 16
2
arch-independent code expects the arch to map
a pkey into the vma's protection bit setting.
The patch provides that ability.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/mman.h |7 ++-
arch/powerpc/include/asm/pkeys.h | 11 +++
arch/powe
viewed-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/mm/pkeys.c | 36
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerp
.
BUT, on 4k kernel, bit 3, and 4 could not be freed up. remember?
Hence we have to be satisfied with 5, 6 and 7.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/book3s/64/pgtable.h | 25 -
arch/powerpc/include/asm/mman.h
The value of the pkey, whose protection got violated,
is made available in si_pkey field of the siginfo structure.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/bug.h |1 +
arch/po
arch independent code calls arch_override_mprotect_pkey()
to return a pkey that best matches the requested protection.
This patch provides the implementation.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/mmu_context.h |5
arch/powerpc/include/asm/p
helper function that checks if the read/write/execute is allowed
on the pte.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/book3s/64/pgtable.h |4 +++
arch/powerpc/include/asm/pkeys.h |9
arch/powerpc/mm/pkeys.c
This patch provides the implementation of execute-only pkey.
The architecture-independent layer expects the arch-dependent
layer, to support the ability to create and enable a special
key which has execute-only permission.
Acked-by: Balbir Singh <bsinghar...@gmail.com>
Signed-off-by: R
ed-off-by: Ram Pai <linux...@us.ibm.com>
---
arch/powerpc/include/asm/pkeys.h |6 -
arch/powerpc/mm/pkeys.c | 40 ++
2 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include
Since PowerPC and Intel both support memory protection keys, moving
the documenation to arch-neutral directory.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
Documentation/vm/protection-keys.txt | 90 +
Documentation/x86/protection-keys.txt
Memory protection keys enable applications to protect its
address space from inadvertent access from itself.
This feature is now enabled on powerpc architecture.
The patches moves the documentation to arch neutral directory and
captures the latest information.
Ram Pai (2):
Documentation/x86
instead of clearing the bits, pkey_disable_clear() was setting
the bits. Fixed it.
Also fixed a wrong assertion in that function. When bits are
cleared, the resulting bit value will be less than the original.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selfte
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/Makefile |1 +
tools/testing/selftests/vm/pkey-helpers.h | 223
tools/testing/selftests/vm/protection_keys.c | 1407 +
tools/testing/selftests/x86/Makefile
When a key is freed, the key is no more effective.
Clear the bits corresponding to the pkey in the shadow
register. Otherwise it will carry some spurious bits
which can trigger false-positive asserts.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selfte
helper functions to handler shadow pkey register
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/pkey-helpers.h| 27
tools/testing/selftests/vm/protection_keys.c | 34 -
2 files changed, 49 insertions(
If the flag is 0, no bits will be set. Hence we cant expect
the resulting bitmap to have a higher value than what it
was earlier.
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
tools/testing/selftests/vm/protection_keys.c |2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff
:
(1) used one additional bit from VM_HIGH_ARCH_*
to support 32 keys.
- Suggestion by Dave Hansen.
(2) powerpc specific changes to support memory keys.
Ram Pai (3):
mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS
is enabled
mm
g.org>
cc: Andrew Morton <a...@linux-foundation.org>
Reviewed-by: Dave Hansen <dave.han...@intel.com>
Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com>
(fixed compilation errors for x86 configs)
Acked-by: Michal Hocko <mho...@suse.com>
Reviewed-by: Ingo Molnar &
errenschmidt <b...@kernel.crashing.org>
cc: Andrew Morton <a...@linux-foundation.org>
Reviewed-by: Ingo Molnar <mi...@kernel.org>
Acked-by: Balbir Singh <bsinghar...@gmail.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
---
fs/proc/task_mmu.c |1 +
include
idt <b...@kernel.crashing.org>
cc: Andrew Morton <a...@linux-foundation.org>
Reviewed-by: Dave Hansen <dave.han...@intel.com>
Signed-off-by: Ram Pai <linux...@us.ibm.com>
Reviewed-by: Ingo Molnar <mi...@kernel.org>
Reviewed-by: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com
301 - 346 of 346 matches
Mail list logo