selftests, x86: updates for x86 protection keys self tests
Dave Hansen
maintainercover selftests, x86: updates for x86 protection keys self tests
The memory protection keys selftests are spewing an uninitialized variable warning
I also included a fix that affected the 32-bit version of the pkeys test case. It was parsing the siginfo incorrectly.
Dave Hansen
maintainerPATCH 1/2 selftests, x86, protection_keys: fix uninitialized variable warning
From: Dave Hansen <[email protected]>
'orig_pkru' might have been uninitialized here. Fix it.
---
b/tools/testing/selftests/x86/protection_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/x86/protection_keys.c renamed from tools/testing/selftests/x86/protection_keys.c~pkeys-selftests-cleanrup-4-10-ish +1 -1
@@ -462,7 +462,7 @@ void pkey_disable_set(int pkey, int flagunsigned long syscall_flags =0 ;int ret;int pkey_rights; -u32 orig_pkru; +u32 orig_pkru =rdpkru ();dprintf1 ("START->%s(%d, 0x%x)\n" , __func__, pkey, flags);
_
Dave Hansen
maintainerPATCH 2/2 selftests, x86, protection_keys: fix wrong offset in siginfo
In reply to Dave HansenFrom: Dave Hansen <[email protected]>
The siginfo contains a bunch of information about the fault. For protection keys, it tells us which protection key's permissions were violated.
The wrong offset in here leads to reading garbage and thus failures in the tests.
We should probably eventually move this over to using the kernel's headers defining the siginfo instead of a hard-coded offset. But, for now, just do the simplest fix.
---
b/tools/testing/selftests/x86/protection_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/x86/protection_keys.c renamed from tools/testing/selftests/x86/protection_keys.c~pkeys-selftest-fix-32bit-offset +1 -1
@@ -192,7 +192,7 @@ void lots_o_noops_around_write(int *writ#define SYS_pkey_alloc 381#define SYS_pkey_free 382#define REG_IP_IDX REG_EIP -#define si_pkey_offset 0x18 +#define si_pkey_offset 0x14#else #define SYS_mprotect_key 329#define SYS_pkey_alloc 330
_
Quoted 6 lines · Dave Hansen
The memory protection keys selftests are spewing an uninitialized variable warning
I also included a fix that affected the 32-bit version of the pkeys test case. It was parsing the siginfo incorrectly.
Dave,
Thanks. Applied to linux-kselftest next for 4.11-rc1
-- Shuah