Patch "selftests: filter kselftest headers from command in lib.mk" has been added to the 5.9-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: filter kselftest headers from command in lib.mk

to the 5.9-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-filter-kselftest-headers-from-command-in-l.patch
and it can be found in the queue-5.9 subdirectory.

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



commit 3892606be20bea6f1144b0c81836e9c555f0b53b
Author: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
Date:   Thu Oct 8 15:26:21 2020 +0300

    selftests: filter kselftest headers from command in lib.mk
    
    [ Upstream commit f825d3f7ed9305e7dd0a3e0a74673a4257d0cc53 ]
    
    Commit 1056d3d2c97e ("selftests: enforce local header dependency in
    lib.mk") added header dependency to the rule, but as the rule uses $^,
    the headers are added to the compiler command line.
    
    This can cause unexpected precompiled header files being generated when
    compilation fails:
    
      $ echo { >> openat2_test.c
    
      $ make
      gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined  openat2_test.c
        tools/testing/selftests/kselftest_harness.h tools/testing/selftests/kselftest.h helpers.c
        -o tools/testing/selftests/openat2/openat2_test
      openat2_test.c:313:1: error: expected identifier or â??(â?? before â??{â?? token
        313 | {
            | ^
      make: *** [../lib.mk:140: tools/testing/selftests/openat2/openat2_test] Error 1
    
      $ file openat2_test*
      openat2_test:   GCC precompiled header (version 014) for C
      openat2_test.c: C source, ASCII text
    
    Fix it by filtering out the headers, so that we'll only pass the actual
    *.c files in the compiler command line.
    
    Fixes: 1056d3d2c97e ("selftests: enforce local header dependency in lib.mk")
    Signed-off-by: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
    Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Reviewed-by: Christian Brauner <christian.brauner@xxxxxxxxxx>
    Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 7a17ea8157367..66f3317dc3654 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -137,7 +137,7 @@ endif
 ifeq ($(OVERRIDE_TARGETS),)
 LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
 $(OUTPUT)/%:%.c $(LOCAL_HDRS)
-	$(LINK.c) $^ $(LDLIBS) -o $@
+	$(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@
 
 $(OUTPUT)/%.o:%.S
 	$(COMPILE.S) $^ -o $@



[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