All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Enable orphan-handling=warn for VDSO
@ 2022-04-14 10:46 Joey Gouly
  2022-04-14 10:46 ` [PATCH v4 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Joey Gouly @ 2022-04-14 10:46 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.

Sorry for the extra version, I forgot to include Kees' and Vincenzo's 
reviewed-by tags. That's the only change to the patches.

Changes from v3 [1]:
  - Adding missing r-b tags

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

Thanks,
Joey

[1]: https://lore.kernel.org/linux-arm-kernel/20220413101832.4594-1-joey.gouly@arm.com/
[2]: 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] 14+ messages in thread

* [PATCH v4 1/4] arm64: vdso: put ELF related sections in the linker script
  2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
@ 2022-04-14 10:46 ` Joey Gouly
  2022-04-14 10:46 ` [PATCH v4 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Joey Gouly @ 2022-04-14 10:46 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>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 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] 14+ messages in thread

* [PATCH v4 2/4] arm64: vdso: enable orphan handling for VDSO
  2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-14 10:46 ` [PATCH v4 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-04-14 10:46 ` Joey Gouly
  2022-04-14 10:46 ` [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Joey Gouly @ 2022-04-14 10:46 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>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 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] 14+ messages in thread

* [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script
  2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
  2022-04-14 10:46 ` [PATCH v4 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
  2022-04-14 10:46 ` [PATCH v4 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
@ 2022-04-14 10:46 ` Joey Gouly
  2022-04-14 17:22   ` Kees Cook
  2022-04-19 11:00   ` Vincenzo Frascino
  2022-04-14 10:46 ` [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: Joey Gouly @ 2022-04-14 10:46 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] 14+ messages in thread

* [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO
  2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
                   ` (2 preceding siblings ...)
  2022-04-14 10:46 ` [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
@ 2022-04-14 10:46 ` Joey Gouly
  2022-04-14 17:22   ` Kees Cook
  2022-04-19 11:01   ` Vincenzo Frascino
  2022-04-19 11:10 ` [PATCH v4 0/4] Enable orphan-handling=warn " Vincenzo Frascino
  2022-04-27 18:20 ` Catalin Marinas
  5 siblings, 2 replies; 14+ messages in thread
From: Joey Gouly @ 2022-04-14 10:46 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] 14+ messages in thread

* Re: [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script
  2022-04-14 10:46 ` [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
@ 2022-04-14 17:22   ` Kees Cook
  2022-04-19 11:00   ` Vincenzo Frascino
  1 sibling, 0 replies; 14+ messages in thread
From: Kees Cook @ 2022-04-14 17:22 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, catalin.marinas, masahiroy,
	vincenzo.frascino, will

On Thu, Apr 14, 2022 at 11:46:10AM +0100, Joey Gouly wrote:
> 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>

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

* Re: [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO
  2022-04-14 10:46 ` [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
@ 2022-04-14 17:22   ` Kees Cook
  2022-04-19 11:01   ` Vincenzo Frascino
  1 sibling, 0 replies; 14+ messages in thread
From: Kees Cook @ 2022-04-14 17:22 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, catalin.marinas, masahiroy,
	vincenzo.frascino, will

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

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

* Re: [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script
  2022-04-14 10:46 ` [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
  2022-04-14 17:22   ` Kees Cook
@ 2022-04-19 11:00   ` Vincenzo Frascino
  1 sibling, 0 replies; 14+ messages in thread
From: Vincenzo Frascino @ 2022-04-19 11:00 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel
  Cc: nd, catalin.marinas, keescook, masahiroy, will



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

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>  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*)

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

* Re: [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO
  2022-04-14 10:46 ` [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
  2022-04-14 17:22   ` Kees Cook
@ 2022-04-19 11:01   ` Vincenzo Frascino
  1 sibling, 0 replies; 14+ messages in thread
From: Vincenzo Frascino @ 2022-04-19 11:01 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel
  Cc: nd, catalin.marinas, keescook, masahiroy, will



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

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>  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

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

* Re: [PATCH v4 0/4] Enable orphan-handling=warn for VDSO
  2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
                   ` (3 preceding siblings ...)
  2022-04-14 10:46 ` [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
@ 2022-04-19 11:10 ` Vincenzo Frascino
  2022-04-19 12:16   ` Joey Gouly
  2022-04-27 18:20 ` Catalin Marinas
  5 siblings, 1 reply; 14+ messages in thread
From: Vincenzo Frascino @ 2022-04-19 11:10 UTC (permalink / raw)
  To: Joey Gouly, linux-arm-kernel
  Cc: nd, catalin.marinas, keescook, masahiroy, will

Hi Joey,

On 4/14/22 11:46 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.
> 
> Sorry for the extra version, I forgot to include Kees' and Vincenzo's 
> reviewed-by tags. That's the only change to the patches.
> 

The patches look fine. Could you please provide some test results with [1] or [2]?

[1] https://github.com/nlynch-mentor/vdsotest
[2] <kernel_tree>/tools/testing/selftests/vDSO

> Changes from v3 [1]:
>   - Adding missing r-b tags
> 
> Changes from v2 [2]:
>   - Include vdso compat support
> 
> Thanks,
> Joey
> 
> [1]: https://lore.kernel.org/linux-arm-kernel/20220413101832.4594-1-joey.gouly@arm.com/
> [2]: 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(-)
> 

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

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

Hi,

On Tue, Apr 19, 2022 at 12:10:25PM +0100, Vincenzo Frascino wrote:
> Hi Joey,
> 
> On 4/14/22 11:46 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.
> > 
> > Sorry for the extra version, I forgot to include Kees' and Vincenzo's 
> > reviewed-by tags. That's the only change to the patches.
> > 
> 
> The patches look fine. Could you please provide some test results with [1] or [2]?
> 
> [1] https://github.com/nlynch-mentor/vdsotest
> [2] <kernel_tree>/tools/testing/selftests/vDSO

Testing with the selftests:

$ ./vdso_test_abi
TAP version 13
1..16
[vDSO kselftest] VDSO_VERSION: LINUX_2.6.39
# The time is 1650369341.228566
ok 1
vdso_test_gettimeofday(): PASS
#
clock_id: CLOCK_REALTIME
# The time is 1650369341.229413165
ok 2
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 1
# The syscall resolution is 0 1
ok 3
vdso_test_clock_getres(): PASS
#
clock_id: CLOCK_BOOTTIME
# The time is 1524.388896408
ok 4
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 1
# The syscall resolution is 0 1
ok 5
vdso_test_clock_getres(): PASS
#
clock_id: CLOCK_TAI
# The time is 1650369341.231390753
ok 6
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 1
# The syscall resolution is 0 1
ok 7
vdso_test_clock_getres(): PASS
#
clock_id: CLOCK_REALTIME_COARSE
# The time is 1650369341.227127861
ok 8
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 4000000
# The syscall resolution is 0 4000000
ok 9
vdso_test_clock_getres(): PASS
#
clock_id: CLOCK_MONOTONIC
# The time is 1524.391519475
ok 10
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 1
# The syscall resolution is 0 1
ok 11
vdso_test_clock_getres(): PASS
#
clock_id: CLOCK_MONOTONIC_RAW
# The time is 1524.697386720
ok 12
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 1
# The syscall resolution is 0 1
ok 13
vdso_test_clock_getres(): PASS
#
clock_id: CLOCK_MONOTONIC_COARSE
# The time is 1524.389473326
ok 14
vdso_test_clock_gettime(): PASS
# The vdso resolution is 0 4000000
# The syscall resolution is 0 4000000
ok 15
vdso_test_clock_getres(): PASS
ok 16 # SKIP
vdso_test_time(): SKIP: Could not find __kernel_time
# Totals: pass:15 fail:0 xfail:0 xpass:0 skip:1 error:0

$ ./vdso_test_correctness
Warning: failed to find getcpu in vDSO
[RUN]   Testing clock_gettime for clock CLOCK_REALTIME (0)...
        1650369433.949718175 1650369433.949982211 1650369433.950033907
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_MONOTONIC (1)...
        1617.109425232 1617.109431840 1617.109434048
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_PROCESS_CPUTIME_ID (2)...
        0.039832960 0.039874448 0.039886448
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_THREAD_CPUTIME_ID (3)...
        0.040566320 0.040574576 0.040579552
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_MONOTONIC_RAW (4)...
        1617.415046976 1617.415057616 1617.415059712
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_REALTIME_COARSE (5)...
        1650369433.948175756 1650369433.948175756 1650369433.948175756
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_MONOTONIC_COARSE (6)...
        1617.110521230 1617.110521230 1617.110521230
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_BOOTTIME (7)...
        1617.113039789 1617.113044493 1617.113046269
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_REALTIME_ALARM (8)...
        1650369433.955192243 1650369433.955196547 1650369433.955199811
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_BOOTTIME_ALARM (9)...
        1617.114074714 1617.114079690 1617.114083210
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock CLOCK_SGI_CYCLE (10)...
[OK]    No such clock.
[RUN]   Testing clock_gettime for clock CLOCK_TAI (11)...
        1650369433.956495555 1650369433.956498307 1650369433.956500003
[OK]    Test Passed.
[RUN]   Testing clock_gettime for clock invalid (-1)...
[OK]    No such clock.
[RUN]   Testing clock_gettime for clock invalid (-2147483648)...
[OK]    No such clock.
[RUN]   Testing clock_gettime for clock invalid (2147483647)...
[OK]    No such clock.
[SKIP]  No vDSO, so skipping clock_gettime64() tests
[RUN]   Testing gettimeofday...
        1650369433.958323 1650369433.958397 1650369433.958470
[OK]    timezones match: minuteswest=0, dsttime=0
[RUN]   Testing getcpu...
[OK]    CPU 0: syscall: cpu 0, node 0

$ ./vdso_test_gettimeofday
The time is 1650369462.312523

$ ./vdso_test_clock_getres
clock_id: CLOCK_REALTIME [PASS]
clock_id: CLOCK_BOOTTIME [PASS]
clock_id: CLOCK_TAI [PASS]
clock_id: CLOCK_REALTIME_COARSE [PASS]
clock_id: CLOCK_MONOTONIC [PASS]
clock_id: CLOCK_MONOTONIC_RAW [PASS]
clock_id: CLOCK_MONOTONIC_COARSE [PASS]

$ ./vdso_test_getcpu
Could not find __vdso_getcpu


So there was 2 potential issues:
- vdso_test_time(): SKIP: Could not find __kernel_time
- Could not find __vdso_getcpu

I'm not sure what these are, maybe they don't work on arm64 or it's a kernel config issue.

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

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

Hi Joey,

thank you for taking care of the tests.

On 4/19/22 1:16 PM, Joey Gouly wrote:
> So there was 2 potential issues:
> - vdso_test_time(): SKIP: Could not find __kernel_time

time() is deprecated hence not supported for aarch64 (see VDSO_HAS_TIME).

> - Could not find __vdso_getcpu

We do not have getcpu() support in the vDSO library on aarch64.

For these reasons the tests are skipped.

Hope this clarifies.

> 
> I'm not sure what these are, maybe they don't work on arm64 or it's a kernel config issue.
> 
> Thanks,
> Joey

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

* Re: [PATCH v4 0/4] Enable orphan-handling=warn for VDSO
  2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
                   ` (4 preceding siblings ...)
  2022-04-19 11:10 ` [PATCH v4 0/4] Enable orphan-handling=warn " Vincenzo Frascino
@ 2022-04-27 18:20 ` Catalin Marinas
  2022-04-28 16:11   ` Joey Gouly
  5 siblings, 1 reply; 14+ messages in thread
From: Catalin Marinas @ 2022-04-27 18:20 UTC (permalink / raw)
  To: Joey Gouly
  Cc: linux-arm-kernel, nd, keescook, masahiroy, vincenzo.frascino, will

Hi Joey,

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

Building the 5.18-rc3 kernel with these patches, I get lots of:

aarch64-linux-ld: warning: orphan section `.rela.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.rela.dyn'
aarch64-linux-ld: warning: orphan section `.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.got'
aarch64-linux-ld: warning: orphan section `.got.plt' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.got.plt'
aarch64-linux-ld: warning: orphan section `.plt' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.plt'
aarch64-linux-ld: warning: orphan section `.rela.plt' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.rela.dyn'
arm-linux-gnueabihf-ld: warning: orphan section `.glue_7' from `linker stubs' being placed in section `.glue_7'
arm-linux-gnueabihf-ld: warning: orphan section `.glue_7t' from `linker stubs' being placed in section `.glue_7t'
arm-linux-gnueabihf-ld: warning: orphan section `.vfp11_veneer' from `linker stubs' being placed in section `.vfp11_veneer'
arm-linux-gnueabihf-ld: warning: orphan section `.v4_bx' from `linker stubs' being placed in section `.v4_bx'
arm-linux-gnueabihf-ld: warning: orphan section `.rel.got' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn'
arm-linux-gnueabihf-ld: warning: orphan section `.got.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.got.plt'
arm-linux-gnueabihf-ld: warning: orphan section `.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.plt'
arm-linux-gnueabihf-ld: warning: orphan section `.iplt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.iplt'
arm-linux-gnueabihf-ld: warning: orphan section `.rel.iplt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn'
arm-linux-gnueabihf-ld: warning: orphan section `.igot.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.igot.plt'
arm-linux-gnueabihf-ld: warning: orphan section `.rel.text' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn'

Do they need fixing or there's something wrong with my toolchain?

-- 
Catalin

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

* Re: [PATCH v4 0/4] Enable orphan-handling=warn for VDSO
  2022-04-27 18:20 ` Catalin Marinas
@ 2022-04-28 16:11   ` Joey Gouly
  0 siblings, 0 replies; 14+ messages in thread
From: Joey Gouly @ 2022-04-28 16:11 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: linux-arm-kernel, nd, keescook, masahiroy, vincenzo.frascino, will

Hi Catalin,

On Wed, Apr 27, 2022 at 07:20:34PM +0100, Catalin Marinas wrote:
> Hi Joey,
> 
> On Thu, Apr 14, 2022 at 11:46:07AM +0100, Joey Gouly wrote:
> > 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.
> 
> Building the 5.18-rc3 kernel with these patches, I get lots of:
> 
> aarch64-linux-ld: warning: orphan section `.rela.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.rela.dyn'
> aarch64-linux-ld: warning: orphan section `.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.got'
[..]
> arm-linux-gnueabihf-ld: warning: orphan section `.rel.iplt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn'
> arm-linux-gnueabihf-ld: warning: orphan section `.igot.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.igot.plt'
> arm-linux-gnueabihf-ld: warning: orphan section `.rel.text' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn'
> 
> Do they need fixing or there's something wrong with my toolchain?
> 

I can reproduce this with binutils ld, I was previously testing with LLD.
Seems to me that LLD discards more sections than ld.

I will fix it and send out v5.

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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 10:46 [PATCH v4 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
2022-04-14 10:46 ` [PATCH v4 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
2022-04-14 10:46 ` [PATCH v4 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
2022-04-14 10:46 ` [PATCH v4 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
2022-04-14 17:22   ` Kees Cook
2022-04-19 11:00   ` Vincenzo Frascino
2022-04-14 10:46 ` [PATCH v4 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
2022-04-14 17:22   ` Kees Cook
2022-04-19 11:01   ` Vincenzo Frascino
2022-04-19 11:10 ` [PATCH v4 0/4] Enable orphan-handling=warn " Vincenzo Frascino
2022-04-19 12:16   ` Joey Gouly
2022-04-19 12:53     ` Vincenzo Frascino
2022-04-27 18:20 ` Catalin Marinas
2022-04-28 16:11   ` 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.