The patch titled Subject: selftests/vm/pkeys: fix assertion in pkey_disable_set/clear() has been added to the -mm tree. Its filename is selftests-vm-pkeys-fix-assertion-in-pkey_disable_set-clear.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/selftests-vm-pkeys-fix-assertion-in-pkey_disable_set-clear.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/selftests-vm-pkeys-fix-assertion-in-pkey_disable_set-clear.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Ram Pai <linuxram@xxxxxxxxxx> Subject: selftests/vm/pkeys: fix assertion in pkey_disable_set/clear() In some cases, a pkey's bits need not necessarily change in a way that the value of the pkey register increases when performing a pkey_disable_set() or decreases when performing a pkey_disable_clear(). For example, on powerpc, if a pkey's current state is PKEY_DISABLE_ACCESS and we perform a pkey_write_disable() on it, the bits still remain the same. We will observe something similar when the pkey's current state is 0 and a pkey_access_enable() is performed on it. Either case would cause some assertions to fail. This fixes the problem. Link: http://lkml.kernel.org/r/8240665131e43fc93eed4eea8194676c1ea39a7f.1585646528.git.sandipan@xxxxxxxxxxxxx Signed-off-by: Ram Pai <linuxram@xxxxxxxxxx> Signed-off-by: Sandipan Das <sandipan@xxxxxxxxxxxxx> Acked-by: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Florian Weimer <fweimer@xxxxxxxxxx> Cc: "Desnes A. Nunes do Rosario" <desnesn@xxxxxxxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Thiago Jung Bauermann <bauerman@xxxxxxxxxxxxx> Cc: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Michal Suchanek <msuchanek@xxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/vm/protection_keys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/tools/testing/selftests/vm/protection_keys.c~selftests-vm-pkeys-fix-assertion-in-pkey_disable_set-clear +++ a/tools/testing/selftests/vm/protection_keys.c @@ -400,7 +400,7 @@ void pkey_disable_set(int pkey, int flag dprintf1("%s(%d) pkey_reg: 0x%016llx\n", __func__, pkey, read_pkey_reg()); if (flags) - pkey_assert(read_pkey_reg() > orig_pkey_reg); + pkey_assert(read_pkey_reg() >= orig_pkey_reg); dprintf1("END<---%s(%d, 0x%x)\n", __func__, pkey, flags); } @@ -431,7 +431,7 @@ void pkey_disable_clear(int pkey, int fl dprintf1("%s(%d) pkey_reg: 0x%016llx\n", __func__, pkey, read_pkey_reg()); if (flags) - assert(read_pkey_reg() < orig_pkey_reg); + assert(read_pkey_reg() <= orig_pkey_reg); } void pkey_write_allow(int pkey) _ Patches currently in -mm which might be from linuxram@xxxxxxxxxx are selftests-x86-pkeys-move-selftests-to-arch-neutral-directory.patch selftests-vm-pkeys-rename-all-references-to-pkru-to-a-generic-name.patch selftests-vm-pkeys-move-generic-definitions-to-header-file.patch selftests-vm-pkeys-fix-pkey_disable_clear.patch selftests-vm-pkeys-fix-assertion-in-pkey_disable_set-clear.patch selftests-vm-pkeys-fix-alloc_random_pkey-to-make-it-really-random.patch selftests-vm-pkeys-introduce-generic-pkey-abstractions.patch selftests-vm-pkeys-introduce-powerpc-support.patch selftests-vm-pkeys-fix-assertion-in-test_pkey_alloc_exhaust.patch selftests-vm-pkeys-improve-checks-to-determine-pkey-support.patch selftests-vm-pkeys-associate-key-on-a-mapped-page-and-detect-access-violation.patch selftests-vm-pkeys-associate-key-on-a-mapped-page-and-detect-write-violation.patch selftests-vm-pkeys-detect-write-violation-on-a-mapped-access-denied-key-page.patch selftests-vm-pkeys-introduce-a-sub-page-allocator.patch selftests-vm-pkeys-test-correct-behaviour-of-pkey-0.patch selftests-vm-pkeys-override-access-right-definitions-on-powerpc.patch