From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A7C6E3A1A38 for ; Tue, 17 Mar 2026 09:51:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773741110; cv=none; b=o/EHNOqplwmEfVeBI2Ol6l+ytzX6zY3dDvvlglVQDt4J/MiOoKGmDdbVRxUMez2d0YucU9sPlOy7nKvDRvl7aT41vCY9/bSTjPHof04GGSd4foNLkxWTP49FwO7wI/bWxuPHhMhLYdC4uVxRDAxACZ5hnihx+AFkiDeZIrebdSM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773741110; c=relaxed/simple; bh=sxP07jCSgt4YMD/wfKuyYKyH3eHPSF5fOXXg7vcLOfs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=MlBvjnPRlgQG3dbphIgSEA7x5684+Ivhk8lbEaqRcWXPjxKcy284l1yR8DxoL5dhVr3yoJNdn+bUR+tEubiLACBvwfJzhezPBEUIlaiY2Hk6ZcuJJdWmQXCY8n/mDfeDMXsfHKsERM79MrNEK993tkxEVf8exu4CR31pjKvB9KM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ojl/V21y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ojl/V21y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11BD1C4CEF7; Tue, 17 Mar 2026 09:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773741110; bh=sxP07jCSgt4YMD/wfKuyYKyH3eHPSF5fOXXg7vcLOfs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ojl/V21yG28yRc1Dp3hWrw4WOZaP6Y2Hi5V6+tABpNsY3wJRklZbkl/0bAm109cq+ ach1oSIZIIz8e+ni1IB9GjfT9faYHoIWmBKOYMDoDwKnwoQmbeZgBYCYxtoZ5opZAe eRLQYSv1wl4k/AGDZHaoJKbaR4pozq4T1oPmR4iHKGfkbWyoszUcDAXMoLsT74Bub/ iBvRHAuxpnj1fSHNphto/M1+dnhDvnTYKfyPh+PO03cCPfgiz/lc1vrO7oxCh41e7A DVjygVF1Am2kP+J1SoyBwtNwyScI/98Hnhy+kRuu3E5M3k2wdlYp2/SCYJXxPtPIII Lu/Y3H/iQrHvw== From: Thomas Gleixner To: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= Cc: LKML , Mathieu Desnoyers , =?utf-8?Q?Andr=C3=A9?= Almeida , Sebastian Andrzej Siewior , Carlos O'Donell , Peter Zijlstra , Florian Weimer , Rich Felker , Torvald Riegel , Darren Hart , Ingo Molnar , Davidlohr Bueso , Arnd Bergmann , "Liam R . Howlett" Subject: Re: [patch 8/8] x86/vdso: Implement __vdso_futex_robust_try_unlock() In-Reply-To: <20260317081606-6b19f6a3-34e5-4056-9b8b-e9b90028b960@linutronix.de> References: <20260316162316.356674433@kernel.org> <20260316164951.484640267@kernel.org> <20260317081606-6b19f6a3-34e5-4056-9b8b-e9b90028b960@linutronix.de> Date: Tue, 17 Mar 2026 10:51:47 +0100 Message-ID: <87bjgmokb0.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 17 2026 at 08:25, Thomas Wei=C3=9Fschuh wrote: > On Mon, Mar 16, 2026 at 06:13:34PM +0100, Thomas Gleixner wrote: >> +/* >> + * Compat enabled kernels have to take the size bit into account to sup= port the >> + * mixed size use case of gaming emulators. Contrary to the kernel robu= st unlock >> + * mechanism all of this does not test for the 32-bit modifier in 32-bi= t VDSOs >> + * and in compat disabled kernels. User space can keep the pieces. >> + */ >> +#if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64) > > #ifndef __x86_64__ ? #ifdef :) Just had to double check and convince myself that __x86_64__ is set when building for the X86_X32 ABI. Seems to work. >> +uint32_t __vdso_futex_robust_try_unlock(uint32_t *lock, uint32_t tid, v= oid *pop) > > While uint32_t is originally a userspace type, in the kernel it also pull= s in > other internal types which are problematic in the vDSO. __u32 from > uapi/linux/types.h avoid this issue. Sure. >> --- a/arch/x86/entry/vdso/vdso64/vdsox32.lds.S >> +++ b/arch/x86/entry/vdso/vdso64/vdsox32.lds.S >> @@ -22,6 +22,12 @@ VERSION { >> __vdso_getcpu; >> __vdso_time; >> __vdso_clock_getres; >> +#ifdef CONFIG_FUTEX_ROBUST_UNLOCK >> + __vdso_futex_robust_try_unlock; > >> + __vdso_futex_robust_try_unlock_cs_start; >> + __vdso_futex_robust_try_unlock_cs_success; >> + __vdso_futex_robust_try_unlock_cs_end; > > These three symbols are not meant to be used from outside the vDSO > implementation, so they don't need to be exported by the linkerscripts. You are right in principle and I had it differently in the first place until I realized that exposing them is useful for debugging and validation purposes. As I pointed out in the cover letter you can use GDB to actually verify the fixup magic. That makes it obviously possible to write a user space selftest without requiring to decode the internals of the VDSO. Due to my pretty limited userspace DSO knowledge that was the best I came up with. If you have a better idea, please let me know. Thanks, tglx