From nobody Thu Apr 9 20:24:30 2026 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 848603644D7 for ; Thu, 5 Mar 2026 23:38:12 +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=1772753893; cv=none; b=IaBbzZjt6WsHR1LBB9J484WyHDJ3kl9YuFgtDHktgjvntGOaRnIDLd/zRKK4RHk+z/r55c1yZKddCqn0OJqJXcxkeCaPdr+GPDKOh9MVEz1PA7qOSLK7Ak3o5Gw0yFk2oJ9akkVqgOeFpIa+AyV1iEuhytVI/tYddniz0Q3dmQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772753893; c=relaxed/simple; bh=smNqutoojk2VbxwlfZwJkzwBVsCszGTt1GmNg5d9h4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B+9Z+PXllQ63trH7eSXvgLqA1vjXcBan+pHdMyCs70jWDbTG/ESBvW6Kuz5M01TzeaPuqMkvUjHunIKe/vXOhparjXsYxrcRKR1+kcOPyM2WJoSoWIdfA+HMMMb3cmyo2C7JhbAXoKL9E3aCbmX32Fd+E+8QC+PLW8f5v5KU1Ls= 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=PSlvvT8t; 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="PSlvvT8t" 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 625NLj8d4093851 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 5 Mar 2026 15:21:48 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 625NLj8d4093851 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2026022301; t=1772752908; bh=6huuGhRtd83y/pmv4U+pN1VU0YcvdX6i/GgyWwhTLV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSlvvT8toicCq4Mh6Tg7O6OWpOTQlB/LLjf6/IXa9GgQDAhqwNJxUgKWUl5V3JoKr zST9pLLjRTwqW6MKWwOGgDIHH8dKtpZbaO8oSWyT+x7hshDS5rWA3IKj+DGd9KODtF A3x8QyWjcV37F2+io3KjDjC2CDbgbEbpYDe7sWxA3QjkctMDdfxH7NBcmQNVWqIpAN 6JlNdfy7VnNBWIpfUByfP0LTfpX7DUKgmIucMIKUyQWCVrWsSKdRzJvbCKt3LW+ggV 6r3bdz67VUkumfMn5J36CSLSp5nfuUOoOSJl8xeQeFv9RlGgQW3a8lXga7o71fScjv 3dmfJQyHw535A== From: "H. Peter Anvin" To: Dave Hansen , x86@kernel.org, Andy Lutomirski , Borislav Petkov Cc: "H. Peter Anvin" , Jonathan Corbet , Shuah Khan , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Sohil Mehta , linux-kernel@vger.kernel.org Subject: [PATCH 1/1] x86/fault: cleanup: move x86-64 test into is_vsyscall_vaddr() Date: Thu, 5 Mar 2026 15:21:35 -0800 Message-ID: <20260305232136.224922-2-hpa@zytor.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260305232136.224922-1-hpa@zytor.com> References: <20260305214026.3887452-1-sohil.mehta@intel.com> <20260305232136.224922-1-hpa@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In one location, there is an IS_ENABLED(CONFIG_X86_64) before calling is_vsyscall_vaddr(), in another the whole thing is under #ifdef. Moving IS_ENABLED(CONFIG_X86_64) into is_vsyscall_vaddr(), which is an inline function anyway, eliminates the need for both. This exposes a dummy call to emulate_vsyscall() to the compiler on x86-32, but that is perfectly OK since the stub inline for !CONFIG_X86_VSYSCALL_EMULATION is available even when compiling for x86-32. Signed-off-by: H. Peter Anvin (Intel) --- arch/x86/include/asm/vsyscall.h | 3 ++- arch/x86/mm/fault.c | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscal= l.h index 538053b1656a..57ab3da53002 100644 --- a/arch/x86/include/asm/vsyscall.h +++ b/arch/x86/include/asm/vsyscall.h @@ -36,7 +36,8 @@ static inline bool emulate_vsyscall_gp(struct pt_regs *re= gs) */ static inline bool is_vsyscall_vaddr(unsigned long vaddr) { - return unlikely((vaddr & PAGE_MASK) =3D=3D VSYSCALL_ADDR); + return IS_ENABLED(CONFIG_X86_64) && + unlikely((vaddr & PAGE_MASK) =3D=3D VSYSCALL_ADDR); } =20 #endif /* _ASM_X86_VSYSCALL_H */ diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index f0e77e084482..fcd6b58dc0ac 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -1119,7 +1119,7 @@ bool fault_in_kernel_space(unsigned long address) * TASK_SIZE_MAX, but is not considered part of the kernel * address space. */ - if (IS_ENABLED(CONFIG_X86_64) && is_vsyscall_vaddr(address)) + if (is_vsyscall_vaddr(address)) return false; =20 return address >=3D TASK_SIZE_MAX; @@ -1301,7 +1301,6 @@ void do_user_addr_fault(struct pt_regs *regs, if (user_mode(regs)) flags |=3D FAULT_FLAG_USER; =20 -#ifdef CONFIG_X86_64 /* * Faults in the vsyscall page might need emulation. The * vsyscall page is at a high address (>PAGE_OFFSET), but is @@ -1317,7 +1316,6 @@ void do_user_addr_fault(struct pt_regs *regs, if (emulate_vsyscall_pf(error_code, regs, address)) return; } -#endif =20 if (!(flags & FAULT_FLAG_USER)) goto lock_mmap; --=20 2.53.0