All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Enable orphan-handling=warn for VDSO
@ 2022-04-13 10:18 Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Joey Gouly @ 2022-04-13 10:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: nd, catalin.marinas, joey.gouly, keescook, masahiroy,
	vincenzo.frascino, will

Hi all,

This small series enables the orphan-handling linker flag for the VDSO.
This could catch subtle errors if features that use special sections are
introduced into the VDSO implementation.

Changes from v2 [1]:
  - Include vdso compat support

Thanks,
Joey

[1]: https://lore.kernel.org/linux-arm-kernel/20220407101304.539-1-joey.gouly@arm.com/

Joey Gouly (4):
  arm64: vdso: put ELF related sections in the linker script
  arm64: vdso: enable orphan handling for VDSO
  arm64: vdso32: put ELF related sections in the linker script
  arm64: vdso32: enable orphan handling for VDSO

 arch/arm64/kernel/vdso/Makefile     | 8 +++++++-
 arch/arm64/kernel/vdso/vdso.lds.S   | 4 ++++
 arch/arm64/kernel/vdso32/Makefile   | 1 +
 arch/arm64/kernel/vdso32/vdso.lds.S | 4 ++++
 4 files changed, 16 insertions(+), 1 deletion(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/4] arm64: vdso: put ELF related sections in the linker script
  2022-04-13 10:18 [PATCH v3 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
@ 2022-04-13 10:18 ` Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Joey Gouly @ 2022-04-13 10:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: nd, catalin.marinas, joey.gouly, keescook, masahiroy,
	vincenzo.frascino, will

Use macros from vmlinux.lds.h to explicitly name sections that are included
in the VDSO output.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Kees Cook <keescook@chromium.org>
---
 arch/arm64/kernel/vdso/vdso.lds.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index a5e61e09ea92..8a8780c6d093 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -11,6 +11,7 @@
 #include <linux/const.h>
 #include <asm/page.h>
 #include <asm/vdso.h>
+#include <asm-generic/vmlinux.lds.h>
 
 OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
 OUTPUT_ARCH(aarch64)
@@ -54,6 +55,9 @@ SECTIONS
 	_end = .;
 	PROVIDE(end = .);
 
+	DWARF_DEBUG
+	ELF_DETAILS
+
 	/DISCARD/	: {
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/4] arm64: vdso: enable orphan handling for VDSO
  2022-04-13 10:18 [PATCH v3 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-04-13 10:18 ` Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
  3 siblings, 0 replies; 5+ messages in thread
From: Joey Gouly @ 2022-04-13 10:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: nd, catalin.marinas, joey.gouly, keescook, masahiroy,
	vincenzo.frascino, will

Like vmlinux, enable orphan-handling for the VDSO. This can catch
subtle errors that might arise from unexpected sections being included.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Kees Cook <keescook@chromium.org>
---
 arch/arm64/kernel/vdso/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index 172452f79e46..623d9ad2c717 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -24,7 +24,13 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
 # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
 # preparation in build-time C")).
 ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv	\
-	     -Bsymbolic --build-id=sha1 -n $(btildflags-y) -T
+	     -Bsymbolic --build-id=sha1 -n $(btildflags-y)
+
+ifdef CONFIG_LD_ORPHAN_WARN
+  ldflags-y += --orphan-handling=warn
+endif
+
+ldflags-y += -T
 
 ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
 ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 3/4] arm64: vdso32: put ELF related sections in the linker script
  2022-04-13 10:18 [PATCH v3 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
@ 2022-04-13 10:18 ` Joey Gouly
  2022-04-13 10:18 ` [PATCH v3 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
  3 siblings, 0 replies; 5+ messages in thread
From: Joey Gouly @ 2022-04-13 10:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: nd, catalin.marinas, joey.gouly, keescook, masahiroy,
	vincenzo.frascino, will

Use macros from vmlinux.lds.h to explicitly name sections that are included
in the compat VDSO32 output.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Kees Cook <keescook@chromium.org>
---
 arch/arm64/kernel/vdso32/vdso.lds.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
index 3348ce5ea306..3bb955f08240 100644
--- a/arch/arm64/kernel/vdso32/vdso.lds.S
+++ b/arch/arm64/kernel/vdso32/vdso.lds.S
@@ -11,6 +11,7 @@
 #include <linux/const.h>
 #include <asm/page.h>
 #include <asm/vdso.h>
+#include <asm-generic/vmlinux.lds.h>
 
 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
 OUTPUT_ARCH(arm)
@@ -42,6 +43,9 @@ SECTIONS
 	.got		: { *(.got) }
 	.rel.plt	: { *(.rel.plt) }
 
+	ELF_DETAILS
+	.ARM.attributes 0 : { *(.ARM.attributes) }
+
 	/DISCARD/	: {
 		*(.note.GNU-stack)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 4/4] arm64: vdso32: enable orphan handling for VDSO
  2022-04-13 10:18 [PATCH v3 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
                   ` (2 preceding siblings ...)
  2022-04-13 10:18 ` [PATCH v3 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
@ 2022-04-13 10:18 ` Joey Gouly
  3 siblings, 0 replies; 5+ messages in thread
From: Joey Gouly @ 2022-04-13 10:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: nd, catalin.marinas, joey.gouly, keescook, masahiroy,
	vincenzo.frascino, will

Like vmlinux, enable orphan-handling for the compat VDSO32. This can catch
subtle errors that might arise from unexpected sections being included.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Kees Cook <keescook@chromium.org>
---
 arch/arm64/kernel/vdso32/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index ed181bedbffc..1bf0bfb99652 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -104,6 +104,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__
 VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
 VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
 VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1
+VDSO_LDFLAGS += --orphan-handling=warn
 
 
 # Borrow vdsomunge.c from the arm vDSO
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-13 10:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 10:18 [PATCH v3 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
2022-04-13 10:18 ` [PATCH v3 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
2022-04-13 10:18 ` [PATCH v3 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
2022-04-13 10:18 ` [PATCH v3 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
2022-04-13 10:18 ` [PATCH v3 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.