All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Enable orphan-handling=warn for VDSO
@ 2022-04-05 16:02 Joey Gouly
  2022-04-05 16:02 ` [PATCH v1 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
  2022-04-05 16:02 ` [PATCH v1 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
  0 siblings, 2 replies; 4+ messages in thread
From: Joey Gouly @ 2022-04-05 16:02 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.

Thanks,
Joey

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

 arch/arm64/kernel/vdso/Makefile   | 8 +++++++-
 arch/arm64/kernel/vdso/vdso.lds.S | 5 +++++
 2 files changed, 12 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] 4+ messages in thread

* [PATCH v1 1/2] arm64: vdso: put ELF related sections in the linker script
  2022-04-05 16:02 [PATCH v1 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
@ 2022-04-05 16:02 ` Joey Gouly
  2022-04-05 17:41   ` Kees Cook
  2022-04-05 16:02 ` [PATCH v1 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
  1 sibling, 1 reply; 4+ messages in thread
From: Joey Gouly @ 2022-04-05 16:02 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: nd, catalin.marinas, joey.gouly, keescook, masahiroy,
	vincenzo.frascino, will

These are the same sections as ELF_DETAILS in include/asm-generic/vmlinux.lds.h

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index a5e61e09ea92..e453e74e98f9 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -54,6 +54,11 @@ SECTIONS
 	_end = .;
 	PROVIDE(end = .);
 
+	.comment 0 : { *(.comment) }
+	.symtab 0 : { *(.symtab) }
+	.strtab 0 : { *(.strtab) }
+	.shstrtab 0 : { *(.shstrtab) }
+
 	/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] 4+ messages in thread

* [PATCH v1 2/2] arm64: vdso: enable orphan handling for VDSO
  2022-04-05 16:02 [PATCH v1 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-05 16:02 ` [PATCH v1 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-04-05 16:02 ` Joey Gouly
  1 sibling, 0 replies; 4+ messages in thread
From: Joey Gouly @ 2022-04-05 16:02 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] 4+ messages in thread

* Re: [PATCH v1 1/2] arm64: vdso: put ELF related sections in the linker script
  2022-04-05 16:02 ` [PATCH v1 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-04-05 17:41   ` Kees Cook
  0 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2022-04-05 17:41 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, catalin.marinas, masahiroy,
	vincenzo.frascino, will

On Tue, Apr 05, 2022 at 05:02:45PM +0100, Joey Gouly wrote:
> These are the same sections as ELF_DETAILS in include/asm-generic/vmlinux.lds.h

Can include/asm-generic/vmlinux.lds.h be included to just use
ELF_DETAILS directly?

Outside of that, yeah, this series looks good. Thanks!

-Kees

> 
> 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 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
> index a5e61e09ea92..e453e74e98f9 100644
> --- a/arch/arm64/kernel/vdso/vdso.lds.S
> +++ b/arch/arm64/kernel/vdso/vdso.lds.S
> @@ -54,6 +54,11 @@ SECTIONS
>  	_end = .;
>  	PROVIDE(end = .);
>  
> +	.comment 0 : { *(.comment) }
> +	.symtab 0 : { *(.symtab) }
> +	.strtab 0 : { *(.strtab) }
> +	.shstrtab 0 : { *(.shstrtab) }
> +
>  	/DISCARD/	: {
>  		*(.data .data.* .gnu.linkonce.d.* .sdata*)
>  		*(.bss .sbss .dynbss .dynsbss)
> -- 
> 2.17.1
> 

-- 
Kees Cook

_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2022-04-05 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-05 16:02 [PATCH v1 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
2022-04-05 16:02 ` [PATCH v1 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
2022-04-05 17:41   ` Kees Cook
2022-04-05 16:02 ` [PATCH v1 2/2] arm64: vdso: 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.