mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] vDSO: Always reject undefined references during linking
@ 2025-03-06 14:07 Thomas Weißschuh
  2025-03-06 14:07 ` [PATCH v2 1/2] x86: vdso: " Thomas Weißschuh
  2025-03-06 14:07 ` [PATCH v2 2/2] sparc: vdso: " Thomas Weißschuh
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2025-03-06 14:07 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, David S. Miller,
	Andreas Larsson
  Cc: linux-kernel, sparclinux, Thomas Weißschuh

Instead of using a custom script to detect and fail on undefined
references, use --no-undefined for all VDSO linker invocations.

Drop the now unused checkundef.sh scripts.

These patches can be picked up by the architecture maintainers.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Rebase unto current torvalds/master
- Drop already applied patch for UM
- Drop spurious "in" from patch subjects
- Link to v1: https://lore.kernel.org/r/20241011-vdso-checkundef-v1-0-1a46e0352d20@linutronix.de

---
Thomas Weißschuh (2):
      x86: vdso: Always reject undefined references during linking
      sparc: vdso: Always reject undefined references during linking

 arch/sparc/vdso/Makefile          |  7 +++----
 arch/sparc/vdso/checkundef.sh     | 10 ----------
 arch/x86/entry/vdso/Makefile      |  7 +++----
 arch/x86/entry/vdso/checkundef.sh | 10 ----------
 4 files changed, 6 insertions(+), 28 deletions(-)
---
base-commit: 848e076317446f9c663771ddec142d7c2eb4cb43
change-id: 20241011-vdso-checkundef-f6dd0612025b

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>


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

* [PATCH v2 1/2] x86: vdso: Always reject undefined references during linking
  2025-03-06 14:07 [PATCH v2 0/2] vDSO: Always reject undefined references during linking Thomas Weißschuh
@ 2025-03-06 14:07 ` Thomas Weißschuh
  2025-03-11  8:58   ` [tip: timers/vdso] x86/vdso: " tip-bot2 for Thomas Weißschuh
  2025-03-06 14:07 ` [PATCH v2 2/2] sparc: vdso: " Thomas Weißschuh
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Weißschuh @ 2025-03-06 14:07 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, David S. Miller,
	Andreas Larsson
  Cc: linux-kernel, sparclinux, Thomas Weißschuh

Instead of using a custom script to detect and fail on undefined
references, use --no-undefined for all VDSO linker invocations.

Drop the now unused checkundef.sh script.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 arch/x86/entry/vdso/Makefile      |  7 +++----
 arch/x86/entry/vdso/checkundef.sh | 10 ----------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index c9216ac4fb1eb8c1e5bc5e33b41e9e40c7924cbf..99de18d88bc39f8f83f35e554028efd0a76fccec 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -32,7 +32,7 @@ targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg
 
 CPPFLAGS_vdso.lds += -P -C
 
-VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
+VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 \
 			-z max-page-size=4096
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
@@ -151,10 +151,9 @@ $(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
 quiet_cmd_vdso = VDSO    $@
       cmd_vdso = $(LD) -o $@ \
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-		       -T $(filter %.lds,$^) $(filter %.o,$^) && \
-		 sh $(src)/checkundef.sh '$(NM)' '$@'
+		       -T $(filter %.lds,$^) $(filter %.o,$^)
 
-VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 \
+VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 --no-undefined \
 	$(call ld-option, --eh-frame-hdr) -Bsymbolic -z noexecstack
 
 quiet_cmd_vdso_and_check = VDSO    $@
diff --git a/arch/x86/entry/vdso/checkundef.sh b/arch/x86/entry/vdso/checkundef.sh
deleted file mode 100755
index 7ee90a9b549da32c9c12d694215b89d08645574c..0000000000000000000000000000000000000000
--- a/arch/x86/entry/vdso/checkundef.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-nm="$1"
-file="$2"
-$nm "$file" | grep '^ *U' > /dev/null 2>&1
-if [ $? -eq 1 ]; then
-    exit 0
-else
-    echo "$file: undefined symbols found" >&2
-    exit 1
-fi

-- 
2.48.1


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

* [PATCH v2 2/2] sparc: vdso: Always reject undefined references during linking
  2025-03-06 14:07 [PATCH v2 0/2] vDSO: Always reject undefined references during linking Thomas Weißschuh
  2025-03-06 14:07 ` [PATCH v2 1/2] x86: vdso: " Thomas Weißschuh
@ 2025-03-06 14:07 ` Thomas Weißschuh
  2025-03-11  8:58   ` [tip: timers/vdso] sparc/vdso: " tip-bot2 for Thomas Weißschuh
  2025-03-11  9:09   ` tip-bot2 for Thomas Weißschuh
  1 sibling, 2 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2025-03-06 14:07 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, David S. Miller,
	Andreas Larsson
  Cc: linux-kernel, sparclinux, Thomas Weißschuh

Instead of using a custom script to detect and fail on undefined
references, use --no-undefined for all VDSO linker invocations.

Drop the now unused checkundef.sh script.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 arch/sparc/vdso/Makefile      |  7 +++----
 arch/sparc/vdso/checkundef.sh | 10 ----------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 50ec2978cda5397841daad6ffdc9682811b9b38e..fdc4a8f5a49c5b27fbaee861b24e8b31cfe64477 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -22,7 +22,7 @@ targets += $(foreach x, 32 64, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
 
-VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 --no-undefined \
+VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 \
 			-z max-page-size=8192
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
@@ -101,7 +101,6 @@ $(obj)/vdso32.so.dbg: FORCE \
 quiet_cmd_vdso = VDSO    $@
       cmd_vdso = $(LD) -nostdlib -o $@ \
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-		       -T $(filter %.lds,$^) $(filter %.o,$^) && \
-		sh $(src)/checkundef.sh '$(OBJDUMP)' '$@'
+		       -T $(filter %.lds,$^) $(filter %.o,$^)
 
-VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic
+VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic --no-undefined
diff --git a/arch/sparc/vdso/checkundef.sh b/arch/sparc/vdso/checkundef.sh
deleted file mode 100644
index 2d85876ffc32519ab8a0702917fedd31293cd9da..0000000000000000000000000000000000000000
--- a/arch/sparc/vdso/checkundef.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-objdump="$1"
-file="$2"
-$objdump -t "$file" | grep '*UUND*' | grep -v '#scratch' > /dev/null 2>&1
-if [ $? -eq 1 ]; then
-    exit 0
-else
-    echo "$file: undefined symbols found" >&2
-    exit 1
-fi

-- 
2.48.1


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

* [tip: timers/vdso] sparc/vdso: Always reject undefined references during linking
  2025-03-06 14:07 ` [PATCH v2 2/2] sparc: vdso: " Thomas Weißschuh
@ 2025-03-11  8:58   ` tip-bot2 for Thomas Weißschuh
  2025-03-11  9:09   ` tip-bot2 for Thomas Weißschuh
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2025-03-11  8:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: thomas.weissschuh, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the timers/vdso branch of tip:

Commit-ID:     82e6de7a4fe0826b813d91fd193d87625646c6d9
Gitweb:        https://git.kernel.org/tip/82e6de7a4fe0826b813d91fd193d87625646c6d9
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Thu, 06 Mar 2025 15:07:21 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 11 Mar 2025 09:49:16 +01:00

sparc/vdso: Always reject undefined references during linking

Instead of using a custom script to detect and fail on undefined
references, use --no-undefined for all VDSO linker invocations.

Drop the now unused checkundef.sh script.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250306-vdso-checkundef-v2-2-a26cc315fd73@linutronix.de
---
 arch/sparc/vdso/Makefile      |  7 +++----
 arch/sparc/vdso/checkundef.sh | 10 ----------
 2 files changed, 3 insertions(+), 14 deletions(-)
 delete mode 100644 arch/sparc/vdso/checkundef.sh

diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 50ec297..fdc4a8f 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -22,7 +22,7 @@ targets += $(foreach x, 32 64, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
 
-VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 --no-undefined \
+VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 \
 			-z max-page-size=8192
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
@@ -101,7 +101,6 @@ $(obj)/vdso32.so.dbg: FORCE \
 quiet_cmd_vdso = VDSO    $@
       cmd_vdso = $(LD) -nostdlib -o $@ \
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-		       -T $(filter %.lds,$^) $(filter %.o,$^) && \
-		sh $(src)/checkundef.sh '$(OBJDUMP)' '$@'
+		       -T $(filter %.lds,$^) $(filter %.o,$^)
 
-VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic
+VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic --no-undefined
diff --git a/arch/sparc/vdso/checkundef.sh b/arch/sparc/vdso/checkundef.sh
deleted file mode 100644
index 2d85876..0000000
--- a/arch/sparc/vdso/checkundef.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-objdump="$1"
-file="$2"
-$objdump -t "$file" | grep '*UUND*' | grep -v '#scratch' > /dev/null 2>&1
-if [ $? -eq 1 ]; then
-    exit 0
-else
-    echo "$file: undefined symbols found" >&2
-    exit 1
-fi

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

* [tip: timers/vdso] x86/vdso: Always reject undefined references during linking
  2025-03-06 14:07 ` [PATCH v2 1/2] x86: vdso: " Thomas Weißschuh
@ 2025-03-11  8:58   ` tip-bot2 for Thomas Weißschuh
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2025-03-11  8:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: thomas.weissschuh, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the timers/vdso branch of tip:

Commit-ID:     c080f2b8a2e44077aed15f1b4f0fbc0f4a912a66
Gitweb:        https://git.kernel.org/tip/c080f2b8a2e44077aed15f1b4f0fbc0f4a912a66
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Thu, 06 Mar 2025 15:07:20 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 11 Mar 2025 09:49:15 +01:00

x86/vdso: Always reject undefined references during linking

Instead of using a custom script to detect and fail on undefined
references, use --no-undefined for all VDSO linker invocations.

Drop the now unused checkundef.sh script.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250306-vdso-checkundef-v2-1-a26cc315fd73@linutronix.de
---
 arch/x86/entry/vdso/Makefile      |  7 +++----
 arch/x86/entry/vdso/checkundef.sh | 10 ----------
 2 files changed, 3 insertions(+), 14 deletions(-)
 delete mode 100755 arch/x86/entry/vdso/checkundef.sh

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 1c00723..a6430c5 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -32,7 +32,7 @@ targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg
 
 CPPFLAGS_vdso.lds += -P -C
 
-VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
+VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 \
 			-z max-page-size=4096
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
@@ -151,10 +151,9 @@ $(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
 quiet_cmd_vdso = VDSO    $@
       cmd_vdso = $(LD) -o $@ \
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-		       -T $(filter %.lds,$^) $(filter %.o,$^) && \
-		 sh $(src)/checkundef.sh '$(NM)' '$@'
+		       -T $(filter %.lds,$^) $(filter %.o,$^)
 
-VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 \
+VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 --no-undefined \
 	$(call ld-option, --eh-frame-hdr) -Bsymbolic -z noexecstack
 
 quiet_cmd_vdso_and_check = VDSO    $@
diff --git a/arch/x86/entry/vdso/checkundef.sh b/arch/x86/entry/vdso/checkundef.sh
deleted file mode 100755
index 7ee90a9..0000000
--- a/arch/x86/entry/vdso/checkundef.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-nm="$1"
-file="$2"
-$nm "$file" | grep '^ *U' > /dev/null 2>&1
-if [ $? -eq 1 ]; then
-    exit 0
-else
-    echo "$file: undefined symbols found" >&2
-    exit 1
-fi

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

* [tip: timers/vdso] sparc/vdso: Always reject undefined references during linking
  2025-03-06 14:07 ` [PATCH v2 2/2] sparc: vdso: " Thomas Weißschuh
  2025-03-11  8:58   ` [tip: timers/vdso] sparc/vdso: " tip-bot2 for Thomas Weißschuh
@ 2025-03-11  9:09   ` tip-bot2 for Thomas Weißschuh
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2025-03-11  9:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: thomas.weissschuh, Ingo Molnar, David S. Miller, Andreas Larsson,
	x86, linux-kernel

The following commit has been merged into the timers/vdso branch of tip:

Commit-ID:     652262975db421767ada3f05b926854bbb357759
Gitweb:        https://git.kernel.org/tip/652262975db421767ada3f05b926854bbb357759
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Thu, 06 Mar 2025 15:07:21 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 11 Mar 2025 09:54:48 +01:00

sparc/vdso: Always reject undefined references during linking

Instead of using a custom script to detect and fail on undefined
references, use --no-undefined for all VDSO linker invocations.

Drop the now unused checkundef.sh script.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Andreas Larsson <andreas@gaisler.com>
Link: https://lore.kernel.org/r/20250306-vdso-checkundef-v2-2-a26cc315fd73@linutronix.de
---
 arch/sparc/vdso/Makefile      |  7 +++----
 arch/sparc/vdso/checkundef.sh | 10 ----------
 2 files changed, 3 insertions(+), 14 deletions(-)
 delete mode 100644 arch/sparc/vdso/checkundef.sh

diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 50ec297..fdc4a8f 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -22,7 +22,7 @@ targets += $(foreach x, 32 64, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
 
-VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 --no-undefined \
+VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 \
 			-z max-page-size=8192
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
@@ -101,7 +101,6 @@ $(obj)/vdso32.so.dbg: FORCE \
 quiet_cmd_vdso = VDSO    $@
       cmd_vdso = $(LD) -nostdlib -o $@ \
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-		       -T $(filter %.lds,$^) $(filter %.o,$^) && \
-		sh $(src)/checkundef.sh '$(OBJDUMP)' '$@'
+		       -T $(filter %.lds,$^) $(filter %.o,$^)
 
-VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic
+VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic --no-undefined
diff --git a/arch/sparc/vdso/checkundef.sh b/arch/sparc/vdso/checkundef.sh
deleted file mode 100644
index 2d85876..0000000
--- a/arch/sparc/vdso/checkundef.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-objdump="$1"
-file="$2"
-$objdump -t "$file" | grep '*UUND*' | grep -v '#scratch' > /dev/null 2>&1
-if [ $? -eq 1 ]; then
-    exit 0
-else
-    echo "$file: undefined symbols found" >&2
-    exit 1
-fi

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

end of thread, other threads:[~2025-03-11  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-06 14:07 [PATCH v2 0/2] vDSO: Always reject undefined references during linking Thomas Weißschuh
2025-03-06 14:07 ` [PATCH v2 1/2] x86: vdso: " Thomas Weißschuh
2025-03-11  8:58   ` [tip: timers/vdso] x86/vdso: " tip-bot2 for Thomas Weißschuh
2025-03-06 14:07 ` [PATCH v2 2/2] sparc: vdso: " Thomas Weißschuh
2025-03-11  8:58   ` [tip: timers/vdso] sparc/vdso: " tip-bot2 for Thomas Weißschuh
2025-03-11  9:09   ` tip-bot2 for Thomas Weißschuh

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

all inboxes | Powered by JetHome®