public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: "André Almeida" <andrealmeid@igalia.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	 Will Deacon <will@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
	 Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	 Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Carlos O'Donell <carlos@redhat.com>,
	 Peter Zijlstra <peterz@infradead.org>,
	Florian Weimer <fweimer@redhat.com>,
	 Rich Felker <dalias@aerifal.cx>,
	Torvald Riegel <triegel@redhat.com>,
	 Darren Hart <dvhart@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	 Davidlohr Bueso <dave@stgolabs.net>,
	Arnd Bergmann <arnd@arndb.de>,
	 "Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Uros Bizjak <ubizjak@gmail.com>,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	 kernel-dev@igalia.com
Subject: Re: [PATCH RFC 1/2] arm64: vdso: Prepare for robust futex unlock support
Date: Wed, 22 Apr 2026 15:17:50 +0200	[thread overview]
Message-ID: <1a06fee7-65ff-4828-85f1-e3ee1e82610f@t-8ch.de> (raw)
In-Reply-To: <e0ee43e3-725c-4b99-80b3-956d24beb1c7@t-8ch.de>

On 2026-04-22 15:02:45+0200, Thomas Weißschuh wrote:
> On 2026-04-17 11:56:10-0300, André Almeida wrote:
> > There will be a VDSO function to unlock non-contended robust futexes in
> > user space. The unlock sequence is racy vs. clearing the list_pending_op
> > pointer in the task's robust list head. To plug this race the kernel needs
> > to know the critical section window so it can clear the pointer when the
> > task is interrupted within that race window. The window is determined by
> > labels in the inline assembly.
> > 
> > Signed-off-by: André Almeida <andrealmeid@igalia.com>
> > ---
> > RFC: Those symbols can't be found by the linker after patch 2/2, it fails with:
> > 
> > ld: arch/arm64/kernel/vdso.o: in function `vdso_futex_robust_unlock_update_ips':
> > arch/arm64/kernel/vdso.c:72:(.text+0x200): undefined reference to `__futex_list64_try_unlock_cs_success'
> > ld: arch/arm64/kernel/vdso.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__futex_list64_try_unlock_cs_success' which may bind externally can not be used when making a shared object; recompile with -fPIC
> > arch/arm64/kernel/vdso.c:72:(.text+0x200): dangerous relocation: unsupported relocation
> 
> arch/arm64/kernel/vdso.o is a kernel object.
> __futex_list64_try_unlock_cs_success is a vDSO symbol.
> They live in wholly different objects, which are never linked together.
> Look at VDSO_SYMBOL() to get the offset of the vDSO symbol in kernel code.
> 
> (...)

The diff below shows the idea. Compat code is not fixed, and I didn't
even try to run it. Also please use CONFIG_COMPAT_VDSO over plain
CONFIG_COMPAT.

diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h
index 182fde1df3dd..232b46969088 100644
--- a/arch/arm64/include/asm/vdso.h
+++ b/arch/arm64/include/asm/vdso.h
@@ -18,10 +18,6 @@
 
 extern char vdso_start[], vdso_end[];
 extern char vdso32_start[], vdso32_end[];
-extern char __futex_list64_try_unlock_cs_success[], __futex_list64_try_unlock_cs_end[];
-#ifdef CONFIG_COMPAT
-extern char __futex_list32_try_unlock_cs_success[], __futex_list32_try_unlock_cs_end[];
-#endif
 
 #endif /* !__ASSEMBLER__ */
 
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 42a82e73a774..45eb1aa627a2 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -64,21 +64,17 @@ static void vdso_futex_robust_unlock_update_ips(enum vdso_abi abi, struct mm_str
 	unsigned long vdso = (unsigned long) mm->context.vdso;
 	struct futex_mm_data *fd = &mm->futex;
 
-	/*
-	 * RFC: won't compile due to undefined reference to `__futex_list64_try_unlock_cs_...`
-
 	if (abi == VDSO_ABI_AA64) {
-		futex_set_vdso_cs_range(fd, 0, vdso, (uintptr_t) __futex_list64_try_unlock_cs_success,
-					(uintptr_t) __futex_list64_try_unlock_cs_end, false);
+		futex_set_vdso_cs_range(fd, 0, vdso, (uintptr_t)VDSO_SYMBOL(vdso, futex_list64_try_unlock_cs_success),
+					(uintptr_t)VDSO_SYMBOL(vdso, futex_list64_try_unlock_cs_end), false);
 	}
 
-#ifdef CONFIG_COMPAT
+#ifdef CONFIG_COMPAT_VDSO
 	if (abi == VDSO_ABI_AA32) {
 		futex_set_vdso_cs_range(fd, 1, vdso, (uintptr_t) __futex_list32_try_unlock_cs_success,
 					(uintptr_t) __futex_list32_try_unlock_cs_end, true);
 	}
 #endif
-	*/
 }
 #else
 static inline void vdso_futex_robust_unlock_update_ips(enum vdso_abi abi, struct mm_struct *mm) { }
diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index 33ce58516580..a17e6eab9d3f 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -116,3 +116,5 @@ VERSION
  * Make the sigreturn code visible to the kernel.
  */
 VDSO_sigtramp		= __kernel_rt_sigreturn;
+VDSO_futex_list64_try_unlock_cs_success = __futex_list64_try_unlock_cs_success;
+VDSO_futex_list64_try_unlock_cs_end = __futex_list64_try_unlock_cs_end;

  reply	other threads:[~2026-04-22 13:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 14:56 [PATCH RFC 0/2] arm64: vdso: Implement __vdso_futex_robust_try_unlock() André Almeida
2026-04-17 14:56 ` [PATCH RFC 1/2] arm64: vdso: Prepare for robust futex unlock support André Almeida
2026-04-17 15:08   ` Florian Weimer
2026-04-22 12:46     ` André Almeida
2026-04-22 12:56       ` Florian Weimer
2026-04-22 13:02   ` Thomas Weißschuh
2026-04-22 13:17     ` Thomas Weißschuh [this message]
2026-04-17 14:56 ` [PATCH RFC 2/2] arm64: vdso: Implement __vdso_futex_robust_try_unlock() André Almeida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a06fee7-65ff-4828-85f1-e3ee1e82610f@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=Liam.Howlett@oracle.com \
    --cc=andrealmeid@igalia.com \
    --cc=arnd@arndb.de \
    --cc=bigeasy@linutronix.de \
    --cc=carlos@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=dalias@aerifal.cx \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=fweimer@redhat.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=triegel@redhat.com \
    --cc=ubizjak@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox