* + selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch added to -mm tree
@ 2021-06-11 22:22 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-06-11 22:22 UTC (permalink / raw)
To: aneesh.kumar, bauerman, dave.hansen, desnesn, fweimer, linuxram,
mhocko, mingo, mm-commits, mpe, msuchanek, sandipan, shuah, tglx
The patch titled
Subject: selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
has been added to the -mm tree. Its filename is
selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.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: Dave Hansen <dave.hansen@linux.intel.com>
Subject: selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
The alloc_pkey() sefltest function wraps the sys_pkey_alloc() system call.
On success, it updates its "shadow" register value because
sys_pkey_alloc() updates the real register.
But, the success check is wrong. pkey_alloc() considers any non-zero
return code to indicate success where the pkey register will be modified.
This fails to take negative return codes into account.
Consider only a positive return value as a successful call.
Link: https://lkml.kernel.org/r/20210611164157.87AB4246@viggo.jf.intel.com
Fixes: 5f23f6d082a9 ("x86/pkeys: Add self-tests")
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ram Pai <linuxram@us.ibm.com>
Cc: Sandipan Das <sandipan@linux.ibm.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: "Desnes A. Nunes do Rosario" <desnesn@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Michal Suchanek <msuchanek@suse.de>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/vm/protection_keys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/tools/testing/selftests/vm/protection_keys.c~selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code
+++ a/tools/testing/selftests/vm/protection_keys.c
@@ -510,7 +510,7 @@ int alloc_pkey(void)
" shadow: 0x%016llx\n",
__func__, __LINE__, ret, __read_pkey_reg(),
shadow_pkey_reg);
- if (ret) {
+ if (ret > 0) {
/* clear both the bits: */
shadow_pkey_reg = set_pkey_bits(shadow_pkey_reg, ret,
~PKEY_MASK);
_
Patches currently in -mm which might be from dave.hansen@linux.intel.com are
selftests-vm-pkeys-fix-alloc_random_pkey-to-make-it-really-really-random.patch
selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch
selftests-vm-pkeys-refill-shadow-register-after-implicit-kernel-write.patch
selftests-vm-pkeys-exercise-x86-xsave-init-state.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-11 22:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 22:22 + selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.