Re: [PATCH] x86, powerpc : pkey-mprotect must allow pkey-0

2018-03-09 Thread Ram Pai
On Fri, Mar 09, 2018 at 07:37:04PM +1100, Balbir Singh wrote: > On Fri, Mar 9, 2018 at 7:12 PM, Ram Pai wrote: > > Once an address range is associated with an allocated pkey, it cannot be > > reverted back to key-0. There is no valid reason for the above behavior. On &

[PATCH] x86, powerpc : pkey-mprotect must allow pkey-0

2018-03-09 Thread Ram Pai
han...@intel.com> cc: Michael Ellermen <m...@ellerman.id.au> cc: Ingo Molnar <mi...@kernel.org> Signed-off-by: Ram Pai <linux...@us.ibm.com> --- arch/powerpc/include/asm/pkeys.h | 19 ++- arch/x86/include/asm/pkeys.h | 5 +++-- 2 files changed, 17 insertions(

[PATCH] x86, powerpc : pkey-mprotect must allow pkey-0

2018-03-09 Thread Ram Pai
: Michael Ellermen cc: Ingo Molnar Signed-off-by: Ram Pai --- arch/powerpc/include/asm/pkeys.h | 19 ++- arch/x86/include/asm/pkeys.h | 5 +++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h index

mm, x86, powerpc: pkey semantics for key-0 ?

2018-03-08 Thread Ram Pai
Dave, Is there a reason why the default key; key-0, is not allowed to be explicitly associated with pages using pkey_mprotect()? I see valid usecases where an application may initially want to associate an address-range with some key and latter choose to revert to its initial state, by

mm, x86, powerpc: pkey semantics for key-0 ?

2018-03-08 Thread Ram Pai
Dave, Is there a reason why the default key; key-0, is not allowed to be explicitly associated with pages using pkey_mprotect()? I see valid usecases where an application may initially want to associate an address-range with some key and latter choose to revert to its initial state, by

Re: [PATCH v12 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-02-25 Thread Ram Pai
On Sun, Feb 25, 2018 at 05:27:11PM +0530, Aneesh Kumar K.V wrote: > > > On 02/24/2018 06:35 AM, Ram Pai wrote: > >On Fri, Feb 23, 2018 at 03:11:45PM +0800, kbuild test robot wrote: > >>Hi Ram, > >> > >>Thank you for the patch! Yet something to improve

Re: [PATCH v12 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-02-25 Thread Ram Pai
On Sun, Feb 25, 2018 at 05:27:11PM +0530, Aneesh Kumar K.V wrote: > > > On 02/24/2018 06:35 AM, Ram Pai wrote: > >On Fri, Feb 23, 2018 at 03:11:45PM +0800, kbuild test robot wrote: > >>Hi Ram, > >> > >>Thank you for the patch! Yet something to improve

Re: [PATCH v12 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-02-23 Thread Ram Pai
tree, please drop us a note to > help improve the system] > > chmod +x ~/bin/make.cross ...snip.. > # save the attached .config to linux build tree > make.cross ARCH=powerpc > > Note: the > linux-review/Ram-Pai/mm-x86-powerpc-Enhancements-to-M

Re: [PATCH v12 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-02-23 Thread Ram Pai
tree, please drop us a note to > help improve the system] > > chmod +x ~/bin/make.cross ...snip.. > # save the attached .config to linux build tree > make.cross ARCH=powerpc > > Note: the > linux-review/Ram-Pai/mm-x86-powerpc-Enhancements-to-M

Re: [PATCH 1/2] selftests/powerpc: Add ptrace tests for Protection Key registers

2018-02-23 Thread Ram Pai
On Fri, Feb 23, 2018 at 03:33:43PM -0300, Thiago Jung Bauermann wrote: > This test exercises read and write access to the AMR, IAMR and UAMOR. > Tested-by: Ram Pai <linux...@us.ibm.com> Acked-by: Ram Pai <linux...@us.ibm.com> > Signed-off-by: Thiago Jung Bauermann <bau

Re: [PATCH 1/2] selftests/powerpc: Add ptrace tests for Protection Key registers

2018-02-23 Thread Ram Pai
On Fri, Feb 23, 2018 at 03:33:43PM -0300, Thiago Jung Bauermann wrote: > This test exercises read and write access to the AMR, IAMR and UAMOR. > Tested-by: Ram Pai Acked-by: Ram Pai > Signed-off-by: Thiago Jung Bauermann > --- > tools/testing/selftests/powerpc/include/r

Re: [PATCH 2/2] selftests/powerpc: Add core file test for Protection Key registers

2018-02-23 Thread Ram Pai
On Fri, Feb 23, 2018 at 03:33:44PM -0300, Thiago Jung Bauermann wrote: > This test verifies that the AMR, IAMR and UAMOR are being written to a > process' core file. > Acked-by: Ram Pai <linux...@us.ibm.com> Tested-by: Ram Pai <linux...@us.ibm.com> > Signed-off-by: Thia

Re: [PATCH 2/2] selftests/powerpc: Add core file test for Protection Key registers

2018-02-23 Thread Ram Pai
On Fri, Feb 23, 2018 at 03:33:44PM -0300, Thiago Jung Bauermann wrote: > This test verifies that the AMR, IAMR and UAMOR are being written to a > process' core file. > Acked-by: Ram Pai Tested-by: Ram Pai > Signed-off-by: Thiago Jung Bauermann > --- > tools/testing/selfte

[PATCH v12 04/22] selftests/vm: typecast the pkey register

2018-02-21 Thread Ram Pai
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 +--

[PATCH v12 04/22] selftests/vm: typecast the pkey register

2018-02-21 Thread Ram Pai
This is in preparation to accomadate a differing size register across architectures. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 27 +- tools/testing/selftests/vm/protection_keys.c | 69 ++ 2

[PATCH v12 03/22] selftests/vm: move generic definitions to header file

2018-02-21 Thread Ram Pai
Moved all the generic definition and helper functions to the header file 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| 62 +

[PATCH v12 03/22] selftests/vm: move generic definitions to header file

2018-02-21 Thread Ram Pai
Moved all the generic definition and helper functions to the header file cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 62 ++-- tools/testing/selftests/vm/protection_keys.c | 66

[PATCH v12 01/22] selftests/x86: Move protecton key selftest to arch neutral directory

2018-02-21 Thread Ram Pai
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

[PATCH v12 01/22] selftests/x86: Move protecton key selftest to arch neutral directory

2018-02-21 Thread Ram Pai
cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- 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

[PATCH v12 05/22] selftests/vm: generic function to handle shadow key register

2018-02-21 Thread Ram Pai
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

[PATCH v12 05/22] selftests/vm: generic function to handle shadow key register

2018-02-21 Thread Ram Pai
helper functions to handler shadow pkey register cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 27 tools/testing/selftests/vm/protection_keys.c | 34 - 2 files changed, 49

[PATCH v12 02/22] selftests/vm: rename all references to pkru to a generic name

2018-02-21 Thread Ram Pai
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 +--

[PATCH v12 07/22] selftests/vm: fixed bugs in pkey_disable_clear()

2018-02-21 Thread Ram Pai
m> Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/protection_keys.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 0109388..ca54a95

[PATCH v12 07/22] selftests/vm: fixed bugs in pkey_disable_clear()

2018-02-21 Thread Ram Pai
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. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing

[PATCH v12 02/22] selftests/vm: rename all references to pkru to a generic name

2018-02-21 Thread Ram Pai
some pkru references are named to pkey_reg and some prku references are renamed to pkey cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 85 +- tools/testing/selftests/vm/protection_keys.c | 227

[PATCH v12 08/22] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-02-21 Thread Ram Pai
m> Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/protection_keys.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index ca54a95..aaf9f09

[PATCH v12 09/22] selftests/vm: fix alloc_random_pkey() to make it really random

2018-02-21 Thread Ram Pai
alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. fixed it. 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

[PATCH v12 08/22] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-02-21 Thread Ram Pai
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. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests

[PATCH v12 09/22] selftests/vm: fix alloc_random_pkey() to make it really random

2018-02-21 Thread Ram Pai
alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. fixed it. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git

[PATCH v12 14/22] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-02-21 Thread Ram Pai
m> Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/protection_keys.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index c4c73e6..e82bd88

[PATCH v12 14/22] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-02-21 Thread Ram Pai
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. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests

[PATCH v12 11/22] selftests/vm: pkey register should match shadow pkey

2018-02-21 Thread Ram Pai
throughout 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/protection_keys.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/te

[PATCH v12 11/22] selftests/vm: pkey register should match shadow pkey

2018-02-21 Thread Ram Pai
throughout cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index

[PATCH v12 18/22] selftests/vm: associate key on a mapped page and detect write violation

2018-02-21 Thread Ram Pai
detect write-violation on a page to which write-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

[PATCH v12 18/22] selftests/vm: associate key on a mapped page and detect write violation

2018-02-21 Thread Ram Pai
detect write-violation on a page to which write-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff

[PATCH v12 20/22] selftests/vm: testcases must restore pkey-permissions

2018-02-21 Thread Ram Pai
of the pkey register is not restored to its original state. The test case is responsible for restoring the key register state to its original value. cc: Dave Hansen <dave.han...@intel.com> cc: Florian Weimer <fwei...@redhat.com> Signed-off-by: Ram Pai <linux...@us.ibm.com>

[PATCH v12 20/22] selftests/vm: testcases must restore pkey-permissions

2018-02-21 Thread Ram Pai
of the pkey register is not restored to its original state. The test case is responsible for restoring the key register state to its original value. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |5 + 1 files changed, 5

[PATCH v12 17/22] selftests/vm: associate key on a mapped page and detect access violation

2018-02-21 Thread Ram Pai
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

[PATCH v12 17/22] selftests/vm: associate key on a mapped page and detect access violation

2018-02-21 Thread Ram Pai
detect access-violation on a page to which access-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 19 +++ 1 files changed, 19 insertions(+), 0 deletions

[PATCH v12 19/22] selftests/vm: detect write violation on a mapped access-denied-key page

2018-02-21 Thread Ram Pai
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

[PATCH v12 21/22] selftests/vm: sub-page allocator

2018-02-21 Thread Ram Pai
introduce a new allocator that allocates 4k hardware-pages to back 64k linux-page. This allocator is only applicable on powerpc. cc: Dave Hansen <dave.han...@intel.com> cc: Florian Weimer <fwei...@redhat.com> Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/te

[PATCH v12 22/22] selftests/vm: Fix deadlock in protection_keys.c

2018-02-21 Thread Ram Pai
n. cc: Dave Hansen <dave.han...@intel.com> cc: Florian Weimer <fwei...@redhat.com> Signed-off-by: Ram Pai <linux...@us.ibm.com> Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com> tools/testing/selftests/vm/pkey-helpers.h | 3 ++- 1 file changed, 2 insertion

[PATCH v12 19/22] selftests/vm: detect write violation on a mapped access-denied-key page

2018-02-21 Thread Ram Pai
detect write-violation on a page to which access-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff

[PATCH v12 21/22] selftests/vm: sub-page allocator

2018-02-21 Thread Ram Pai
introduce a new allocator that allocates 4k hardware-pages to back 64k linux-page. This allocator is only applicable on powerpc. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 30 ++ 1 files changed, 30

[PATCH v12 22/22] selftests/vm: Fix deadlock in protection_keys.c

2018-02-21 Thread Ram Pai
Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann tools/testing/selftests/vm/pkey-helpers.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- tools/testing/selftests/vm/pkey-helpers.h |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tools/testing

[PATCH v12 13/22] selftests/vm: powerpc implementation for generic abstraction

2018-02-21 Thread Ram Pai
Introduce powerpc implementation for the various abstractions. 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| 128 ++ tools

[PATCH v12 16/22] selftests/vm: fix an assertion in test_pkey_alloc_exhaust()

2018-02-21 Thread Ram Pai
<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

[PATCH v12 13/22] selftests/vm: powerpc implementation for generic abstraction

2018-02-21 Thread Ram Pai
Introduce powerpc implementation for the various abstractions. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 128 ++ tools/testing/selftests/vm/protection_keys.c | 42 +--- 2 files changed, 136

[PATCH v12 16/22] selftests/vm: fix an assertion in test_pkey_alloc_exhaust()

2018-02-21 Thread Ram Pai
The maximum number of keys that can be allocated has to take into consideration, that some keys are reserved by the architecture for specific purpose. Hence cannot be allocated. Fix the assertion in test_pkey_alloc_exhaust() cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai

[PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey

2018-02-21 Thread Ram Pai
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

[PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey

2018-02-21 Thread Ram Pai
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 cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 22 -- tools/testing

[PATCH v12 12/22] selftests/vm: generic cleanup

2018-02-21 Thread Ram Pai
cleanup the code to satisfy coding styles. 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/protection_keys.c | 81 ++ 1 files changed, 43

[PATCH v12 12/22] selftests/vm: generic cleanup

2018-02-21 Thread Ram Pai
cleanup the code to satisfy coding styles. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 81 ++ 1 files changed, 43 insertions(+), 38 deletions(-) diff --git a/tools/testing/selftests/vm

[PATCH v12 10/22] selftests/vm: introduce two arch independent abstraction

2018-02-21 Thread Ram Pai
open_hugepage_file() <- opens the huge page file get_start_key() <-- provides the first non-reserved key. 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/

[PATCH v12 10/22] selftests/vm: introduce two arch independent abstraction

2018-02-21 Thread Ram Pai
open_hugepage_file() <- opens the huge page file get_start_key() <-- provides the first non-reserved key. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 11 +++ tools/testing/selftests/vm/protection_keys.c

[PATCH v12 06/22] selftests/vm: fix the wrong assert in pkey_disable_set()

2018-02-21 Thread Ram Pai
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. cc: Dave Hansen <dave.han...@intel.com> cc: Florian Weimer <fwei...@redhat.com> Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/te

[PATCH v12 06/22] selftests/vm: fix the wrong assert in pkey_disable_set()

2018-02-21 Thread Ram Pai
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. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |2 +- 1 files changed, 1 insertions(+), 1 deletions

[PATCH v12 00/22] selftests, powerpc, x86 : Memory Protection Keys

2018-02-21 Thread Ram Pai
have it defined. version 11: (1) fixed a deadlock in the ptrace testcase. version 10 and prior: (1) moved the testcase to arch neutral directory (2) split the changes into incremental patches. Ram Pai (21): selftests/x86: Move protecton key selftest to arch neutral

[PATCH v12 00/22] selftests, powerpc, x86 : Memory Protection Keys

2018-02-21 Thread Ram Pai
have it defined. version 11: (1) fixed a deadlock in the ptrace testcase. version 10 and prior: (1) moved the testcase to arch neutral directory (2) split the changes into incremental patches. Ram Pai (21): selftests/x86: Move protecton key selftest to arch neutral

[PATCH v12 0/3] mm, x86, powerpc: Enhancements to Memory Protection Keys.

2018-02-21 Thread Ram Pai
* 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, powerpc, x86: introduce an additional vma bit for powerpc

[PATCH v12 0/3] mm, x86, powerpc: Enhancements to Memory Protection Keys.

2018-02-21 Thread Ram Pai
* 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, powerpc, x86: introduce an additional vma bit for powerpc

[PATCH v12 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-02-21 Thread Ram Pai
man.id.au> cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> cc: Andrew Morton <a...@linux-foundation.org> 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> --

[PATCH v12 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-02-21 Thread Ram Pai
Signed-off-by: Ram Pai Reviewed-by: Ingo Molnar Reviewed-by: Aneesh Kumar K.V --- fs/proc/task_mmu.c |4 ++-- include/linux/mm.h |9 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index ec6d298..6b996d0 100644 --- a/fs

[PATCH v12 3/3] mm, x86, powerpc: display pkey in smaps only if arch supports pkeys

2018-02-21 Thread Ram Pai
cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> cc: Andrew Morton <a...@linux-foundation.org> 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 <m

[PATCH v12 2/3] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey

2018-02-21 Thread Ram Pai
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

[PATCH v12 3/3] mm, x86, powerpc: display pkey in smaps only if arch supports pkeys

2018-02-21 Thread Ram Pai
-by: Thiago Jung Bauermann (fixed compilation errors for x86 configs) Acked-by: Michal Hocko Reviewed-by: Ingo Molnar Signed-off-by: Ram Pai --- arch/powerpc/include/asm/mmu_context.h |5 - arch/x86/include/asm/mmu_context.h |5 - arch/x86/include/asm/pkeys.h |1 + arch

[PATCH v12 2/3] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey

2018-02-21 Thread Ram Pai
Acked-by: Balbir Singh Signed-off-by: Ram Pai --- fs/proc/task_mmu.c |1 + include/linux/mm.h |3 ++- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 6b996d0..6d83bb7 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c

Re: [PATCH v11 3/3] mm, x86: display pkey in smaps only if arch supports pkeys

2018-02-01 Thread Ram Pai
On Fri, Feb 02, 2018 at 12:27:27PM +0800, kbuild test robot wrote: > Hi Ram, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [also build test ERROR on v4.15 next-20180201] > [if your patch is applied to the wrong git tree, please drop us a

Re: [PATCH v11 3/3] mm, x86: display pkey in smaps only if arch supports pkeys

2018-02-01 Thread Ram Pai
On Fri, Feb 02, 2018 at 12:27:27PM +0800, kbuild test robot wrote: > Hi Ram, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [also build test ERROR on v4.15 next-20180201] > [if your patch is applied to the wrong git tree, please drop us a

[PATCH v11 2/3] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey

2018-01-30 Thread Ram Pai
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>

[PATCH v11 2/3] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey

2018-01-30 Thread Ram Pai
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 Signed-off-by: Ram Pai --- fs/proc/task_mmu.c |1 + include/linux/mm.h |3

[PATCH v11 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-01-30 Thread Ram Pai
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

[PATCH v11 3/3] mm, x86: display pkey in smaps only if arch supports pkeys

2018-01-30 Thread Ram Pai
if the architecture support pkeys, i.e arch_pkeys_enabled() returns true. This patch provides x86 implementation for arch_pkeys_enabled(). x86 arch_show_smap() function is not needed anymore. Deleting it. Signed-off-by: Ram Pai <linux...@us.ibm.com> --- arch/x86/include/asm/pkeys.h |1 + arch/x86/

[PATCH v11 0/3] mm, x86, powerpc: Enhancements to Memory Protection Keys.

2018-01-30 Thread Ram Pai
by Michal Hocko version prior to v11: (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

[PATCH v11 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-01-30 Thread Ram Pai
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 --- fs/proc/task_mmu.c |4 ++-- include/linux/mm.h

[PATCH v11 3/3] mm, x86: display pkey in smaps only if arch supports pkeys

2018-01-30 Thread Ram Pai
if the architecture support pkeys, i.e arch_pkeys_enabled() returns true. This patch provides x86 implementation for arch_pkeys_enabled(). x86 arch_show_smap() function is not needed anymore. Deleting it. Signed-off-by: Ram Pai --- arch/x86/include/asm/pkeys.h |1 + arch/x86/kernel/fpu/xstate.c |5

[PATCH v11 0/3] mm, x86, powerpc: Enhancements to Memory Protection Keys.

2018-01-30 Thread Ram Pai
by Michal Hocko version prior to v11: (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

Re: [PATCH v10 27/27] mm: display pkey in smaps if arch_pkeys_enabled() is true

2018-01-30 Thread Ram Pai
On Tue, Jan 30, 2018 at 01:16:11PM +0100, Michal Hocko wrote: > On Thu 18-01-18 17:50:48, Ram Pai wrote: > [...] > > @@ -851,9 +848,13 @@ static int show_smap(struct seq_file *m, void *v, int > > is_pid) > >(unsigned long)(mss

Re: [PATCH v10 27/27] mm: display pkey in smaps if arch_pkeys_enabled() is true

2018-01-30 Thread Ram Pai
On Tue, Jan 30, 2018 at 01:16:11PM +0100, Michal Hocko wrote: > On Thu 18-01-18 17:50:48, Ram Pai wrote: > [...] > > @@ -851,9 +848,13 @@ static int show_smap(struct seq_file *m, void *v, int > > is_pid) > >(unsigned long)(mss

Re: [PATCH 06/10] signal: Helpers for faults with specialized siginfo layouts

2018-01-24 Thread Ram Pai
On Tue, Jan 23, 2018 at 03:07:15PM -0600, Eric W. Biederman wrote: > The helpers added are: > send_sig_mceerr > force_sig_mceerr > force_sig_bnderr > force_sig_pkuerr > > Filling out siginfo properly can ge tricky. Especially for these > specialized cases where the temptation is to share code

Re: [PATCH 06/10] signal: Helpers for faults with specialized siginfo layouts

2018-01-24 Thread Ram Pai
On Tue, Jan 23, 2018 at 03:07:15PM -0600, Eric W. Biederman wrote: > The helpers added are: > send_sig_mceerr > force_sig_mceerr > force_sig_bnderr > force_sig_pkuerr > > Filling out siginfo properly can ge tricky. Especially for these > specialized cases where the temptation is to share code

Re: [PATCH v10 01/27] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-01-22 Thread Ram Pai
on these changes. Dave Hansen had comments/suggestions in the initial revisions, which have been incorporated. Michael Ellermen has accepted the rest of the powerpc related patches in this series. Thanks, RP On Thu, Jan 18, 2018 at 05:50:22PM -0800, Ram Pai wrote

Re: [PATCH v10 01/27] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-01-22 Thread Ram Pai
on these changes. Dave Hansen had comments/suggestions in the initial revisions, which have been incorporated. Michael Ellermen has accepted the rest of the powerpc related patches in this series. Thanks, RP On Thu, Jan 18, 2018 at 05:50:22PM -0800, Ram Pai wrote

[PATCH v10 03/24] selftests/vm: move generic definitions to header file

2018-01-22 Thread Ram Pai
Moved all the generic definition and helper functions to the header file Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/pkey-helpers.h| 62 ++-- tools/testing/selftests/vm/protection_keys.c | 66 -- 2 files c

[PATCH v10 03/24] selftests/vm: move generic definitions to header file

2018-01-22 Thread Ram Pai
Moved all the generic definition and helper functions to the header file Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 62 ++-- tools/testing/selftests/vm/protection_keys.c | 66 -- 2 files changed, 57 insertions(+), 71

[PATCH v10 02/24] selftests/vm: rename all references to pkru to a generic name

2018-01-22 Thread Ram Pai
some pkru references are named to pkey_reg and some prku references are renamed to pkey Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/pkey-helpers.h| 85 +- tools/testing/selftests/vm/protection_keys.c | 227 ++ 2 files c

[PATCH v10 02/24] selftests/vm: rename all references to pkru to a generic name

2018-01-22 Thread Ram Pai
some pkru references are named to pkey_reg and some prku references are renamed to pkey Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 85 +- tools/testing/selftests/vm/protection_keys.c | 227 ++ 2 files changed, 164 insertions

[PATCH v10 04/24] selftests/vm: typecast the pkey register

2018-01-22 Thread Ram Pai
This is in preparation to accomadate a differing size register across architectures. Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/pkey-helpers.h| 27 +- tools/testing/selftests/vm/protection_keys.c | 69 ++ 2 files c

[PATCH v10 04/24] selftests/vm: typecast the pkey register

2018-01-22 Thread Ram Pai
This is in preparation to accomadate a differing size register across architectures. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 27 +- tools/testing/selftests/vm/protection_keys.c | 69 ++ 2 files changed, 51 insertions(+), 45

[PATCH v10 07/24] selftests/vm: fixed bugs in pkey_disable_clear()

2018-01-22 Thread Ram Pai
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

[PATCH v10 07/24] selftests/vm: fixed bugs in pkey_disable_clear()

2018-01-22 Thread Ram Pai
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 --- tools/testing/selftests/vm/protection_keys.c |4

[PATCH v10 08/24] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-01-22 Thread Ram Pai
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

[PATCH v10 08/24] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-01-22 Thread Ram Pai
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 --- tools/testing/selftests/vm/protection_keys.c |3 +++ 1

[PATCH v10 05/24] selftests/vm: generic function to handle shadow key register

2018-01-22 Thread Ram Pai
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(

[PATCH v10 05/24] selftests/vm: generic function to handle shadow key register

2018-01-22 Thread Ram Pai
helper functions to handler shadow pkey register Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 27 tools/testing/selftests/vm/protection_keys.c | 34 - 2 files changed, 49 insertions(+), 12 deletions(-) diff --git

[PATCH v10 09/24] selftests/vm: fix alloc_random_pkey() to make it really random

2018-01-22 Thread Ram Pai
alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. fixed it. Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/protection_keys.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/t

[PATCH v10 09/24] selftests/vm: fix alloc_random_pkey() to make it really random

2018-01-22 Thread Ram Pai
alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. fixed it. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm

[PATCH v10 11/24] selftests/vm: pkey register should match shadow pkey

2018-01-22 Thread Ram Pai
throughout Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/protection_keys.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 254b66d..6

[PATCH v10 11/24] selftests/vm: pkey register should match shadow pkey

2018-01-22 Thread Ram Pai
throughout Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 254b66d..6054093 100644 --- a/tools

[PATCH v10 10/24] selftests/vm: introduce two arch independent abstraction

2018-01-22 Thread Ram Pai
open_hugepage_file() <- opens the huge page file get_start_key() <-- provides the first non-reserved key. Signed-off-by: Ram Pai <linux...@us.ibm.com> --- tools/testing/selftests/vm/pkey-helpers.h| 11 +++ tools/testing/selftests/vm/protection_keys.c |6 +++--- 2 f

<    1   2   3   4   5   6   7   8   9   10   >