Skip to contentSkip to conversation

selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jul 6, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
has been removed from the -mm tree. Its filename was
selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Dave Hansen <[email protected]>
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.

Fixes 5f23f6d082a9 ("x86/pkeys: Add self-tests")
Cc Ram Pai <[email protected]>
Cc Sandipan Das <[email protected]>
Cc Florian Weimer <[email protected]>
Cc "Desnes A. Nunes do Rosario" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thiago Jung Bauermann <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Michal Suchanek <[email protected]>
Cc Shuah Khan <[email protected]>

---

 tools/testing/selftests/vm/protection_keys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/protection_keys.c renamed from tools/testing/selftests/vm/protection_keys.c~selftests-vm-pkeys-handle-negative-sys_pkey_alloc-return-code +1 -1
@@ -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 [email protected] are