From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 254EF221275; Wed, 12 Nov 2025 20:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762979020; cv=none; b=Xn36rJ4C10t3OtKGAbioKhsQAV9lsZ+NIn0cUtVNyFckbDXfeQSKZIZNpClmHQ6jHuGHUvazqWH8ciH6qVl2/NyJKoxiU9q6B5/F6379QxzwBjnuYEwLL7vjWFePvGCrj6jydBdOGxvBc63J9MfAb0Q5febFpfDLNJuSBgg7cGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762979020; c=relaxed/simple; bh=Qc+ZX9T/f2W+RDw2MY8se8ehYAGsJxhh8u3/jBxkUvE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=uIm5ENnXqlYof3BMeW3m9lda4MIISyDRoP3tqWGpET+AMMwpLuO/vOrDU6/n94fovtRjytCyISiBjqk+f5Hd+7YUM2mCQwWIjvKDYTosFMmF7U5Iw2j03hNiE2C/8Bywhb7FboIhMTRsKbcCO/s9P7+gtO1SdRom+PgN+qQ4iq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=DQQX1usU; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="DQQX1usU" Received: from mail.zytor.com (c-76-133-66-138.hsd1.ca.comcast.net [76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 5ACKN2Lw978372 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 12 Nov 2025 12:23:03 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 5ACKN2Lw978372 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025102301; t=1762978985; bh=GacBjPJEXkeyFGvcySDne54yt1x9SXUnR3yJ7bSJhAE=; h=From:To:Subject:Date:From; b=DQQX1usUIahqMjsKWNcVJ0i0dpE90Gmy5bZ05KT7Utqs4KRgS57x17OedKRlTseg5 CHOzEX2rHZ9efgrpda3VtxZDwHIpPOJMo8vM8fFrfGSpc/w5wvUjHlZnWO6WDcSOlH KWW/IvjCAy4iip+hB9m/spAcgc8fVjl8Z/O+nxZx2IGvH5LBoZzzbZpQWDuknN4oNH FMpF6W9ECFEwVuPdBCRC3Gm2DiFjQ6YVLV38ux1PSao6Eh5nCpz4BhcIDVvqrkDWBx SbLBGBjNY4B6oGJgzeepV0a45I+/UNJaOWR65JJH6qIX+FMJXF2UxScZSGqvrHFv1u oL6C3vpwGfuww== From: "H. Peter Anvin" To: "H. Peter Anvin" , "Jason A. Donenfeld" , "Peter Zijlstra (Intel)" , "Theodore Ts'o" , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Xin Li , Andrew Cooper , Andy Lutomirski , Ard Biesheuvel , Borislav Petkov , Brian Gerst , Dave Hansen , Ingo Molnar , James Morse , Jarkko Sakkinen , Josh Poimboeuf , Kees Cook , Nam Cao , Oleg Nesterov , Perry Yuan , Thomas Gleixner , Thomas Huth , Uros Bizjak , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-sgx@vger.kernel.org, x86@kernel.org Subject: [PATCH v3 0/9] x86/entry/vdso: clean up the vdso build, vdso updates Date: Wed, 12 Nov 2025 12:22:45 -0800 Message-ID: <20251112202258.1310754-1-hpa@zytor.com> X-Mailer: git-send-email 2.51.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patchset cleans up the vdso build by building the 32- and 64-bit vdsos in separate directories, moving the vdso2c tool to arch/x86/tools, and by merging common code and especially Makefile rules between the 32- and 64-bit vdsos to the greatest extent possible. Be more strict about sanitizing and standardizing the vdso build options. Disable CFI for the vdso until the kernel adds user space IBT support. Modernize the DWARF generation vdso32/sigreturn.S. Add macros to cleanly call system calls from vdso source code. Add the GNU_PROPERTY and GNU_STACK PHDRs to the vdso. When using int $0x80 (old 32-bit hardware or FRED-capable 64-bit hardware) skip the stack stuff in the 32-bit kernel entry code and call int $0x80 directly when used from C code. Changes from v3: In arch/x86/include/asm/vdso/sys_call.h: - remove stray comment from prototyping (Uros Biszjak) - remove VDSO_SYSCALL6() since it would require special handling on 32 bits with frame pointers and is currently unused. (Uros Biszjak) - indent nested preprocessor directives. Changes from v2: Too many to count - much of the patchset has been reworked Patches: x86/entry/vdso: rename vdso_image_* to vdso*_image x86/entry/vdso: refactor the vdso build x86/entry/vdso32: don't rely on int80_landing_pad for adjusting ip x86/entry/vdso32: remove SYSCALL_ENTER_KERNEL macro in sigreturn.S x86/entry/vdso32: remove open-coded DWARF in sigreturn.S x86/entry/vdso: include GNU_PROPERTY and GNU_STACK PHDRs x86/vdso: abstract out vdso system call internals x86/cpufeature: replace X86_FEATURE_SYSENTER32 with X86_FEATURE_SYSFAST32 x86/entry/vdso32: when using int $0x80, use it directly --- arch/x86/Kconfig.cpufeatures | 8 + arch/x86/Makefile | 2 +- arch/x86/entry/syscall_32.c | 2 +- arch/x86/entry/vdso/.gitignore | 11 +- arch/x86/entry/vdso/Makefile | 162 +-------------------- arch/x86/entry/vdso/common/Makefile.include | 89 +++++++++++ arch/x86/entry/vdso/{vdso-note.S => common/note.S} | 5 +- arch/x86/entry/vdso/{ => common}/vclock_gettime.c | 0 arch/x86/entry/vdso/{ => common}/vdso-layout.lds.S | 51 ++++--- arch/x86/entry/vdso/{ => common}/vgetcpu.c | 0 arch/x86/entry/vdso/vdso32/Makefile | 24 +++ arch/x86/entry/vdso/vdso32/note.S | 19 +-- arch/x86/entry/vdso/vdso32/sigreturn.S | 152 +++++-------------- arch/x86/entry/vdso/vdso32/system_call.S | 22 ++- arch/x86/entry/vdso/vdso32/vclock_gettime.c | 5 +- arch/x86/entry/vdso/vdso32/vdso32.lds.S | 2 +- arch/x86/entry/vdso/vdso32/vgetcpu.c | 4 +- arch/x86/entry/vdso/vdso64/Makefile | 45 ++++++ arch/x86/entry/vdso/vdso64/note.S | 1 + arch/x86/entry/vdso/vdso64/vclock_gettime.c | 1 + .../entry/vdso/{vdso.lds.S => vdso64/vdso64.lds.S} | 2 +- arch/x86/entry/vdso/{ => vdso64}/vdsox32.lds.S | 2 +- arch/x86/entry/vdso/vdso64/vgetcpu.c | 1 + .../entry/vdso/{ => vdso64}/vgetrandom-chacha.S | 0 arch/x86/entry/vdso/{ => vdso64}/vgetrandom.c | 2 +- arch/x86/entry/vdso/{ => vdso64}/vsgx.S | 0 arch/x86/entry/vdso/vma.c | 24 ++- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/include/asm/dwarf2.h | 1 + arch/x86/include/asm/elf.h | 2 +- arch/x86/include/asm/vdso.h | 6 +- arch/x86/include/asm/vdso/gettimeofday.h | 108 +------------- arch/x86/include/asm/vdso/sys_call.h | 105 +++++++++++++ arch/x86/kernel/asm-offsets.c | 6 + arch/x86/kernel/cpu/centaur.c | 3 - arch/x86/kernel/cpu/common.c | 8 + arch/x86/kernel/cpu/intel.c | 4 +- arch/x86/kernel/cpu/zhaoxin.c | 4 +- arch/x86/kernel/fred.c | 2 +- arch/x86/kernel/process_64.c | 6 +- arch/x86/kernel/signal_32.c | 4 +- arch/x86/tools/Makefile | 15 +- arch/x86/{entry/vdso => tools}/vdso2c.c | 0 arch/x86/{entry/vdso => tools}/vdso2c.h | 0 arch/x86/xen/setup.c | 28 ++-- arch/x86/xen/smp_pv.c | 5 +- arch/x86/xen/xen-ops.h | 1 - 47 files changed, 448 insertions(+), 498 deletions(-)