* [PATCH v5 1/4] arm64: vdso: put ELF related sections in the linker script
2022-05-10 9:58 [PATCH v5 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
@ 2022-05-10 9:58 ` Joey Gouly
2022-05-10 10:39 ` Vincenzo Frascino
2022-05-10 9:58 ` [PATCH v5 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Joey Gouly @ 2022-05-10 9:58 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 | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index a5e61e09ea92..1cd85258c079 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)
@@ -49,11 +50,26 @@ SECTIONS
.dynamic : { *(.dynamic) } :text :dynamic
+ .rela.dyn : ALIGN(8) { *(.rela .rela*) }
+
+ .plt : {
+ *(.plt)
+ *(.plt.*)
+ *(.iplt)
+ *(.igot .igot.plt)
+ }
+
+ .got : { *(.got) }
+ .got.plt : { *(.got.plt) }
+
.rodata : { *(.rodata*) } :text
_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
* Re: [PATCH v5 1/4] arm64: vdso: put ELF related sections in the linker script
2022-05-10 9:58 ` [PATCH v5 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-05-10 10:39 ` Vincenzo Frascino
0 siblings, 0 replies; 10+ messages in thread
From: Vincenzo Frascino @ 2022-05-10 10:39 UTC (permalink / raw)
To: Joey Gouly, linux-arm-kernel
Cc: nd, catalin.marinas, keescook, masahiroy, will
Hi Joey,
On 5/10/22 10:58, 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>
> 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>
As a general rule, when you make a consistent change to a patch that was
previously reviewed you should drop the "Reviewed-by:" tag as an indication that
the patch needs to be reviewed again.
> ---
> arch/arm64/kernel/vdso/vdso.lds.S | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
> index a5e61e09ea92..1cd85258c079 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)
> @@ -49,11 +50,26 @@ SECTIONS
>
> .dynamic : { *(.dynamic) } :text :dynamic
>
> + .rela.dyn : ALIGN(8) { *(.rela .rela*) }
> +
> + .plt : {
> + *(.plt)
> + *(.plt.*)
> + *(.iplt)
> + *(.igot .igot.plt)
> + }
> +
> + .got : { *(.got) }
> + .got.plt : { *(.got.plt) }
> +
The vDSO library does not contain absolute relocations. Is there any specific
reason why these sections are not part of ".rodata"?
Please refer to: lib/vdso/Makefile
Note: A similar comment applies to vdso32.
> .rodata : { *(.rodata*) } :text
>
> _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
* [PATCH v5 2/4] arm64: vdso: enable orphan handling for VDSO
2022-05-10 9:58 [PATCH v5 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
2022-05-10 9:58 ` [PATCH v5 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
@ 2022-05-10 9:58 ` Joey Gouly
2022-05-10 9:58 ` [PATCH v5 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Joey Gouly @ 2022-05-10 9:58 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] 10+ messages in thread
* [PATCH v5 3/4] arm64: vdso32: put ELF related sections in the linker script
2022-05-10 9:58 [PATCH v5 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
2022-05-10 9:58 ` [PATCH v5 1/4] arm64: vdso: put ELF related sections in the linker script Joey Gouly
2022-05-10 9:58 ` [PATCH v5 2/4] arm64: vdso: enable orphan handling for VDSO Joey Gouly
@ 2022-05-10 9:58 ` Joey Gouly
2022-05-10 9:58 ` [PATCH v5 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Joey Gouly @ 2022-05-10 9:58 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>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
arch/arm64/kernel/vdso32/vdso.lds.S | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
index 3348ce5ea306..120cf422036f 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)
@@ -37,10 +38,29 @@ SECTIONS
.rodata : { *(.rodata*) } :text
- .text : { *(.text*) } :text =0xe7f001f2
+ .text : {
+ *(.text*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.vfp11_veneer)
+ *(.v4_bx)
+ } :text =0xe7f001f2
+
+ .rel.dyn : { *(.rel.text) }
.got : { *(.got) }
+ .rel.got : { *(.rel.got) }
+ .got.plt : { *(.got.plt) }
.rel.plt : { *(.rel.plt) }
+ .plt : {
+ *(.plt)
+ *(.rel.iplt)
+ *(.iplt)
+ *(.igot.plt)
+ }
+
+ ELF_DETAILS
+ .ARM.attributes 0 : { *(.ARM.attributes) }
/DISCARD/ : {
*(.note.GNU-stack)
--
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 v5 4/4] arm64: vdso32: enable orphan handling for VDSO
2022-05-10 9:58 [PATCH v5 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
` (2 preceding siblings ...)
2022-05-10 9:58 ` [PATCH v5 3/4] arm64: vdso32: put ELF related sections in the linker script Joey Gouly
@ 2022-05-10 9:58 ` Joey Gouly
2022-06-23 17:53 ` [PATCH v5 0/4] Enable orphan-handling=warn " Will Deacon
2022-06-23 19:31 ` Will Deacon
5 siblings, 0 replies; 10+ messages in thread
From: Joey Gouly @ 2022-05-10 9:58 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>
Reviewed-by: 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
--
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 v5 0/4] Enable orphan-handling=warn for VDSO
2022-05-10 9:58 [PATCH v5 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
` (3 preceding siblings ...)
2022-05-10 9:58 ` [PATCH v5 4/4] arm64: vdso32: enable orphan handling for VDSO Joey Gouly
@ 2022-06-23 17:53 ` Will Deacon
2022-06-23 18:05 ` Joey Gouly
2022-06-23 19:31 ` Will Deacon
5 siblings, 1 reply; 10+ messages in thread
From: Will Deacon @ 2022-06-23 17:53 UTC (permalink / raw)
To: Joey Gouly
Cc: linux-arm-kernel, nd, catalin.marinas, keescook, masahiroy,
vincenzo.frascino
Hi Joey,
On Tue, May 10, 2022 at 10:58:30AM +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.
>
> Tested by running the VDSO self tests.
> Tested building with LLVM LLD and Binutils LD linkers.
I've applied this locally, but I'm seeing a warning from LLD when linking
the 32-bit vDSO object:
| LD32 arch/arm64/kernel/vdso32/vdso.so.raw
| ld.lld: warning: <internal>:(.ARM.exidx) is being placed in '.ARM.exidx'
Please can you take a look and send an additional patch on top to fix this?
Thanks,
Will
_______________________________________________
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 v5 0/4] Enable orphan-handling=warn for VDSO
2022-06-23 17:53 ` [PATCH v5 0/4] Enable orphan-handling=warn " Will Deacon
@ 2022-06-23 18:05 ` Joey Gouly
2022-06-23 19:34 ` Will Deacon
0 siblings, 1 reply; 10+ messages in thread
From: Joey Gouly @ 2022-06-23 18:05 UTC (permalink / raw)
To: Will Deacon
Cc: linux-arm-kernel, nd, catalin.marinas, keescook, masahiroy,
vincenzo.frascino
Hi Will,
On Thu, Jun 23, 2022 at 06:53:53PM +0100, Will Deacon wrote:
> Hi Joey,
>
> On Tue, May 10, 2022 at 10:58:30AM +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.
> >
> > Tested by running the VDSO self tests.
> > Tested building with LLVM LLD and Binutils LD linkers.
>
> I've applied this locally, but I'm seeing a warning from LLD when linking
> the 32-bit vDSO object:
>
> | LD32 arch/arm64/kernel/vdso32/vdso.so.raw
> | ld.lld: warning: <internal>:(.ARM.exidx) is being placed in '.ARM.exidx'
>
> Please can you take a look and send an additional patch on top to fix this?
I have been meaning to send out a v6, I will try get it out tomorrow or next week.
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 v5 0/4] Enable orphan-handling=warn for VDSO
2022-06-23 18:05 ` Joey Gouly
@ 2022-06-23 19:34 ` Will Deacon
0 siblings, 0 replies; 10+ messages in thread
From: Will Deacon @ 2022-06-23 19:34 UTC (permalink / raw)
To: Joey Gouly
Cc: linux-arm-kernel, nd, catalin.marinas, keescook, masahiroy,
vincenzo.frascino
On Thu, Jun 23, 2022 at 07:05:03PM +0100, Joey Gouly wrote:
> Hi Will,
>
> On Thu, Jun 23, 2022 at 06:53:53PM +0100, Will Deacon wrote:
> > Hi Joey,
> >
> > On Tue, May 10, 2022 at 10:58:30AM +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.
> > >
> > > Tested by running the VDSO self tests.
> > > Tested building with LLVM LLD and Binutils LD linkers.
> >
> > I've applied this locally, but I'm seeing a warning from LLD when linking
> > the 32-bit vDSO object:
> >
> > | LD32 arch/arm64/kernel/vdso32/vdso.so.raw
> > | ld.lld: warning: <internal>:(.ARM.exidx) is being placed in '.ARM.exidx'
> >
> > Please can you take a look and send an additional patch on top to fix this?
>
> I have been meaning to send out a v6, I will try get it out tomorrow or next week.
I already queued v5, so please just send stuff on top of that.
Will
_______________________________________________
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 v5 0/4] Enable orphan-handling=warn for VDSO
2022-05-10 9:58 [PATCH v5 0/4] Enable orphan-handling=warn for VDSO Joey Gouly
` (4 preceding siblings ...)
2022-06-23 17:53 ` [PATCH v5 0/4] Enable orphan-handling=warn " Will Deacon
@ 2022-06-23 19:31 ` Will Deacon
5 siblings, 0 replies; 10+ messages in thread
From: Will Deacon @ 2022-06-23 19:31 UTC (permalink / raw)
To: Joey Gouly, linux-arm-kernel
Cc: catalin.marinas, kernel-team, Will Deacon, masahiroy, keescook,
vincenzo.frascino, nd
On Tue, 10 May 2022 10:58:30 +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.
>
> Tested by running the VDSO self tests.
> Tested building with LLVM LLD and Binutils LD linkers.
>
> [...]
Applied to arm64 (for-next/vdso), thanks!
[1/4] arm64: vdso: put ELF related sections in the linker script
https://git.kernel.org/arm64/c/b87d34ca60ce
[2/4] arm64: vdso: enable orphan handling for VDSO
https://git.kernel.org/arm64/c/e0ab20b20a1b
[3/4] arm64: vdso32: put ELF related sections in the linker script
https://git.kernel.org/arm64/c/eeec7223b697
[4/4] arm64: vdso32: enable orphan handling for VDSO
https://git.kernel.org/arm64/c/9d4775b332e1
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
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