lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 16 Oct 2020 06:10:59 +1000
From:   John Thomson <git@...nthomson.fastmail.com.au>
To:     linux-mips@...r.kernel.org
Cc:     Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        linux-kernel@...r.kernel.org,
        John Thomson <git@...nthomson.fastmail.com.au>
Subject: [PATCH 1/2] mips: boot compressed: preprocess linker script

Preprocess vmlinuz (self-decompressing kernel ELF) linker script
to avoid using ld -Ttext $(address)
https://lkml.kernel.org/lkml/20200413153453.zi4jvu3c4ul23e23@google.com/

Signed-off-by: John Thomson <git@...nthomson.fastmail.com.au>
---
 arch/mips/boot/compressed/.gitignore                   | 1 +
 arch/mips/boot/compressed/Makefile                     | 8 ++++++--
 arch/mips/boot/compressed/{ld.script => vmlinuz.lds.S} | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)
 rename arch/mips/boot/compressed/{ld.script => vmlinuz.lds.S} (96%)

diff --git a/arch/mips/boot/compressed/.gitignore b/arch/mips/boot/compressed/.gitignore
index d358395614c..1c367a2efb9 100644
--- a/arch/mips/boot/compressed/.gitignore
+++ b/arch/mips/boot/compressed/.gitignore
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 ashldi3.c
 bswapsi.c
+vmlinuz.lds
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 6e56caef69f..49d1adceade 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -96,11 +96,15 @@ UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
 
 vmlinuzobjs-y += $(obj)/piggy.o
 
+targets += vmlinuz.lds
+$(obj)/vmlinuz.lds: $(obj)/calc_vmlinuz_load_addr $(obj)/vmlinux.bin
+CPPFLAGS_vmlinuz.lds = -DVMLINUZ_LOAD_ADDRESS="$(VMLINUZ_LOAD_ADDRESS)"
+
 quiet_cmd_zld = LD      $@
-      cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
+      cmd_zld = $(LD) $(KBUILD_LDFLAGS) -T $< $(vmlinuzobjs-y) -o $@
 quiet_cmd_strip = STRIP	  $@
       cmd_strip = $(STRIP) -s $@
-vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
+vmlinuz: $(obj)/vmlinuz.lds $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
 	$(call cmd,zld)
 	$(call cmd,strip)
 
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/vmlinuz.lds.S
similarity index 96%
rename from arch/mips/boot/compressed/ld.script
rename to arch/mips/boot/compressed/vmlinuz.lds.S
index 2ed08fbef8e..890c31c55c1 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/vmlinuz.lds.S
@@ -14,7 +14,7 @@ PHDRS {
 SECTIONS
 {
 	/* Text and read-only data */
-	/* . = VMLINUZ_LOAD_ADDRESS; */
+	. = VMLINUZ_LOAD_ADDRESS;
 	.text : {
 		*(.text)
 		*(.rodata)
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ