Patch "lkdtm: cfi: Make PAC test work with GCC 7 and 8" has been added to the 6.1-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

    lkdtm: cfi: Make PAC test work with GCC 7 and 8

to the 6.1-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:
     lkdtm-cfi-make-pac-test-work-with-gcc-7-and-8.patch
and it can be found in the queue-6.1 subdirectory.

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



commit ddb83fe757780cd35c6a9156fc1ed715862a4c67
Author: Kristina Martsenko <kristina.martsenko@xxxxxxx>
Date:   Fri Dec 9 17:34:41 2022 +0000

    lkdtm: cfi: Make PAC test work with GCC 7 and 8
    
    [ Upstream commit f68022ae0aeb0803450e05abc0e984027c33ef1b ]
    
    The CFI test uses the branch-protection=none compiler attribute to
    disable PAC return address protection on a function. While newer GCC
    versions support this attribute, older versions (GCC 7 and 8) instead
    supported the sign-return-address=none attribute, leading to a build
    failure when the test is built with older compilers. Fix it by checking
    which attribute is supported and using the correct one.
    
    Fixes: 2e53b877dc12 ("lkdtm: Add CFI_BACKWARD to test ROP mitigations")
    Reported-by: Daniel Díaz <daniel.diaz@xxxxxxxxxx>
    Signed-off-by: Kristina Martsenko <kristina.martsenko@xxxxxxx>
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/all/CAEUSe78kDPxQmQqCWW-_9LCgJDFhAeMoVBFnX9QLx18Z4uT4VQ@xxxxxxxxxxxxxx/
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/misc/lkdtm/cfi.c b/drivers/misc/lkdtm/cfi.c
index 5245cf6013c9..fc28714ae3a6 100644
--- a/drivers/misc/lkdtm/cfi.c
+++ b/drivers/misc/lkdtm/cfi.c
@@ -54,7 +54,11 @@ static void lkdtm_CFI_FORWARD_PROTO(void)
 # ifdef CONFIG_ARM64_BTI_KERNEL
 #  define __no_pac             "branch-protection=bti"
 # else
-#  define __no_pac             "branch-protection=none"
+#  ifdef CONFIG_CC_HAS_BRANCH_PROT_PAC_RET
+#   define __no_pac            "branch-protection=none"
+#  else
+#   define __no_pac            "sign-return-address=none"
+#  endif
 # endif
 # define __no_ret_protection   __noscs __attribute__((__target__(__no_pac)))
 #else



[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