Patch "x86/purgatory: Fail the build if purgatory.ro has missing symbols" has been added to the 5.4-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

    x86/purgatory: Fail the build if purgatory.ro has missing symbols

to the 5.4-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:
     x86-purgatory-fail-the-build-if-purgatory.ro-has-mis.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 73080c3a50981d969859bdbc1c85d079e59458b0
Author: Hans de Goede <hdegoede@xxxxxxxxxx>
Date:   Tue Mar 17 14:08:41 2020 +0100

    x86/purgatory: Fail the build if purgatory.ro has missing symbols
    
    [ Upstream commit e4160b2e4b02377c67f8ecd05786811598f39acd ]
    
    Linking purgatory.ro with -r enables "incremental linking"; this means
    no checks for unresolved symbols are done while linking purgatory.ro.
    
    A change to the sha256 code has caused the purgatory in 5.4-rc1 to have
    a missing symbol on memzero_explicit(), yet things still happily build.
    
    Add an extra check for unresolved symbols by calling ld without -r
    before running bin2c to generate kexec-purgatory.c.
    
    This causes a build of 5.4-rc1 with this patch added to fail as it should:
    
        CHK     arch/x86/purgatory/purgatory.ro
      ld: arch/x86/purgatory/purgatory.ro: in function `sha256_transform':
      sha256.c:(.text+0x1c0c): undefined reference to `memzero_explicit'
      make[2]: *** [arch/x86/purgatory/Makefile:72:
          arch/x86/purgatory/kexec-purgatory.c] Error 1
      make[1]: *** [scripts/Makefile.build:509: arch/x86/purgatory] Error 2
      make: *** [Makefile:1650: arch/x86] Error 2
    
    Also remove --no-undefined from LDFLAGS_purgatory.ro as that has no
    effect.
    
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Borislav Petkov <bp@xxxxxxx>
    Link: https://lkml.kernel.org/r/20200317130841.290418-2-hdegoede@xxxxxxxxxx
    Stable-dep-of: 97b6b9cbba40 ("x86/purgatory: remove PGO flags")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/purgatory/.gitignore b/arch/x86/purgatory/.gitignore
new file mode 100644
index 0000000000000..d2be1500671de
--- /dev/null
+++ b/arch/x86/purgatory/.gitignore
@@ -0,0 +1 @@
+purgatory.chk
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 969d2b2eb7d71..d0f628601d47a 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -14,8 +14,12 @@ $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
 
 CFLAGS_sha256.o := -D__DISABLE_EXPORTS
 
-LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
-targets += purgatory.ro
+# When linking purgatory.ro with -r unresolved symbols are not checked,
+# also link a purgatory.chk binary without -r to check for unresolved symbols.
+PURGATORY_LDFLAGS := -e purgatory_start -nostdlib -z nodefaultlib
+LDFLAGS_purgatory.ro := -r $(PURGATORY_LDFLAGS)
+LDFLAGS_purgatory.chk := $(PURGATORY_LDFLAGS)
+targets += purgatory.ro purgatory.chk
 
 # Sanitizer, etc. runtimes are unavailable and cannot be linked here.
 GCOV_PROFILE	:= n
@@ -64,12 +68,15 @@ AFLAGS_REMOVE_entry64.o			+= -g -Wa,-gdwarf-2
 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
 		$(call if_changed,ld)
 
+$(obj)/purgatory.chk: $(obj)/purgatory.ro FORCE
+		$(call if_changed,ld)
+
 targets += kexec-purgatory.c
 
 quiet_cmd_bin2c = BIN2C   $@
       cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
 
-$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
+$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro $(obj)/purgatory.chk FORCE
 	$(call if_changed,bin2c)
 
 obj-$(CONFIG_KEXEC_FILE)	+= kexec-purgatory.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