All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR
@ 2026-07-06 15:19 Jens Remus
  2026-07-06 15:19 ` [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
  2026-07-06 15:19 ` [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus
  0 siblings, 2 replies; 7+ messages in thread
From: Jens Remus @ 2026-07-06 15:19 UTC (permalink / raw)
  To: linux-s390, linux-kernel
  Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Sven Schnelle, Ilya Leoshkevich

Patch 1 fixes the empty GNU_EH_FRAME program table header entry to
enable unwinders and stacktracers to locate the .eh_frame_hdr section.

Patch 2 uses symbolic constants for the PHDR permission flags to improve
readability and explicitly specifies the GNU_EH_FRAME PHDR to be read-
only.

Regards,
Jens


Jens Remus (2):
  s390/vdso: Pass --eh-frame-hdr to the linker
  s390/vdso: Use symbolic constants for the PHDR permission flags

 arch/s390/kernel/vdso/Makefile   |  3 ++-
 arch/s390/kernel/vdso/vdso.lds.S | 12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)


base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
-- 
2.53.0


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

* [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker
  2026-07-06 15:19 [PATCH 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR Jens Remus
@ 2026-07-06 15:19 ` Jens Remus
  2026-07-06 15:22   ` Jens Remus
  2026-07-06 17:26   ` Ilya Leoshkevich
  2026-07-06 15:19 ` [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus
  1 sibling, 2 replies; 7+ messages in thread
From: Jens Remus @ 2026-07-06 15:19 UTC (permalink / raw)
  To: linux-s390, linux-kernel
  Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Sven Schnelle, Ilya Leoshkevich

Commit 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link
vDSO") accidentally broke the GNU_PTR_EH_FRAME program table entry in
the vDSO, causing it to be empty:

  $ readelf --program-headers arch/s390/kernel/vdso/vdso.so
  ...
  Program Headers:
    Type           Offset             VirtAddr           PhysAddr
                   FileSiz            MemSiz              Flags  Align
  ...
    GNU_EH_FRAME   0x0000000000000000 0x0000000000000000 0x0000000000000000
                   0x0000000000000000 0x0000000000000000         0x8
  ...

Originally, the compiler would implicitly add --eh-frame-hdr when
invoking the linker, but when this Makefile was converted from invoking
the linker via the compiler, to invoking it directly, the option was
missed.

This is the s390 variant of x86 commit cd01544a268a ("x86/vdso: Pass
--eh-frame-hdr to the linker").

Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 arch/s390/kernel/vdso/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kernel/vdso/Makefile b/arch/s390/kernel/vdso/Makefile
index fece5d975eaf..35c834b895ec 100644
--- a/arch/s390/kernel/vdso/Makefile
+++ b/arch/s390/kernel/vdso/Makefile
@@ -30,7 +30,8 @@ KBUILD_CFLAGS_VDSO := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLA
 KBUILD_CFLAGS_VDSO += -fPIC -fno-common -fno-builtin -fasynchronous-unwind-tables
 KBUILD_CFLAGS_VDSO += -fno-stack-protector $(DISABLE_KSTACK_ERASE)
 ldflags-y := -shared -soname=linux-vdso.so.1 \
-	     --hash-style=both --build-id=sha1 -T
+	     --hash-style=both --build-id=sha1 \
+	     $(call ld-option, --eh-frame-hdr) -T
 
 $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_VDSO)
 $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_VDSO)
-- 
2.53.0


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

* [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags
  2026-07-06 15:19 [PATCH 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR Jens Remus
  2026-07-06 15:19 ` [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
@ 2026-07-06 15:19 ` Jens Remus
  2026-07-06 17:06   ` Ilya Leoshkevich
  1 sibling, 1 reply; 7+ messages in thread
From: Jens Remus @ 2026-07-06 15:19 UTC (permalink / raw)
  To: linux-s390, linux-kernel
  Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Sven Schnelle, Ilya Leoshkevich

While at it explicitly specify GNU_EH_FRAME PHDR to be read-only.

Inspired by x86 commit 8717b02b8c03 ("x86/entry/vdso: Include
GNU_PROPERTY and GNU_STACK PHDRs").

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 arch/s390/kernel/vdso/vdso.lds.S | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/s390/kernel/vdso/vdso.lds.S b/arch/s390/kernel/vdso/vdso.lds.S
index 7bec4de0e8e0..35ea7ede06c0 100644
--- a/arch/s390/kernel/vdso/vdso.lds.S
+++ b/arch/s390/kernel/vdso/vdso.lds.S
@@ -82,12 +82,16 @@ SECTIONS
  * We must supply the ELF program headers explicitly to get just one
  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
  */
+#define PF_R	FLAGS(4)
+#define PF_RW	FLAGS(6)
+#define PF_RX	FLAGS(5)
+
 PHDRS
 {
-	text		PT_LOAD FILEHDR PHDRS FLAGS(5);	/* PF_R|PF_X */
-	dynamic		PT_DYNAMIC FLAGS(4);		/* PF_R */
-	note		PT_NOTE FLAGS(4);		/* PF_R */
-	eh_frame_hdr	PT_GNU_EH_FRAME;
+	text		PT_LOAD		PF_RX FILEHDR PHDRS;
+	dynamic		PT_DYNAMIC	PF_R;
+	note		PT_NOTE		PF_R;
+	eh_frame_hdr	PT_GNU_EH_FRAME	PF_R;
 }
 
 /*
-- 
2.53.0


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

* Re: [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker
  2026-07-06 15:19 ` [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
@ 2026-07-06 15:22   ` Jens Remus
  2026-07-06 17:26   ` Ilya Leoshkevich
  1 sibling, 0 replies; 7+ messages in thread
From: Jens Remus @ 2026-07-06 15:22 UTC (permalink / raw)
  To: linux-s390, linux-kernel
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
	Ilya Leoshkevich

On 7/6/2026 5:19 PM, Jens Remus wrote:
> Commit 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link
> vDSO") accidentally broke the GNU_PTR_EH_FRAME program table entry in

s/GNU_PTR_EH_FRAME/GNU_EH_FRAME/ 

> the vDSO, causing it to be empty:
> 
>   $ readelf --program-headers arch/s390/kernel/vdso/vdso.so
>   ...
>   Program Headers:
>     Type           Offset             VirtAddr           PhysAddr
>                    FileSiz            MemSiz              Flags  Align
>   ...
>     GNU_EH_FRAME   0x0000000000000000 0x0000000000000000 0x0000000000000000
>                    0x0000000000000000 0x0000000000000000         0x8
>   ...
> 
> Originally, the compiler would implicitly add --eh-frame-hdr when
> invoking the linker, but when this Makefile was converted from invoking
> the linker via the compiler, to invoking it directly, the option was
> missed.
> 
> This is the s390 variant of x86 commit cd01544a268a ("x86/vdso: Pass
> --eh-frame-hdr to the linker").
> 
> Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/


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

* Re: [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags
  2026-07-06 15:19 ` [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus
@ 2026-07-06 17:06   ` Ilya Leoshkevich
  2026-07-07  7:32     ` Jens Remus
  0 siblings, 1 reply; 7+ messages in thread
From: Ilya Leoshkevich @ 2026-07-06 17:06 UTC (permalink / raw)
  To: Jens Remus, linux-s390, linux-kernel
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle



On 7/6/26 17:19, Jens Remus wrote:
> While at it explicitly specify GNU_EH_FRAME PHDR to be read-only.
> 
> Inspired by x86 commit 8717b02b8c03 ("x86/entry/vdso: Include
> GNU_PROPERTY and GNU_STACK PHDRs").
> 
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
>   arch/s390/kernel/vdso/vdso.lds.S | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/s390/kernel/vdso/vdso.lds.S b/arch/s390/kernel/vdso/vdso.lds.S
> index 7bec4de0e8e0..35ea7ede06c0 100644
> --- a/arch/s390/kernel/vdso/vdso.lds.S
> +++ b/arch/s390/kernel/vdso/vdso.lds.S
> @@ -82,12 +82,16 @@ SECTIONS
>    * We must supply the ELF program headers explicitly to get just one
>    * PT_LOAD segment, and set the flags explicitly to make segments read-only.
>    */
> +#define PF_R	FLAGS(4)
> +#define PF_RW	FLAGS(6)

PF_RW seems to be unused
Intel uses it for gnu_stack, which we don't seem to have.


Anyway:

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>

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

* Re: [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker
  2026-07-06 15:19 ` [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
  2026-07-06 15:22   ` Jens Remus
@ 2026-07-06 17:26   ` Ilya Leoshkevich
  1 sibling, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2026-07-06 17:26 UTC (permalink / raw)
  To: Jens Remus, linux-s390, linux-kernel
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle



On 7/6/26 17:19, Jens Remus wrote:
> Commit 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link
> vDSO") accidentally broke the GNU_PTR_EH_FRAME program table entry in
> the vDSO, causing it to be empty:
> 
>    $ readelf --program-headers arch/s390/kernel/vdso/vdso.so
>    ...
>    Program Headers:
>      Type           Offset             VirtAddr           PhysAddr
>                     FileSiz            MemSiz              Flags  Align
>    ...
>      GNU_EH_FRAME   0x0000000000000000 0x0000000000000000 0x0000000000000000
>                     0x0000000000000000 0x0000000000000000         0x8
>    ...
> 
> Originally, the compiler would implicitly add --eh-frame-hdr when
> invoking the linker, but when this Makefile was converted from invoking
> the linker via the compiler, to invoking it directly, the option was
> missed.
> 
> This is the s390 variant of x86 commit cd01544a268a ("x86/vdso: Pass
> --eh-frame-hdr to the linker").
> 
> Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
>   arch/s390/kernel/vdso/Makefile | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>


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

* Re: [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags
  2026-07-06 17:06   ` Ilya Leoshkevich
@ 2026-07-07  7:32     ` Jens Remus
  0 siblings, 0 replies; 7+ messages in thread
From: Jens Remus @ 2026-07-07  7:32 UTC (permalink / raw)
  To: Ilya Leoshkevich, linux-s390, linux-kernel
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle

On 7/6/2026 7:06 PM, Ilya Leoshkevich wrote:
> On 7/6/26 17:19, Jens Remus wrote:
>> While at it explicitly specify GNU_EH_FRAME PHDR to be read-only.
>>
>> Inspired by x86 commit 8717b02b8c03 ("x86/entry/vdso: Include
>> GNU_PROPERTY and GNU_STACK PHDRs").
>>
>> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
>> ---
>>   arch/s390/kernel/vdso/vdso.lds.S | 12 ++++++++----
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/s390/kernel/vdso/vdso.lds.S b/arch/s390/kernel/vdso/vdso.lds.S
>> index 7bec4de0e8e0..35ea7ede06c0 100644
>> --- a/arch/s390/kernel/vdso/vdso.lds.S
>> +++ b/arch/s390/kernel/vdso/vdso.lds.S
>> @@ -82,12 +82,16 @@ SECTIONS
>>    * We must supply the ELF program headers explicitly to get just one
>>    * PT_LOAD segment, and set the flags explicitly to make segments read-only.
>>    */
>> +#define PF_R    FLAGS(4)
>> +#define PF_RW    FLAGS(6)
> 
> PF_RW seems to be unused
> Intel uses it for gnu_stack, which we don't seem to have.

Good catch, that slipped through.

I wondered whether we should also add a GNU_STACK PHDR in a separate
patch - similar to x86 and for the same reasons, as some of the .o files
linked into vdso.so do have a .note.GNU-stack.

> Anyway:
> 
> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>

Thanks!

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/


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

end of thread, other threads:[~2026-07-07  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 15:19 [PATCH 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR Jens Remus
2026-07-06 15:19 ` [PATCH 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
2026-07-06 15:22   ` Jens Remus
2026-07-06 17:26   ` Ilya Leoshkevich
2026-07-06 15:19 ` [PATCH 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus
2026-07-06 17:06   ` Ilya Leoshkevich
2026-07-07  7:32     ` Jens Remus

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.