From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=159.69.126.157 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796124518; b=da1OT6OKiidO20mR03XLDxwRX7YPaPm18Emhwh811KxNUa+5erCHxwRGZXGX55N6LnRS YTEpxlQHxJAJPw8fXemWQQ6LiHYZxTDBBI2v4pEyOBIz6UQypUFo6m6lBaiVZSPH/wjsh pgA4d8A3vt1lkDkPn0IM3BGuEczzPU7skIL1fAqdVVmf42SL93cqSXCM7PAxqr4R+SiuC PvKGnMCFZBIMhP5mcPfB3LlKCqhuX0+Y39a+dZb0/TrdsfrrnCTPEqHWjeZImfbeDQCIL TOMZgXgajDdsI0RqhCFiTQkoxsgIHzT4dZzbx1RMjO4D3rKSK/nEbpqR6nzHPPXrMcQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796124518; h=DMARC-Filter:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=nUavYgBKlrneAjPnods9iziPyW8kBv5xQ3+WxkT2R80=; b=emV6eRQjHy+rG4IK/UPNVRLbugablwkK/0ioSWcHXn60pDEyaTFIDhTJWmfRVqOF2KlF 6PAG0F1Jh2Q/K3CALQ/6yloQmwp46Ar9iqLgC+wd+4eX7Hd7LzyFIZ9XCTHcx6y9nPs1K oxf3Eab8uh/L+vrxWwy1wNOipNHBqMM5ZBqehcuj/glEbUpJZdxu8e/egKGi3/iWYAfHP sNKLN2nVSD7LZUO17lQ34DgtuCeLtuoP89QGvFUSlAjVgdj3tq121D3ErBFG0tVRJSCew wmvXiz+A8xjcr5NP7KafTbnT2L+UveIVBNMrdAVoK7P5Fy+9fghPhySgIQaPaIFB6Sg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass header.d=weissschuh.net header.i=@weissschuh.net header.a=rsa-sha256 header.s=mail header.b=MxPVyZ6Q; arc=none smtp.remote-ip=159.69.126.157 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84435606A31A; Tue, 1 Dec 2026 11:28:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 84435606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.a=rsa-sha256 header.s=mail header.b=MxPVyZ6Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1796124507; bh=ZrNlMSLpWkzivb6KS2HylQCSsGRr4/FbVlqqllpZDAM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MxPVyZ6QD5gMb93RtLY7Cg4aPBHoDGcLFaMU3LBp0kfPqB4e5YPAZnv4V+wIbYk3w r0VatawW7B2MFoJmcm9w5tN9KEuexOwSoOqys8a+62EfMPw0eO/9hHjbn4SK75DAeX u6T9T+x3kZ1lAuGczczOXwZUTm06yzAhHR6PnfOA= Date: Tue, 1 Dec 2026 12:28:27 +0100 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Fang Xieyan Cc: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , x86@kernel.org, Ingo Molnar , Borislav Petkov , Dave Hansen , Arnd Bergmann , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 1/5] vdso: Provide a sanitized subset of UAPI types Message-ID: <19a9e94d-0ff4-4461-b3e9-e5b40ef03ceb@message-id.t-8ch.de> References: <20261201102410.44071-1-fangxy@xiaopeng.com> <20261201102410.44071-2-fangxy@xiaopeng.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201102410.44071-2-fangxy@xiaopeng.com> On 2026-12-01 18:24:06+0800, Fang Xieyan wrote: (...) > --- > The new header has no users yet, so this patch alone cannot affect any > build; the x86_64 and arm64 builds in this series verify the consumers. > A clang -fsyntax-only sparc64 probe that mirrors the include sequence of > arch/sparc/vdso/vclock_gettime.c (, , > ) compiles cleanly; hardcoding __kernel_suseconds_t as > long instead fails there with the expected 'long' vs 'int' typedef > conflict, which is why the type is not mirrored. > The __kernel_long_t guard is inert in the current tree: no vDSO build > installs an override (the x86 x32 vDSO objects are objcopy'd from the > -m64 ones, and no vDSO .cmd file in the x86 or i386 object trees uses > -mx32, while under __KERNEL__ the x86 uapi posix_types layer is not > visible), so it only preserves the UAPI convention for a future > override. > checkpatch --strict reports 0 errors (the new-typedef and _Bool > CamelCase warnings are inherent false positives for a types header). > > include/vdso/types.h | 109 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 109 insertions(+) > create mode 100644 include/vdso/types.h > > diff --git a/include/vdso/types.h b/include/vdso/types.h > new file mode 100644 > index 000000000000..9afaaf22688e > --- /dev/null > +++ b/include/vdso/types.h > @@ -0,0 +1,109 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _VDSO_TYPES_H > +#define _VDSO_TYPES_H > + > +#ifndef __ASSEMBLER__ > + > +/* > + * Sanitized subset of the UAPI types for vDSO code. > + * > + * The definitions below mirror the UAPI integer and time types > + * (asm-generic/int-ll64.h, asm-generic/posix_types.h and the clock IDs > + * from linux/time.h) plus the plain u8..u64 aliases and bool from the > + * kernel-internal type headers, but they are provided here without > + * including any of those headers: when building the kernel, those > + * headers resolve to the kernel-internal include/linux and > + * include/asm-generic variants, which vDSO code must not depend on. I am really not a fan of all the duplication. It would be much nicer if we can avoid pulling in the non-UAPI headers when building the vDSO. (And have a compile-time check enforcing this) Also this current version still defers some important questions to the future without any hints on how they would be resolved. Maybe you could start by chipping away on the header dependency chains pulling in kernel headers from the vDSO builds. These will need to go away in any case. And when they are gone the problem will have become simpler and easier to discuss. The same goes for the usage of UAPI types over kernel types: size_t -> __kernel_size_t, clockid_t -> __kernel_clockid_t, etc. > + * > + * The time structs (struct __kernel_timespec, struct __kernel_old_timeval > + * and struct timezone) are not mirrored here: the vDSO build still pulls > + * in the UAPI time headers through other kernel headers, so defining them > + * here would conflict. They continue to come from the UAPI headers until > + * those remaining dependencies are isolated. > + * > + * Keep this header self-contained and in sync with the UAPI ABI. > + */ (...) > +typedef int __kernel_clockid_t; > +typedef __kernel_clockid_t clockid_t; While we are at it, the vDSO should just use __kernel_clockid_t instead of clockid_t. > + > +typedef long long __kernel_time64_t; > + > +/* > + * Mirror the generic UAPI definitions, which derive from > + * __kernel_long_t. That type is architecture overridable in the UAPI, > + * where a macro sentinel guards it so that an architecture can define > + * the type ahead of the generic one, as x86 does for x32. The same > + * guard is kept here, although no vDSO build overrides the type today. So this type is broken on x32 now? I am aware that we don't really build the x32 anyways and x32 is on its way out. But this is a very brittle pattern. > + * __kernel_old_time_t simply follows __kernel_long_t; the UAPI has no > + * separate override for it. __kernel_suseconds_t is deliberately not > + * mirrored: no vDSO code refers to the type name, it only appears > + * inside struct __kernel_old_timeval, which still comes from the UAPI > + * headers (sparc64 overrides it with 'int'). What is the longterm plan here? (...)