Patch "selftests/vm/pkeys: handle negative sys_pkey_alloc() return code" has been added to the 5.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests/vm/pkeys: handle negative sys_pkey_alloc() return code

to the 5.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-vm-pkeys-handle-negative-sys_pkey_alloc-re.patch
and it can be found in the queue-5.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 422745c7db403ee40802bb70781d9a01df16fecc
Author: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Date:   Wed Jun 30 18:56:56 2021 -0700

    selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
    
    [ Upstream commit bf68294a2ec39ed7fec6a5b45d52034e6983157a ]
    
    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@xxxxxxxxxxxxxxxxxx
    Fixes: 5f23f6d082a9 ("x86/pkeys: Add self-tests")
    Reported-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
    Tested-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx>
    Cc: Ram Pai <linuxram@xxxxxxxxxx>
    Cc: Sandipan Das <sandipan@xxxxxxxxxxxxx>
    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: 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>
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
index 9ee0ae5d3e06..356d62fca27f 100644
--- a/tools/testing/selftests/vm/protection_keys.c
+++ b/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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux