Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package s390-tools for openSUSE:Factory checked in at 2023-02-22 15:21:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/s390-tools (Old) and /work/SRC/openSUSE:Factory/.s390-tools.new.1706 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "s390-tools" Wed Feb 22 15:21:41 2023 rev:54 rq:1067102 version:2.25.0 Changes: -------- --- /work/SRC/openSUSE:Factory/s390-tools/s390-tools.changes 2023-02-18 17:10:19.758714616 +0100 +++ /work/SRC/openSUSE:Factory/.s390-tools.new.1706/s390-tools.changes 2023-02-22 15:21:46.381924743 +0100 @@ -1,0 +2,20 @@ +Tue Feb 21 13:49:29 UTC 2023 - Nikolay Gueorguiev <nikolay.gueorgu...@suse.com> + +- Apllied the following patches (bsc#1208527, bsc#1206173) + * s390-tools-sles15sp5-01-zipl-boot-discard-.eh_frame-and-.interp-input-sectio.patch + * s390-tools-sles15sp5-02-zipl-boot-declare-that-no-executable-stack-is-requir.patch + * s390-tools-sles15sp5-03-zipl-boot-use-no-warn-rwx-segments-linker-flag.patch + * s390-tools-sles15sp5-04-zipl-boot-disable-build-id.patch + * s390-tools-sles15sp5-05-zipl-boot-simplify-objcopy-commands.patch + * s390-tools-sles15sp5-06-zipl-move-STAGE2_MAX_SIZE-and-STAGE1B_LOAD_ADDR-to-l.patch + * s390-tools-sles15sp5-07-zipl-boot-use-linker-scripts-for-all-bootloaders.patch + * s390-tools-sles15sp5-08-genprotimg-boot-declare-that-no-executable-stack-is-.patch + * s390-tools-sles15sp5-09-genprotimg-boot-use-no-warn-rwx-segments-linker-flag.patch + * s390-tools-sles15sp5-10-genprotimg-boot-disable-build-id.patch + * s390-tools-sles15sp5-11-genprotimg-boot-Makefile-simplify-objcopy-command.patch + * s390-tools-sles15sp5-12-genprotimg-boot-improve-linker-scripts.patch + * s390-tools-sles15sp5-13-genprotimg-boot-stage3b-add-size-check-to-the-linker.patch + * s390-tools-sles15sp5-14-genprotimg-boot-stage3b_reloc.bin-add-linker-script.patch + * s390-tools-sles15sp5-15-zipl-Embed-loader-data-directly-into-boot-object.patch + +------------------------------------------------------------------- New: ---- s390-tools-sles15sp5-01-zipl-boot-discard-.eh_frame-and-.interp-input-sectio.patch s390-tools-sles15sp5-02-zipl-boot-declare-that-no-executable-stack-is-requir.patch s390-tools-sles15sp5-03-zipl-boot-use-no-warn-rwx-segments-linker-flag.patch s390-tools-sles15sp5-04-zipl-boot-disable-build-id.patch s390-tools-sles15sp5-05-zipl-boot-simplify-objcopy-commands.patch s390-tools-sles15sp5-06-zipl-move-STAGE2_MAX_SIZE-and-STAGE1B_LOAD_ADDR-to-l.patch s390-tools-sles15sp5-07-zipl-boot-use-linker-scripts-for-all-bootloaders.patch s390-tools-sles15sp5-08-genprotimg-boot-declare-that-no-executable-stack-is-.patch s390-tools-sles15sp5-09-genprotimg-boot-use-no-warn-rwx-segments-linker-flag.patch s390-tools-sles15sp5-10-genprotimg-boot-disable-build-id.patch s390-tools-sles15sp5-11-genprotimg-boot-Makefile-simplify-objcopy-command.patch s390-tools-sles15sp5-12-genprotimg-boot-improve-linker-scripts.patch s390-tools-sles15sp5-13-genprotimg-boot-stage3b-add-size-check-to-the-linker.patch s390-tools-sles15sp5-14-genprotimg-boot-stage3b_reloc.bin-add-linker-script.patch s390-tools-sles15sp5-15-zipl-Embed-loader-data-directly-into-boot-object.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ s390-tools.spec ++++++ --- /var/tmp/diff_new_pack.XqfsZ5/_old 2023-02-22 15:21:47.545931345 +0100 +++ /var/tmp/diff_new_pack.XqfsZ5/_new 2023-02-22 15:21:47.549931368 +0100 @@ -148,6 +148,23 @@ Patch909: s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch Patch910: s390-tools-sles15sp1-11-zdev-Do-not-call-zipl-on-initrd-update.patch Patch911: s390-tools-sles15sp5-remove-no-pie-link-arguments.patch +# Bug 1208527, and bug 1206173 +Patch912: s390-tools-sles15sp5-01-zipl-boot-discard-.eh_frame-and-.interp-input-sectio.patch +Patch913: s390-tools-sles15sp5-02-zipl-boot-declare-that-no-executable-stack-is-requir.patch +Patch914: s390-tools-sles15sp5-03-zipl-boot-use-no-warn-rwx-segments-linker-flag.patch +Patch915: s390-tools-sles15sp5-04-zipl-boot-disable-build-id.patch +Patch916: s390-tools-sles15sp5-05-zipl-boot-simplify-objcopy-commands.patch +Patch917: s390-tools-sles15sp5-06-zipl-move-STAGE2_MAX_SIZE-and-STAGE1B_LOAD_ADDR-to-l.patch +Patch918: s390-tools-sles15sp5-07-zipl-boot-use-linker-scripts-for-all-bootloaders.patch +Patch919: s390-tools-sles15sp5-08-genprotimg-boot-declare-that-no-executable-stack-is-.patch +Patch920: s390-tools-sles15sp5-09-genprotimg-boot-use-no-warn-rwx-segments-linker-flag.patch +Patch921: s390-tools-sles15sp5-10-genprotimg-boot-disable-build-id.patch +Patch922: s390-tools-sles15sp5-11-genprotimg-boot-Makefile-simplify-objcopy-command.patch +Patch923: s390-tools-sles15sp5-12-genprotimg-boot-improve-linker-scripts.patch +Patch924: s390-tools-sles15sp5-13-genprotimg-boot-stage3b-add-size-check-to-the-linker.patch +Patch925: s390-tools-sles15sp5-14-genprotimg-boot-stage3b_reloc.bin-add-linker-script.patch +Patch926: s390-tools-sles15sp5-15-zipl-Embed-loader-data-directly-into-boot-object.patch +# Patch999: s390-tools-sles15sp5-fix-chown-commands-syntax.patch BuildRequires: curl-devel ++++++ read_values.c ++++++ --- /var/tmp/diff_new_pack.XqfsZ5/_old 2023-02-22 15:21:47.913933432 +0100 +++ /var/tmp/diff_new_pack.XqfsZ5/_new 2023-02-22 15:21:47.917933455 +0100 @@ -1,6 +1,6 @@ /********************************************************************************/ /* */ -/* Copyright (C) 2014-2015, 2019-2020 SUSE LLC */ +/* Copyright (C) 2014-2015, 2019-2023 SUSE LLC */ /* */ /* All rights reserved. ++++++ s390-tools-sles15sp5-01-zipl-boot-discard-.eh_frame-and-.interp-input-sectio.patch ++++++ --- zipl/boot/stage2.lds.S | 7 ++++++- zipl/boot/stage3.lds.S | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) --- a/zipl/boot/stage2.lds.S +++ b/zipl/boot/stage2.lds.S @@ -88,6 +88,11 @@ SECTIONS } __stack_end = .; - .eh_frame : { *(.eh_frame) } .note.gnu.build-id : { *(.note.gnu.build-id) } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + } } --- a/zipl/boot/stage3.lds.S +++ b/zipl/boot/stage3.lds.S @@ -39,7 +39,6 @@ SECTIONS __ex_table_start = .; .ex_table : { *(.ex_table) } __ex_table_stop = .; - .eh_frame : { *(.eh_frame) } __bss_start = .; .bss : { *(.bss) } @@ -75,4 +74,10 @@ SECTIONS .notes : { *(.note.*) } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + } } ++++++ s390-tools-sles15sp5-02-zipl-boot-declare-that-no-executable-stack-is-requir.patch ++++++ --- zipl/boot/entry.S | 5 +++++ zipl/boot/head.S | 5 +++++ zipl/boot/stage2.lds.S | 1 + zipl/boot/stage3.lds.S | 1 + 4 files changed, 12 insertions(+) --- a/zipl/boot/entry.S +++ b/zipl/boot/entry.S @@ -18,3 +18,8 @@ pgm_check_handler: basr %r14,%r14 lmg %r0,%r15,__LC_SAVE_AREA_SYNC lpswe __LC_PGM_OLD_PSW(%r0) + +/* The code doesn't require an executable stack */ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif --- a/zipl/boot/head.S +++ b/zipl/boot/head.S @@ -28,3 +28,8 @@ _start: brasl %r14,initialize .Lstack: .long 0x10000-160 .previous + +/* The code doesn't require an executable stack */ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif --- a/zipl/boot/stage2.lds.S +++ b/zipl/boot/stage2.lds.S @@ -94,5 +94,6 @@ SECTIONS /DISCARD/ : { *(.eh_frame) *(.interp) + *(.note.GNU-stack) } } --- a/zipl/boot/stage3.lds.S +++ b/zipl/boot/stage3.lds.S @@ -79,5 +79,6 @@ SECTIONS /DISCARD/ : { *(.eh_frame) *(.interp) + *(.note.GNU-stack) } } ++++++ s390-tools-sles15sp5-03-zipl-boot-use-no-warn-rwx-segments-linker-flag.patch ++++++ --- common.mak | 14 ++++++++++++++ zipl/boot/Makefile | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) --- a/common.mak +++ b/common.mak @@ -146,6 +146,20 @@ then \ fi # +# Test for linker option +# +# $1: Linker option +# +# Returns the linker option if available and nothing otherwise +# +define test_linker_flag +$(shell printf "int main(void) {return 0;}\n" | \ + ( $(CC) "-Wl,$1" -o /dev/null -x c - ) >/dev/null 2>&1 && printf -- '-Wl,%s' "$1") +endef + +NO_WARN_RWX_SEGMENTS_LDFLAGS := $(call test_linker_flag,"--no-warn-rwx-segments") + +# # Support alternate install root # # INSTALLDIR: Finally install s390-tools to INSTALLDIR. This can be used --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -75,7 +75,7 @@ stage3.exec: head.o stage3.o kdump3.o li 2) SFLAGS="-Wl,-T,stage2.lds";; \ 3) SFLAGS="-Wl,-T,stage3.lds";; \ esac; \ - $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@ %.bin: %.exec $(OBJCOPY) -O binary \ ++++++ s390-tools-sles15sp5-04-zipl-boot-disable-build-id.patch ++++++ --- zipl/boot/Makefile | 2 +- zipl/boot/stage2.lds.S | 2 -- zipl/boot/stage3.lds.S | 6 ------ 3 files changed, 1 insertion(+), 9 deletions(-) --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -75,7 +75,7 @@ stage3.exec: head.o stage3.o kdump3.o li 2) SFLAGS="-Wl,-T,stage2.lds";; \ 3) SFLAGS="-Wl,-T,stage3.lds";; \ esac; \ - $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ %.bin: %.exec $(OBJCOPY) -O binary \ --- a/zipl/boot/stage2.lds.S +++ b/zipl/boot/stage2.lds.S @@ -88,8 +88,6 @@ SECTIONS } __stack_end = .; - .note.gnu.build-id : { *(.note.gnu.build-id) } - /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) --- a/zipl/boot/stage3.lds.S +++ b/zipl/boot/stage3.lds.S @@ -69,12 +69,6 @@ SECTIONS } __stack_end = .; - /* List this explicitly as otherwise .note.gnu.build-id will be - * put at 0x0 */ - .notes : { - *(.note.*) - } - /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) ++++++ s390-tools-sles15sp5-05-zipl-boot-simplify-objcopy-commands.patch ++++++ --- zipl/boot/Makefile | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -78,37 +78,7 @@ stage3.exec: head.o stage3.o kdump3.o li $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ %.bin: %.exec - $(OBJCOPY) -O binary \ - --only-section=.stage2.head \ - --only-section=.text.dummy \ - --only-section=.text.start \ - --only-section=.text \ - --only-section=.ex_table \ - --only-section=.data \ - --only-section=.rodata.str1.2 \ - --only-section=.rodata.cst8 \ - --only-section=.rodata \ - --only-section=.stage2dump.tail \ - --only-section=.eckd2dump_mv.tail \ - --only-section=.fixup \ - $< $@ - -stage3.bin: stage3.exec - $(OBJCOPY) -O binary \ - --only-section=.stage2.head \ - --only-section=.text.dummy \ - --only-section=.text.start \ - --only-section=.text \ - --only-section=.ex_table \ - --only-section=.data \ - --only-section=.rodata.str1.2 \ - --only-section=.rodata.cst8 \ - --only-section=.rodata \ - --only-section=.stage2dump.tail \ - --only-section=.eckd2dump_mv.tail \ - --only-section=.fixup \ - --only-section=.sb.trailer \ - $< $@ + $(OBJCOPY) -O binary $< $@ data.o: $(FILES) $(LINK) $(NO_PIE_LDFLAGS) -static -nostdlib -Wl,--relocatable -Wl,--format,binary -o data.o $(FILES) ++++++ s390-tools-sles15sp5-06-zipl-move-STAGE2_MAX_SIZE-and-STAGE1B_LOAD_ADDR-to-l.patch ++++++ --- include/boot/loaders_layout.h | 3 +++ zipl/src/boot.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) --- a/include/boot/loaders_layout.h +++ b/include/boot/loaders_layout.h @@ -14,12 +14,15 @@ #include "lib/zt_common.h" #include "linux_layout.h" +#define STAGE1B_LOAD_ADDRESS _AC(0xe000, UL) + #define STAGE2_DESC _AC(0x78, UL) #define STAGE2_ENTRY _AC(0x2018, UL) #define STAGE2_HEAP_ADDRESS _AC(0x6000, UL) #define STAGE2_HEAP_SIZE _AC(0x3000, UL) #define STAGE2_STACK_ADDRESS _AC(0xe400, UL) #define STAGE2_STACK_SIZE _AC(0x1c00, UL) +#define STAGE2_MAX_SIZE _AC(0x3000, UL) #define STAGE3_ENTRY _AC(0xa000, UL) --- a/zipl/src/boot.c +++ b/zipl/src/boot.c @@ -17,6 +17,7 @@ #include <fcntl.h> #include <sys/stat.h> #include "lib/util_libc.h" +#include "boot/loaders_layout.h" #include "stage3.h" @@ -29,15 +30,13 @@ #define DATA_SIZE(x) ((size_t) (&_binary_##x##_bin_end - &_binary_##x##_bin_start)) #define DATA_ADDR(x) (&_binary_##x##_bin_start) -#define STAGE2_MAX_SIZE 0x3000 -#define STAGE1B_LOAD_ADDR 0xe000 #define CCW_FLAG_CC 0x40 #define CCW_FLAG_SLI 0x20 #define FBA_BLK_SIZE 512 static struct boot_ccw0 tic_to_stage1b = { .cmd = 0x08, /* tic */ - .address_lo = STAGE1B_LOAD_ADDR, + .address_lo = STAGE1B_LOAD_ADDRESS, }; /* Check sizes of internal objects. Return 0 if everything is correct, @@ -133,8 +132,7 @@ boot_init_fba_stage0(struct boot_fba_sta for (i = 0; i < stage1b_count; i++) { stage0->locdata[i].blocknr = (uint32_t) stage1b_list[i].linear.block; - stage0->locread[i].read.address_lo = - STAGE1B_LOAD_ADDR + i * FBA_BLK_SIZE; + stage0->locread[i].read.address_lo = STAGE1B_LOAD_ADDRESS + i * FBA_BLK_SIZE; } /* Terminate CCW chain: Tic to stage 1b */ memcpy(&stage0->locread[i], &tic_to_stage1b, sizeof(tic_to_stage1b)); @@ -178,7 +176,7 @@ boot_init_eckd_stage1(struct boot_eckd_s ((stage1b_list[i].chs.cyl >> 12) & 0xfff0); stage1->seek[i].sec = stage1b_list[i].chs.sec; stage1->ssrt[i].read.address_lo = - STAGE1B_LOAD_ADDR + i * stage1b_list[i].chs.size; + STAGE1B_LOAD_ADDRESS + i * stage1b_list[i].chs.size; stage1->ssrt[i].read.flags = CCW_FLAG_CC | CCW_FLAG_SLI; } /* Terminate CCW chain: Tic to stage 1b */ ++++++ s390-tools-sles15sp5-07-zipl-boot-use-linker-scripts-for-all-bootloaders.patch ++++++ --- include/boot/loaders_layout.h | 3 +++ zipl/boot/Makefile | 24 ++++++++++-------------- zipl/boot/stage0.lds.S | 18 ++++++++++++++++++ zipl/boot/stage1.lds.S | 18 ++++++++++++++++++ zipl/boot/stage1b.lds.S | 18 ++++++++++++++++++ 5 files changed, 67 insertions(+), 14 deletions(-) --- a/include/boot/loaders_layout.h +++ b/include/boot/loaders_layout.h @@ -14,6 +14,9 @@ #include "lib/zt_common.h" #include "linux_layout.h" +#define STAGE0_LOAD_ADDRESS _AC(0x0, UL) + +#define STAGE1_LOAD_ADDRESS _AC(0x18, UL) #define STAGE1B_LOAD_ADDRESS _AC(0xe000, UL) #define STAGE2_DESC _AC(0x78, UL) --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -42,6 +42,15 @@ endif %.lds: %.lds.S $(CPP) -Wp,-MD,.$@.d,-MT,$@ $(INCLUDE_PARMS) -P -C -o $@ $< +fba0.exec eckd0_ldl.exec eckd0_cdl.exec tape0.exec: \ + stage0.lds + +eckd1.exec: \ + stage1.lds + +eckd1b.exec fba1b.exec: \ + stage1b.lds + eckd2dump_sv.exec: \ head.o stage2dump.o cio.o eckd2dump.o eckd2dump_sv.o \ libc.o ebcdic.o sclp.o entry.o stage2.lds @@ -62,20 +71,7 @@ stage3.exec: head.o stage3.o kdump3.o li sclp_stage3.o kdump.o entry.o stage3.lds %.exec: %.o - STAGE=$$( \ - echo $@ | awk ' \ - match($$0,/[0-9]+b*/){ \ - print substr($$0,RSTART,RLENGTH) \ - }' \ - ); \ - case $$STAGE in \ - 0) SFLAGS="-Wl,-Ttext,0";; \ - 1) SFLAGS="-Wl,-Ttext,0x18";; \ - 1b) SFLAGS="-Wl,-Ttext,0xE000";; \ - 2) SFLAGS="-Wl,-T,stage2.lds";; \ - 3) SFLAGS="-Wl,-T,stage3.lds";; \ - esac; \ - $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ %.bin: %.exec $(OBJCOPY) -O binary $< $@ --- /dev/null +++ b/zipl/boot/stage0.lds.S @@ -0,0 +1,18 @@ +#include "boot/loaders_layout.h" + +ENTRY(_start) + +SECTIONS +{ + . = STAGE0_LOAD_ADDRESS; + .text : { + *(.text .text.*) + } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + *(.note.GNU-stack) + } +} --- /dev/null +++ b/zipl/boot/stage1.lds.S @@ -0,0 +1,18 @@ +#include "boot/loaders_layout.h" + +ENTRY(_start) + +SECTIONS +{ + . = STAGE1_LOAD_ADDRESS; + .text : { + *(.text .text.*) + } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + *(.note.GNU-stack) + } +} --- /dev/null +++ b/zipl/boot/stage1b.lds.S @@ -0,0 +1,18 @@ +#include "boot/loaders_layout.h" + +ENTRY(_start) + +SECTIONS +{ + . = STAGE1B_LOAD_ADDRESS; + .text : { + *(.text .text.*) + } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + *(.note.GNU-stack) + } +} ++++++ s390-tools-sles15sp5-08-genprotimg-boot-declare-that-no-executable-stack-is-.patch ++++++ --- genprotimg/boot/head.S | 5 +++++ genprotimg/boot/stage3a.lds.S | 1 + genprotimg/boot/stage3a_init.S | 5 +++++ genprotimg/boot/stage3b.lds.S | 1 + genprotimg/boot/stage3b_reloc.S | 5 +++++ 5 files changed, 17 insertions(+) --- a/genprotimg/boot/head.S +++ b/genprotimg/boot/head.S @@ -29,3 +29,8 @@ _start: brasl %r14, initialize .Lstack: .long STACK_ADDRESS + STACK_SIZE - STACK_FRAME_OVERHEAD .previous + +/* The code doesn't require an executable stack */ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif --- a/genprotimg/boot/stage3a.lds.S +++ b/genprotimg/boot/stage3a.lds.S @@ -99,5 +99,6 @@ SECTIONS /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) + *(.note.GNU-stack) } } --- a/genprotimg/boot/stage3a_init.S +++ b/genprotimg/boot/stage3a_init.S @@ -26,3 +26,8 @@ _init: br %r1 .Lstage3a_entry: .long STAGE3A_ENTRY .previous + +/* The code doesn't require an executable stack */ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif --- a/genprotimg/boot/stage3b.lds.S +++ b/genprotimg/boot/stage3b.lds.S @@ -83,5 +83,6 @@ SECTIONS /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) + *(.note.GNU-stack) } } --- a/genprotimg/boot/stage3b_reloc.S +++ b/genprotimg/boot/stage3b_reloc.S @@ -53,3 +53,8 @@ stage3b_start: .incbin "stage3b.bin" stage3b_end: .previous + +/* The code doesn't require an executable stack */ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif ++++++ s390-tools-sles15sp5-09-genprotimg-boot-use-no-warn-rwx-segments-linker-flag.patch ++++++ --- genprotimg/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -79,7 +79,7 @@ stage3b_reloc.elf: stage3b) SFLAGS="-Wl,-T,stage3b.lds";; \ stage3b_reloc) SFLAGS="-Wl,-estage3b_reloc_start,-Ttext,0";; \ esac; \ - $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ %.bin: %.elf ++++++ s390-tools-sles15sp5-10-genprotimg-boot-disable-build-id.patch ++++++ --- genprotimg/boot/Makefile | 2 +- genprotimg/boot/stage3a.lds.S | 6 ------ genprotimg/boot/stage3b.lds.S | 6 ------ 3 files changed, 1 insertion(+), 13 deletions(-) --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -79,7 +79,7 @@ stage3b_reloc.elf: stage3b) SFLAGS="-Wl,-T,stage3b.lds";; \ stage3b_reloc) SFLAGS="-Wl,-estage3b_reloc_start,-Ttext,0";; \ esac; \ - $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ %.bin: %.elf --- a/genprotimg/boot/stage3a.lds.S +++ b/genprotimg/boot/stage3a.lds.S @@ -90,12 +90,6 @@ SECTIONS ASSERT(ABSOLUTE(.) < 0x13000, "Data section doesn't conform to the described memory layout"); } - /* List this explicitly as otherwise .note.gnu.build-id will be - * put at 0x0 */ - .notes : { - *(.note.*) - } - /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) --- a/genprotimg/boot/stage3b.lds.S +++ b/genprotimg/boot/stage3b.lds.S @@ -74,12 +74,6 @@ SECTIONS } __stack_end = .; - /* List this explicitly as otherwise .note.gnu.build-id will be - * put at 0x0 */ - .notes : { - *(.note.*) - } - /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) ++++++ s390-tools-sles15sp5-11-genprotimg-boot-Makefile-simplify-objcopy-command.patch ++++++ --- genprotimg/boot/Makefile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -82,14 +82,8 @@ stage3b_reloc.elf: $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ -%.bin: %.elf - $(OBJCOPY) -O binary \ - --only-section=.text* \ - --only-section=.ex_table* \ - --only-section=.fixup* \ - --only-section=.data* \ - --only-section=.rodata* \ - $< $@ +%.bin: %.elf + $(OBJCOPY) -O binary $< $@ @chmod a-x $@ clean: ++++++ s390-tools-sles15sp5-12-genprotimg-boot-improve-linker-scripts.patch ++++++ --- genprotimg/boot/stage3a.lds.S | 11 +++++------ genprotimg/boot/stage3b.lds.S | 9 ++++----- 2 files changed, 9 insertions(+), 11 deletions(-) --- a/genprotimg/boot/stage3a.lds.S +++ b/genprotimg/boot/stage3a.lds.S @@ -23,8 +23,6 @@ ENTRY(_init) SECTIONS { - . = 0x0; - . = HEAP_ADDRESS; __heap_start = .; .heap : { @@ -46,7 +44,7 @@ SECTIONS . = STAGE3A_INIT_ENTRY; __text_init_start = .; .text : { - stage3a_init.o(.text.init) + *(.text.init) __text_init_stop = ABSOLUTE(.); /* Text size of text_init must be smaller than 'PARMAREA - IMAGE_ENTRY', * otherwise the text data could be overwritten by the original zipl stage3 @@ -56,8 +54,8 @@ SECTIONS . = 0x1000; ASSERT(ABSOLUTE(.) == STAGE3A_ENTRY, "Text section doesn't conform to the described memory layout"); - head.o(.text.start) - *(.text) + *(.text.start) + *(.text .text.*) } .ex_table ALIGN(16) : { @@ -74,7 +72,7 @@ SECTIONS .rodata ALIGN(16) : { *(.rodata) - *(.rodata.*) + *(.rodata*) } .data ALIGN(16) : { @@ -93,6 +91,7 @@ SECTIONS /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) + *(.interp) *(.note.GNU-stack) } } --- a/genprotimg/boot/stage3b.lds.S +++ b/genprotimg/boot/stage3b.lds.S @@ -21,8 +21,6 @@ ENTRY(_start) SECTIONS { - . = 0x0; - . = HEAP_ADDRESS; __heap_start = .; .heap : { @@ -34,8 +32,8 @@ SECTIONS . = STAGE3B_ENTRY; .text : { - head.o(.text.start) - *(.text) + *(.text.start) + *(.text .text.*) } .ex_table ALIGN(16) : { @@ -52,7 +50,7 @@ SECTIONS .rodata ALIGN(16) : { *(.rodata) - *(.rodata.*) + *(.rodata*) } .data ALIGN(16) : { @@ -77,6 +75,7 @@ SECTIONS /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) + *(.interp) *(.note.GNU-stack) } } ++++++ s390-tools-sles15sp5-13-genprotimg-boot-stage3b-add-size-check-to-the-linker.patch ++++++ --- genprotimg/boot/stage3b.lds.S | 2 ++ 1 file changed, 2 insertions(+) --- a/genprotimg/boot/stage3b.lds.S +++ b/genprotimg/boot/stage3b.lds.S @@ -72,6 +72,8 @@ SECTIONS } __stack_end = .; + ASSERT(. <= IMAGE_ENTRY, "stage3b size must be smaller than 0x10000 bytes") + /* Sections to be discarded */ /DISCARD/ : { *(.eh_frame) ++++++ s390-tools-sles15sp5-14-genprotimg-boot-stage3b_reloc.bin-add-linker-script.patch ++++++ --- genprotimg/boot/Makefile | 14 ++++---------- genprotimg/boot/stage3b_reloc.S | 4 ++-- genprotimg/boot/stage3b_reloc.lds.S | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -69,17 +69,11 @@ endif stage3b_reloc.o: stage3b.bin -stage3a.elf: head.o stage3a_init.o stage3a.o stage3a.lds $(ZIPL_OBJS) -stage3b.elf: head.o stage3b.o stage3b.lds $(ZIPL_OBJS) -stage3b_reloc.elf: +stage3a.elf: head.o stage3a_init.o $(ZIPL_OBJS) +stage3b.elf: head.o $(ZIPL_OBJS) -%.elf: %.o - case $* in \ - stage3a) SFLAGS="-Wl,-T,stage3a.lds";; \ - stage3b) SFLAGS="-Wl,-T,stage3b.lds";; \ - stage3b_reloc) SFLAGS="-Wl,-estage3b_reloc_start,-Ttext,0";; \ - esac; \ - $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ +%.elf: %.lds %.o + $(LINK) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,-T,$< -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ %.bin: %.elf --- a/genprotimg/boot/stage3b_reloc.S +++ b/genprotimg/boot/stage3b_reloc.S @@ -22,8 +22,8 @@ .org 0x0 .section .text.start -.globl stage3b_reloc_start -stage3b_reloc_start: +.globl _start +_start: /* Might be called after a diag308 so better set * architecture and addressing mode */ --- /dev/null +++ b/genprotimg/boot/stage3b_reloc.lds.S @@ -0,0 +1,19 @@ +OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") +OUTPUT_ARCH(s390:64-bit) + +ENTRY(_start) + +SECTIONS +{ + .text : { + *(.text.start) + *(.text .text.*) + } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + *(.note.GNU-stack) + } +} ++++++ s390-tools-sles15sp5-15-zipl-Embed-loader-data-directly-into-boot-object.patch ++++++ --- .gitignore | 1 + common.mak | 4 ++-- zipl/boot/Makefile | 16 ++++++---------- zipl/src/Makefile | 14 +++++--------- zipl/src/boot.c | 41 ++++++++++++++++++++++++++++++++++++++--- 5 files changed, 52 insertions(+), 24 deletions(-) --- a/.gitignore +++ b/.gitignore @@ -110,6 +110,7 @@ ziomon/ziorep_traffic ziomon/ziorep_utilization zipl/boot/*.bin zipl/boot/*.exec +zipl/boot/.loaders zipl/boot/data.h zipl/src/chreipl_helper.device-mapper zdev/src/zdev_id --- a/common.mak +++ b/common.mak @@ -410,8 +410,8 @@ $(rootdir)/libpv/libpv.a: $(rootdir)/lib $(MAKE) -C $(rootdir)/libpv libpv.a .PHONY: $(rootdir)/libpv -$(rootdir)/zipl/boot/data.o: - $(MAKE) -C $(rootdir)/zipl/boot/ data.o +$(rootdir)/zipl/boot/.loaders: + $(MAKE) -C $(rootdir)/zipl/boot/ .loaders install_dirs: for dir in $(INSTDIRS); do \ --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -20,7 +20,10 @@ FILES = fba0.bin fba1b.bin fba2.bin \ tape0.bin \ eckd2dump_sv.bin tape2dump.bin fba2dump.bin eckd2dump_mv.bin -all: data.o data.h tape0.bin stage3.bin +all: .loaders tape0.bin stage3.bin + +.loaders: $(FILES) + touch .loaders # Prevent make from using some default rules... %: %.S @@ -76,16 +79,9 @@ stage3.exec: head.o stage3.o kdump3.o li %.bin: %.exec $(OBJCOPY) -O binary $< $@ -data.o: $(FILES) - $(LINK) $(NO_PIE_LDFLAGS) -static -nostdlib -Wl,--relocatable -Wl,--format,binary -o data.o $(FILES) - -data.h: data.o - rm -f data.h - $(NM) data.o | while read ADDR TYPE SYMBOL ; do \ - echo "extern char $$SYMBOL;" >>data.h; done clean: - rm -f -- *.o *.exec *.bin $(FILES) data.o data.h tape0.bin *.xxx *.yyy \ - stage3.bin *.lds .*.lds.d + rm -f -- *.o *.exec *.bin $(FILES) tape0.bin *.xxx *.yyy \ + stage3.bin *.lds .*.lds.d .loaders .PHONY: all clean --- a/zipl/src/Makefile +++ b/zipl/src/Makefile @@ -4,14 +4,14 @@ include ../../common.mak ALL_CPPFLAGS += -I../include -I../boot \ -DZFCPDUMP_IMAGE="STRINGIFY($(ZFCPDUMP_DIR)/$(ZFCPDUMP_IMAGE))" \ -DZFCPDUMP_INITRD="STRINGIFY($(ZFCPDUMP_DIR)/$(ZFCPDUMP_INITRD))" \ - -D_FILE_OFFSET_BITS=64 $(NO_PIE_CFLAGS) + -D_FILE_OFFSET_BITS=64 $(NO_PIE_CFLAGS) -DBUILD_PATH="../boot" ALL_LDFLAGS += -Wl,-z,noexecstack $(NO_PIE_LDFLAGS) libs = $(rootdir)/libutil/libutil.a \ $(rootdir)/libvtoc/libvtoc.a \ objects = misc.o error.o scan.o job.o boot.o bootmap.o fs-map.o disk.o \ - bootmap_header.o envblk.o install.o zipl.o $(rootdir)/zipl/boot/data.o + bootmap_header.o envblk.o install.o zipl.o zipl_helpers = $(basename $(wildcard zipl_helper.*.c)) chreipl_helpers = $(subst zipl_,chreipl_, $(zipl_helpers)) @@ -19,6 +19,7 @@ zipl_stage3 = ../boot/stage3.bin all: zipl zipl-editenv $(chreipl_helpers) $(zipl_stage3) +boot.o: ../boot/.loaders zipl: $(objects) $(libs) zipl_helper.device-mapper: $(rootdir)/libdasd/libdasd.a \ @@ -47,13 +48,8 @@ clean: # Additional manual dependencies -.boot.o.d boot.o: ../boot/data.h - -../boot/data.h: - $(MAKE) -C ../boot data.h - -../boot/data.o: - $(MAKE) -C ../boot data.o +../boot/.loaders: + $(MAKE) -C ../boot .loaders ../boot/stage3.bin: $(MAKE) -C ../boot stage3.bin --- a/zipl/src/boot.c +++ b/zipl/src/boot.c @@ -21,14 +21,49 @@ #include "stage3.h" -#include "../boot/data.h" #include "boot.h" #include "bootmap.h" #include "error.h" #include "misc.h" -#define DATA_SIZE(x) ((size_t) (&_binary_##x##_bin_end - &_binary_##x##_bin_start)) -#define DATA_ADDR(x) (&_binary_##x##_bin_start) +/* Import a binary file */ +/* clang-format off */ +#define DATA_NAME(SYM, SUFFIX) _binary_##SYM##_bin##SUFFIX +#define DATA_SIZE(SYM) ((size_t)(&DATA_NAME(SYM, _end) - &DATA_NAME(SYM, _start))) +#define DATA_ADDR(SYM) (&DATA_NAME(SYM, _start)) +#define BIN_FILE_PATH(FILE_NAME) STRINGIFY(BUILD_PATH) "/" STRINGIFY(FILE_NAME) ".bin" +#define IMPORT_DATA(SYM) \ + extern const uint8_t DATA_NAME(SYM, _start); \ + extern const uint8_t DATA_NAME(SYM, _end); \ + asm(".section \".rodata\", \"a\", @progbits\n" \ + ".balign 4\n" \ + ".global " STRINGIFY(DATA_NAME(SYM, _start)) "\n" \ + STRINGIFY(DATA_NAME(SYM, _start)) ":\n" \ + ".incbin \"" BIN_FILE_PATH(SYM) "\"\n" \ + ".global " STRINGIFY(DATA_NAME(SYM, _end)) "\n" \ + STRINGIFY(DATA_NAME(SYM, _end)) ":\n" \ + ".balign 4\n" \ + ".previous\n") +/* clang-format on */ + +/* Stage 0 Loader */ +IMPORT_DATA(eckd0_cdl); +IMPORT_DATA(eckd0_ldl); +IMPORT_DATA(fba0); +IMPORT_DATA(tape0); +/* Stage 1 Loader */ +IMPORT_DATA(eckd1); +/* Stage 1b Loader */ +IMPORT_DATA(eckd1b); +IMPORT_DATA(fba1b); +/* Stage 2 Loader */ +IMPORT_DATA(eckd2); +IMPORT_DATA(fba2); +/* Stage 2 Dump Loader */ +IMPORT_DATA(eckd2dump_mv); +IMPORT_DATA(eckd2dump_sv); +IMPORT_DATA(fba2dump); +IMPORT_DATA(tape2dump); #define CCW_FLAG_CC 0x40 #define CCW_FLAG_SLI 0x20