From c98c28b1d3288fa6c8c8e581debd8516ef6bc07c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 20 Aug 2022 20:12:56 +0200 Subject: [PATCH] fix up makefile patches --- ...ile-link-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...and-boot-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...ile-link-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...and-boot-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...ile-link-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...and-boot-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...ile-link-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...and-boot-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...ile-link-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- ...and-boot-with-z-noexecstack-no-warn-rwx-segments.patch | 8 +++----- 10 files changed, 30 insertions(+), 50 deletions(-) diff --git a/queue-4.14/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-4.14/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch index b021329f240..0a79c1d77f8 100644 --- a/queue-4.14/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-4.14/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch @@ -40,19 +40,17 @@ Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) + Makefile | 3 +++ + 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile -@@ -873,6 +873,11 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATI +@@ -873,6 +873,9 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATI LDFLAGS_vmlinux += $(call ld-option, --gc-sections,) endif +LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) diff --git a/queue-4.14/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-4.14/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch index da767fd91d8..4a81185cd05 100644 --- a/queue-4.14/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-4.14/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch @@ -41,9 +41,9 @@ Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/Makefile | 2 +- - arch/x86/boot/compressed/Makefile | 6 ++++++ + arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- - 3 files changed, 8 insertions(+), 2 deletions(-) + 3 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -58,15 +58,13 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile -@@ -55,6 +55,12 @@ else +@@ -55,6 +55,10 @@ else LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif + +LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + LDFLAGS_vmlinux := -T diff --git a/queue-4.19/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-4.19/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch index 7f893762687..ad1ba857065 100644 --- a/queue-4.19/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-4.19/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch @@ -40,19 +40,17 @@ Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) + Makefile | 3 +++ + 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile -@@ -876,6 +876,11 @@ LDFLAGS_BUILD_ID := $(call ld-option, -- +@@ -876,6 +876,9 @@ LDFLAGS_BUILD_ID := $(call ld-option, -- KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) +KBUILD_LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) diff --git a/queue-4.19/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-4.19/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch index 47aa9cb5cf1..536fb8f276c 100644 --- a/queue-4.19/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-4.19/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch @@ -41,9 +41,9 @@ Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/Makefile | 2 +- - arch/x86/boot/compressed/Makefile | 6 ++++++ + arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- - 3 files changed, 8 insertions(+), 2 deletions(-) + 3 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -58,15 +58,13 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile -@@ -57,6 +57,12 @@ else +@@ -57,6 +57,10 @@ else KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif + +KBUILD_LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + LDFLAGS_vmlinux := -T diff --git a/queue-4.9/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-4.9/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch index 398b6eb2fb3..a95109c3d5d 100644 --- a/queue-4.9/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-4.9/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch @@ -40,19 +40,17 @@ Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) + Makefile | 3 +++ + 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile -@@ -870,6 +870,11 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATI +@@ -870,6 +870,9 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATI LDFLAGS_vmlinux += $(call ld-option, --gc-sections,) endif +LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) diff --git a/queue-4.9/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-4.9/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch index f41cd82cf6f..811a66b049a 100644 --- a/queue-4.9/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-4.9/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch @@ -41,9 +41,9 @@ Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/Makefile | 2 +- - arch/x86/boot/compressed/Makefile | 6 ++++++ + arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- - 3 files changed, 8 insertions(+), 2 deletions(-) + 3 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -58,15 +58,13 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile -@@ -54,6 +54,12 @@ else +@@ -54,6 +54,10 @@ else LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif + +LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + LDFLAGS_vmlinux := -T diff --git a/queue-5.10/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-5.10/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch index 0ec29b55e96..bc1fb3be808 100644 --- a/queue-5.10/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-5.10/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch @@ -40,19 +40,17 @@ Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) + Makefile | 3 +++ + 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile -@@ -983,6 +983,11 @@ KBUILD_CFLAGS += $(KCFLAGS) +@@ -983,6 +983,9 @@ KBUILD_CFLAGS += $(KCFLAGS) KBUILD_LDFLAGS_MODULE += --build-id=sha1 LDFLAGS_vmlinux += --build-id=sha1 +KBUILD_LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) diff --git a/queue-5.10/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-5.10/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch index 67442190ed2..0ca022d6bc7 100644 --- a/queue-5.10/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-5.10/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch @@ -41,9 +41,9 @@ Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/Makefile | 2 +- - arch/x86/boot/compressed/Makefile | 4 ++++ + arch/x86/boot/compressed/Makefile | 2 ++ arch/x86/entry/vdso/Makefile | 2 +- - 3 files changed, 6 insertions(+), 2 deletions(-) + 3 files changed, 4 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -58,14 +58,12 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile -@@ -68,6 +68,10 @@ LDFLAGS_vmlinux := -pie $(call ld-option +@@ -68,6 +68,8 @@ LDFLAGS_vmlinux := -pie $(call ld-option ifdef CONFIG_LD_ORPHAN_WARN LDFLAGS_vmlinux += --orphan-handling=warn endif +LDFLAGS_vmlinux += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS_vmlinux += $(call ld-option,--no-warn-rwx-segments) -+endif LDFLAGS_vmlinux += -T hostprogs := mkpiggy diff --git a/queue-5.4/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-5.4/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch index 62874fc6aba..3f0d3efceda 100644 --- a/queue-5.4/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-5.4/makefile-link-with-z-noexecstack-no-warn-rwx-segments.patch @@ -40,19 +40,17 @@ Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) + Makefile | 3 +++ + 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile -@@ -932,6 +932,11 @@ KBUILD_CFLAGS += $(KCFLAGS) +@@ -932,6 +932,9 @@ KBUILD_CFLAGS += $(KCFLAGS) KBUILD_LDFLAGS_MODULE += --build-id LDFLAGS_vmlinux += --build-id +KBUILD_LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) diff --git a/queue-5.4/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch b/queue-5.4/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch index ea8e71118f8..cc84125c578 100644 --- a/queue-5.4/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch +++ b/queue-5.4/x86-link-vdso-and-boot-with-z-noexecstack-no-warn-rwx-segments.patch @@ -41,9 +41,9 @@ Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/Makefile | 2 +- - arch/x86/boot/compressed/Makefile | 6 ++++++ + arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- - 3 files changed, 8 insertions(+), 2 deletions(-) + 3 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -58,15 +58,13 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile -@@ -57,6 +57,12 @@ else +@@ -57,6 +57,10 @@ else KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif + +KBUILD_LDFLAGS += -z noexecstack -+ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) -+endif + LDFLAGS_vmlinux := -T -- 2.47.3