summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2025-08-19 15:29:44 -0700
committerThomas Gleixner <tglx@linutronix.de>2025-09-13 19:51:59 +0200
commita001cd248ab244633c5fabe4f7c707e13fc1d1cc (patch)
tree8105936f1f0fd2c5ba903f055ea373f6824b5f32 /kernel
parent6eb350a2233100a283f882c023e5ad426d0ed63b (diff)
rseq/selftests: Use weak symbol reference, not definition, to link with glibc
Add "extern" to the glibc-defined weak rseq symbols to convert the rseq selftest's usage from weak symbol definitions to weak symbol _references_. Effectively re-defining the glibc symbols wreaks havoc when building with -fno-common, e.g. generates segfaults when running multi-threaded programs, as dynamically linked applications end up with multiple versions of the symbols. Building with -fcommon, which until recently has the been the default for GCC and clang, papers over the bug by allowing the linker to resolve the weak/tentative definition to glibc's "real" definition. Note, the symbol itself (or rather its address), not the value of the symbol, is set to 0/NULL for unresolved weak symbol references, as the symbol doesn't exist and thus can't have a value. Check for a NULL rseq size pointer to handle the scenario where the test is statically linked against a libc that doesn't support rseq in any capacity. Fixes: 3bcbc20942db ("selftests/rseq: Play nice with binaries statically linked against glibc 2.35+") Reported-by: Thomas Gleixner <tglx@linutronix.de> Suggested-by: Florian Weimer <fweimer@redhat.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: stable@vger.kernel.org Closes: https://lore.kernel.org/all/87frdoybk4.ffs@tglx
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions