Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR
@ 2026-07-13 14:42 Jens Remus
  2026-07-13 14:42 ` [PATCH v2 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
  2026-07-13 14:42 ` [PATCH v2 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Remus @ 2026-07-13 14:42 UTC (permalink / raw)
  To: linux-s390, linux-kernel
  Cc: Jens Remus, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Sven Schnelle, Ilya Leoshkevich

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.

Changes to v2:
- Address review feedback.

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 | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)


base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
-- 
2.53.0


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

* [PATCH v2 1/2] s390/vdso: Pass --eh-frame-hdr to the linker
  2026-07-13 14:42 [PATCH v2 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR Jens Remus
@ 2026-07-13 14:42 ` Jens Remus
  2026-07-13 14:42 ` [PATCH v2 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Remus @ 2026-07-13 14:42 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_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")
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    Changes in v2:
    - Correct GNU_EH_FRAME PHDR name in commit message.

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

* [PATCH v2 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags
  2026-07-13 14:42 [PATCH v2 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR Jens Remus
  2026-07-13 14:42 ` [PATCH v2 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
@ 2026-07-13 14:42 ` Jens Remus
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Remus @ 2026-07-13 14:42 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").

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    Changes in v2:
    - Drop unused PF_RW. (Ilya)

 arch/s390/kernel/vdso/vdso.lds.S | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/s390/kernel/vdso/vdso.lds.S b/arch/s390/kernel/vdso/vdso.lds.S
index 7bec4de0e8e0..841daeec4be2 100644
--- a/arch/s390/kernel/vdso/vdso.lds.S
+++ b/arch/s390/kernel/vdso/vdso.lds.S
@@ -82,12 +82,15 @@ 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_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] 3+ messages in thread

end of thread, other threads:[~2026-07-13 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 14:42 [PATCH v2 0/2] s390/vdso: Fix GNU_EH_FRAME PHDR Jens Remus
2026-07-13 14:42 ` [PATCH v2 1/2] s390/vdso: Pass --eh-frame-hdr to the linker Jens Remus
2026-07-13 14:42 ` [PATCH v2 2/2] s390/vdso: Use symbolic constants for the PHDR permission flags Jens Remus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox