All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Enable orphan-handling=warn for VDSO
@ 2022-04-07 10:13 Joey Gouly
  2022-04-07 10:13 ` [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Joey Gouly @ 2022-04-07 10:13 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 v1[1]:
  - Include vmlinux.ld.h directly, to use macros
  - Include DWARF sections in linker script

Thanks,
Joey

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

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 | 4 ++++
 2 files changed, 11 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] 10+ messages in thread

* [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script
  2022-04-07 10:13 [PATCH v2 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
@ 2022-04-07 10:13 ` Joey Gouly
  2022-04-07 16:49   ` Kees Cook
  2022-04-08  7:18   ` Vincenzo Frascino
  2022-04-07 10:13 ` [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
  2022-04-08  7:22 ` [PATCH v2 0/2] Enable orphan-handling=warn " Vincenzo Frascino
  2 siblings, 2 replies; 10+ messages in thread
From: Joey Gouly @ 2022-04-07 10:13 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] 10+ messages in thread

* [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO
  2022-04-07 10:13 [PATCH v2 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-07 10:13 ` [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-04-07 10:13 ` Joey Gouly
  2022-04-07 16:49   ` Kees Cook
  2022-04-08  7:20   ` Vincenzo Frascino
  2022-04-08  7:22 ` [PATCH v2 0/2] Enable orphan-handling=warn " Vincenzo Frascino
  2 siblings, 2 replies; 10+ messages in thread
From: Joey Gouly @ 2022-04-07 10:13 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] 10+ messages in thread

* Re: [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO
  2022-04-07 10:13 ` [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
@ 2022-04-07 16:49   ` Kees Cook
  2022-04-08  7:20   ` Vincenzo Frascino
  1 sibling, 0 replies; 10+ messages in thread
From: Kees Cook @ 2022-04-07 16:49 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, catalin.marinas, masahiroy,
	vincenzo.frascino, will

On Thu, Apr 07, 2022 at 11:13:04AM +0100, Joey Gouly wrote:
> 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>

Reviewed-by: Kees Cook <keescook@chromium.org>

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

* Re: [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script
  2022-04-07 10:13 ` [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-04-07 16:49   ` Kees Cook
  2022-04-08  7:18   ` Vincenzo Frascino
  1 sibling, 0 replies; 10+ messages in thread
From: Kees Cook @ 2022-04-07 16:49 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, catalin.marinas, masahiroy,
	vincenzo.frascino, will

On Thu, Apr 07, 2022 at 11:13:03AM +0100, Joey Gouly wrote:
> 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>

Looks good! Thanks for updating it. :)

Reviewed-by: Kees Cook <keescook@chromium.org>

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

* Re: [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script
  2022-04-07 10:13 ` [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
  2022-04-07 16:49   ` Kees Cook
@ 2022-04-08  7:18   ` Vincenzo Frascino
  1 sibling, 0 replies; 10+ messages in thread
From: Vincenzo Frascino @ 2022-04-08  7:18 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel
  Cc: nd, catalin.marinas, keescook, masahiroy, will



On 4/7/22 11:13 AM, Joey Gouly wrote:
> 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>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@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)

-- 
Regards,
Vincenzo

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

* Re: [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO
  2022-04-07 10:13 ` [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
  2022-04-07 16:49   ` Kees Cook
@ 2022-04-08  7:20   ` Vincenzo Frascino
  1 sibling, 0 replies; 10+ messages in thread
From: Vincenzo Frascino @ 2022-04-08  7:20 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel
  Cc: nd, catalin.marinas, keescook, masahiroy, will



On 4/7/22 11:13 AM, Joey Gouly wrote:
> 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>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@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

-- 
Regards,
Vincenzo

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

* Re: [PATCH v2 0/2] Enable orphan-handling=warn for VDSO
  2022-04-07 10:13 [PATCH v2 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-07 10:13 ` [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
  2022-04-07 10:13 ` [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
@ 2022-04-08  7:22 ` Vincenzo Frascino
  2022-04-12 10:04   ` Joey Gouly
  2 siblings, 1 reply; 10+ messages in thread
From: Vincenzo Frascino @ 2022-04-08  7:22 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel
  Cc: nd, catalin.marinas, keescook, masahiroy, will

Hi Joey,

On 4/7/22 11:13 AM, Joey Gouly wrote:
> 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 v1[1]:
>   - Include vmlinux.ld.h directly, to use macros
>   - Include DWARF sections in linker script
> 

The change looks fine to me. I have only one question, is there any specific
reason why we do have the same for compat vDSO?

> Thanks,
> Joey
> 
> [1]: https://lore.kernel.org/linux-arm-kernel/20220405160246.1991-1-joey.gouly@arm.com/
> 
> 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 | 4 ++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 

-- 
Regards,
Vincenzo

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

* Re: [PATCH v2 0/2] Enable orphan-handling=warn for VDSO
  2022-04-08  7:22 ` [PATCH v2 0/2] Enable orphan-handling=warn " Vincenzo Frascino
@ 2022-04-12 10:04   ` Joey Gouly
  2022-04-12 10:05     ` Vincenzo Frascino
  0 siblings, 1 reply; 10+ messages in thread
From: Joey Gouly @ 2022-04-12 10:04 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arm-kernel, nd, catalin.marinas, keescook, masahiroy, will

Hi Vincenzo,

Thanks for the reviews (and Kees too)!

Having issues with e-mail, hopefully this gets through!

On Fri, Apr 08, 2022 at 08:22:49AM +0100, Vincenzo Frascino wrote:
> Hi Joey,
> 
> On 4/7/22 11:13 AM, Joey Gouly wrote:
> > 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 v1[1]:
> >   - Include vmlinux.ld.h directly, to use macros
> >   - Include DWARF sections in linker script
> > 
> 
> The change looks fine to me. I have only one question, is there any specific
> reason why we do have the same for compat vDSO?

No reason, just that I only test arm64. I will build and test 32-bit and send out
a v3.

Thanks,
Joey

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

* Re: [PATCH v2 0/2] Enable orphan-handling=warn for VDSO
  2022-04-12 10:04   ` Joey Gouly
@ 2022-04-12 10:05     ` Vincenzo Frascino
  0 siblings, 0 replies; 10+ messages in thread
From: Vincenzo Frascino @ 2022-04-12 10:05 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, catalin.marinas, keescook, masahiroy, will



On 4/12/22 11:04 AM, Joey Gouly wrote:
> No reason, just that I only test arm64. I will build and test 32-bit and send out
> a v3.

Thank you :)

-- 
Regards,
Vincenzo

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 10:13 [PATCH v2 0/2] Enable orphan-handling=warn for VDSO Joey Gouly
2022-04-07 10:13 ` [PATCH v2 1/2] arm64: vdso: put ELF related sections in the linker script Joey Gouly
2022-04-07 16:49   ` Kees Cook
2022-04-08  7:18   ` Vincenzo Frascino
2022-04-07 10:13 ` [PATCH v2 2/2] arm64: vdso: enable orphan handling for VDSO Joey Gouly
2022-04-07 16:49   ` Kees Cook
2022-04-08  7:20   ` Vincenzo Frascino
2022-04-08  7:22 ` [PATCH v2 0/2] Enable orphan-handling=warn " Vincenzo Frascino
2022-04-12 10:04   ` Joey Gouly
2022-04-12 10:05     ` Vincenzo Frascino

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.