From nobody Mon Jun 8 08:30:46 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0773480979; Wed, 3 Jun 2026 14:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780496697; cv=none; b=lD7T9LFEpPcCFEgvWWT5NoOCI6SCMItSBk5ywkfgmKOQJ8uG9D08FKOPkEYVcEPqZ+zV3q0NYh/qAqR/PA2cg88BZaRQ6bBaykU26QuQzzglmAWw9+0JMbn8OsT+hkR/5kNOWA3B/CVnJ9w2kO0bclxzwXSU7psuam4jZ/CeItI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780496697; c=relaxed/simple; bh=3Bi7n7cO/JQHznnBSe/T1v19TUEtrvyU2d7u8/TRk+M=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=OA/sUcqqJVZaLNWbI8WDywmNQo99LjjOlJp04ledtcMyOet0boLoTb0iFWjgWDwPGZB618Hgfjh0aOcULUoi7UK9W2bnwgSnLl+0N4Ob2qonD9v8Hce3+QJsMSt2008D3M/32yBpaYsrT0GsgRpP3qEsjDVEJhreHV43YLJ2+a4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tJdwFFGj; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=71v0bHOW; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tJdwFFGj"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="71v0bHOW" Date: Wed, 03 Jun 2026 14:24:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780496693; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WLT5rKYK1KS5IRxI4NXcZxyqXYZGrdjCnewCMc3toRg=; b=tJdwFFGjWxNATolQr6e60BYgWGl+dJwQdoZJP0mtZt3QkSWE6B2LlyCsSTXTP77rVG7HXo LrTiha6pbMnmWATs3rbEXNdBSTVndypnK36BUMkOd2dt/lDnDXOO3wiPiMDoeM2oI5xTvl ZpH0iVHWStCWOq34JYfzM4Qr4iuj1qiGATJL08YdNHfViq5iKUKEJStSfQFIMYZIeFRCpf OWhJ7hyHTQABxB8PJ9NE030ZMUZUHzBF3mUXFP8R+/4h+7O8bCj1Iw7eF7idgIckrD3FWg jm+karHxuFFx1gg51oTZoEvHK/cCPnHlcJj0pU1Hvu2yf188JWQM9pDtRL20pQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780496693; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WLT5rKYK1KS5IRxI4NXcZxyqXYZGrdjCnewCMc3toRg=; b=71v0bHOWGz/aYbfLghdnrXuNFMi3mDOgW6goSfFw1EY3xgotg9em6ZCOQW9lwv82Hfgjrg nK2b/akJGpK3/AAw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] x86/vdso: Prepare for robust futex unlock support Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , andrealmeid@igalia.com, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260602090535.828312645@kernel.org> References: <20260602090535.828312645@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178049669213.710.10315730071383316105.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the locking/core branch of tip: Commit-ID: 61cfc8e372d1971e0a96d3f1f8b5ee29916b3385 Gitweb: https://git.kernel.org/tip/61cfc8e372d1971e0a96d3f1f8b5ee299= 16b3385 Author: Thomas Gleixner AuthorDate: Tue, 02 Jun 2026 11:10:08 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 03 Jun 2026 11:38:52 +02:00 x86/vdso: Prepare for robust futex unlock support 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. Add these symbols to the vdso2c generator and use them in the VDSO VMA code to update the critical section addresses in mm_struct::futex on (re)map(). The symbols are not exported to user space, but available in the debug version of the vDSO. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Andr=C3=A9 Almeida Link: https://patch.msgid.link/20260602090535.828312645@kernel.org --- arch/x86/entry/vdso/vma.c | 29 +++++++++++++++++++++++++++++ arch/x86/include/asm/vdso.h | 4 ++++ arch/x86/tools/vdso2c.c | 16 ++++++++++------ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index a6bfcc8..9a953e7 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -73,6 +74,31 @@ static void vdso_fix_landing(const struct vdso_image *im= age, regs->ip =3D new_vma->vm_start + ipoffset; } =20 +#ifdef CONFIG_FUTEX_ROBUST_UNLOCK +static void vdso_futex_robust_unlock_update_ips(void) +{ + const struct vdso_image *image =3D current->mm->context.vdso_image; + unsigned long vdso =3D (unsigned long) current->mm->context.vdso; + struct futex_mm_data *fd =3D ¤t->mm->futex; + unsigned int idx =3D 0; + + futex_reset_cs_ranges(fd); + +#ifdef CONFIG_X86_64 + futex_set_vdso_cs_range(fd, idx, vdso + image->sym___futex_list64_try_unl= ock_cs_start, + vdso + image->sym___futex_list64_try_unlock_cs_end, false); + idx++; +#endif /* CONFIG_X86_64 */ + +#if defined(CONFIG_X86_32) || defined(CONFIG_COMPAT) + futex_set_vdso_cs_range(fd, idx, vdso + image->sym___futex_list32_try_unl= ock_cs_start, + vdso + image->sym___futex_list32_try_unlock_cs_end, true); +#endif /* CONFIG_X86_32 || CONFIG_COMPAT */ +} +#else +static inline void vdso_futex_robust_unlock_update_ips(void) { } +#endif + static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma) { @@ -80,6 +106,7 @@ static int vdso_mremap(const struct vm_special_mapping *= sm, =20 vdso_fix_landing(image, new_vma); current->mm->context.vdso =3D (void __user *)new_vma->vm_start; + vdso_futex_robust_unlock_update_ips(); =20 return 0; } @@ -185,6 +212,8 @@ static int map_vdso(const struct vdso_image *image, uns= igned long addr) current->mm->context.vdso =3D (void __user *)text_start; current->mm->context.vdso_image =3D image; =20 + vdso_futex_robust_unlock_update_ips(); + up_fail: mmap_write_unlock(mm); return ret; diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h index f2d4921..4e73515 100644 --- a/arch/x86/include/asm/vdso.h +++ b/arch/x86/include/asm/vdso.h @@ -24,6 +24,10 @@ struct vdso_image { long sym_int80_landing_pad; long sym_vdso32_sigreturn_landing_pad; long sym_vdso32_rt_sigreturn_landing_pad; + long sym___futex_list64_try_unlock_cs_start; + long sym___futex_list64_try_unlock_cs_end; + long sym___futex_list32_try_unlock_cs_start; + long sym___futex_list32_try_unlock_cs_end; }; =20 extern const struct vdso_image vdso64_image; diff --git a/arch/x86/tools/vdso2c.c b/arch/x86/tools/vdso2c.c index b8a5557..64a636b 100644 --- a/arch/x86/tools/vdso2c.c +++ b/arch/x86/tools/vdso2c.c @@ -75,12 +75,16 @@ struct vdso_sym { }; =20 struct vdso_sym required_syms[] =3D { - {"__kernel_vsyscall", true}, - {"__kernel_sigreturn", true}, - {"__kernel_rt_sigreturn", true}, - {"int80_landing_pad", true}, - {"vdso32_rt_sigreturn_landing_pad", true}, - {"vdso32_sigreturn_landing_pad", true}, + {"__kernel_vsyscall", true}, + {"__kernel_sigreturn", true}, + {"__kernel_rt_sigreturn", true}, + {"int80_landing_pad", true}, + {"vdso32_rt_sigreturn_landing_pad", true}, + {"vdso32_sigreturn_landing_pad", true}, + {"__futex_list64_try_unlock_cs_start", true}, + {"__futex_list64_try_unlock_cs_end", true}, + {"__futex_list32_try_unlock_cs_start", true}, + {"__futex_list32_try_unlock_cs_end", true}, }; =20 __attribute__((format(printf, 1, 2))) __attribute__((noreturn))