From nobody Wed Dec 17 20:41:18 2025 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4462F20110F for ; Fri, 14 Mar 2025 15:12:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965153; cv=none; b=hnwo7v7ZEIo14mLP9kUis9oALP44kMsJsracyBO9UX3M4Sk1XMfdZvpHF0xyGwfEuZ3exh8jkN9KRlvkRuh5D1A2ZfB7mJn3VnmotKyvDdlif+9sYjq3hgPgzjcKXb5c9ELqDVQj7hXHKh885K+uCg2nHl23exfDyMUNWWRc0uQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965153; c=relaxed/simple; bh=o4SMd5DBp/WKmz7RRjvN3ujNoeYVVFavfZxIfkWgWTc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g7iFQ8hZXx/Mr0XIgnaVYmM768Jc5OS4uCg2pciKOCecsU93gEkxmfLFkPyQ3VqfZTueKaem7PYe+f3aZAITWnTeRUzWazu3WpgYRfN/Z2XNEP9ZyqlwpofRq5fWPgdMgftKWZUJhFqwTxnMvfhgNkbaY+5qKWXvv6CD0XmPPpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e733EA1K; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e733EA1K" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-2bcc5c887efso1829952fac.2 for ; Fri, 14 Mar 2025 08:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965151; x=1742569951; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mc/o/a5y2MySh4AIfJv4w5SkZzpsu4/WCrhprAfAfKQ=; b=e733EA1KofV87OwznowCs/OT17I/bPIrnNp+0LiPMXLvzGUtOTYh07D4NksZmJ8aJ8 s7yGfYXXSS34Pktr0BzI43t+GOQuPsns5ovDxOUQupc94sElxJKZNJFvZSVqf0NdxYLa lnKuRtzRZsWSUfSBNKX4HgFz5R1zj9Mo0A7Yfs7VBJZCotYNq1qM0y1TUNvXHrRDDWpW 7CVx9jylXqHhpC52ttAl60yOtgx1se5sx6lRbUK73kW/WZnM6vHlD0t8c9UTgpAoexi0 rVN4KsXIbUsjxK2hJvPBbgSXBUEvfGHj9QKdTs7blw2B0/3dqhSg2NAHGmL5Pdz4Q2Lf 5oNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965151; x=1742569951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mc/o/a5y2MySh4AIfJv4w5SkZzpsu4/WCrhprAfAfKQ=; b=RGQ/8okpVFTx9UDKICoxs4YN8BczJDyw8AHBXJfEfw+v8AguDW8UtzFsJZg2Zj93ff zzxnT1E8G9nGhJZFO+umT2t6rzEaYa+n5f9fIB8YqQiNO8GLUd1poxyf1kqnzw0UJqWp zjmh3eJ3fGsQbSRaRwDChJV8N4U+bmDUpxghDf0g4CN+zk0x0pFGMpRAYuthClyd2a7R /dgejic1yiN9xeoSkG++jDz0843ab7seV20SGLNGzzA2/zTIWivy5IDccVfDRtHITtXy 6bGKWLRCVR01UzygpJN9daHi9W0srlgJSmAEIDFkv70yMRdv8nO/SS3Ht6o2SdONnCpz 2cZw== X-Gm-Message-State: AOJu0YwZ19I6eyfvqdNXJDjwO11XGtJO+idprPQHOq0KwUwcrVte/pk6 k06bAgYWTLEgv9FMUBHXl6A+qUTrkGgFNGnQYHlrERy/j+qZcRkQOgux X-Gm-Gg: ASbGncsaLhK4wOMw1pe1GPg/rp+1XgohlyyUDQObhdjo9/PmBTnzFdIyH3qLAoLX0zN je+u3Kl8ZUr5N0sxHjwGTMiaV/xYO6Z0fTpVeAtc+j1lkAc+MCXT/oGwpPp0GfhArUcpSd5kzGA Jr3xrusSY9bSMZQ9bKl42/H89AyWTEdnbX/x8dREnuneCCty2cf77jXxsFICu4Z33F2VincM4rQ UdE2eqqaz1SntTtWECLnKf9tBEZyFr0HBma/L+5fAERbsu3cgI3kITDpJ/TVJhPH3SnMjxcNYF1 q3jUHeKmXa5237iBn0gBcU8L2lzbwM/WvAVr X-Google-Smtp-Source: AGHT+IGBB78gG3em3xoLp1wgCCtotC7e6TlZsRJanEmpJivJYIALtItcKk+dInrhVkfjBGfwegNMdg== X-Received: by 2002:a05:6870:1ce:b0:2c1:6735:4abb with SMTP id 586e51a60fabf-2c690ecfcb2mr1700461fac.5.1741965150960; Fri, 14 Mar 2025 08:12:30 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:30 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst Subject: [PATCH v2 1/7] x86/xen: Move Xen upcall handler Date: Fri, 14 Mar 2025 11:12:14 -0400 Message-ID: <20250314151220.862768-2-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" Move the upcall handler to Xen-specific files. No functional changes. Signed-off-by: Brian Gerst Cc: Juergen Gross Cc: Boris Ostrovsky Reviewed-by: Juergen Gross Reviewed-by: Sohil Mehta --- arch/x86/entry/common.c | 72 ------------------------------------- arch/x86/xen/enlighten_pv.c | 69 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 72 deletions(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 3514bf2978ee..ce4d88eda693 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -21,11 +21,6 @@ #include #include =20 -#ifdef CONFIG_XEN_PV -#include -#include -#endif - #include #include #include @@ -455,70 +450,3 @@ SYSCALL_DEFINE0(ni_syscall) { return -ENOSYS; } - -#ifdef CONFIG_XEN_PV -#ifndef CONFIG_PREEMPTION -/* - * Some hypercalls issued by the toolstack can take many 10s of - * seconds. Allow tasks running hypercalls via the privcmd driver to - * be voluntarily preempted even if full kernel preemption is - * disabled. - * - * Such preemptible hypercalls are bracketed by - * xen_preemptible_hcall_begin() and xen_preemptible_hcall_end() - * calls. - */ -DEFINE_PER_CPU(bool, xen_in_preemptible_hcall); -EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall); - -/* - * In case of scheduling the flag must be cleared and restored after - * returning from schedule as the task might move to a different CPU. - */ -static __always_inline bool get_and_clear_inhcall(void) -{ - bool inhcall =3D __this_cpu_read(xen_in_preemptible_hcall); - - __this_cpu_write(xen_in_preemptible_hcall, false); - return inhcall; -} - -static __always_inline void restore_inhcall(bool inhcall) -{ - __this_cpu_write(xen_in_preemptible_hcall, inhcall); -} -#else -static __always_inline bool get_and_clear_inhcall(void) { return false; } -static __always_inline void restore_inhcall(bool inhcall) { } -#endif - -static void __xen_pv_evtchn_do_upcall(struct pt_regs *regs) -{ - struct pt_regs *old_regs =3D set_irq_regs(regs); - - inc_irq_stat(irq_hv_callback_count); - - xen_evtchn_do_upcall(); - - set_irq_regs(old_regs); -} - -__visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs) -{ - irqentry_state_t state =3D irqentry_enter(regs); - bool inhcall; - - instrumentation_begin(); - run_sysvec_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs); - - inhcall =3D get_and_clear_inhcall(); - if (inhcall && !WARN_ON_ONCE(state.exit_rcu)) { - irqentry_exit_cond_resched(); - instrumentation_end(); - restore_inhcall(inhcall); - } else { - instrumentation_end(); - irqentry_exit(regs, state); - } -} -#endif /* CONFIG_XEN_PV */ diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 5e57835e999d..dcc2041f8e61 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -73,6 +73,7 @@ #include #include #include +#include #ifdef CONFIG_X86_IOPL_IOPERM #include #endif @@ -94,6 +95,44 @@ void *xen_initial_gdt; static int xen_cpu_up_prepare_pv(unsigned int cpu); static int xen_cpu_dead_pv(unsigned int cpu); =20 +#ifndef CONFIG_PREEMPTION +/* + * Some hypercalls issued by the toolstack can take many 10s of + * seconds. Allow tasks running hypercalls via the privcmd driver to + * be voluntarily preempted even if full kernel preemption is + * disabled. + * + * Such preemptible hypercalls are bracketed by + * xen_preemptible_hcall_begin() and xen_preemptible_hcall_end() + * calls. + */ +DEFINE_PER_CPU(bool, xen_in_preemptible_hcall); +EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall); + +/* + * In case of scheduling the flag must be cleared and restored after + * returning from schedule as the task might move to a different CPU. + */ +static __always_inline bool get_and_clear_inhcall(void) +{ + bool inhcall =3D __this_cpu_read(xen_in_preemptible_hcall); + + __this_cpu_write(xen_in_preemptible_hcall, false); + return inhcall; +} + +static __always_inline void restore_inhcall(bool inhcall) +{ + __this_cpu_write(xen_in_preemptible_hcall, inhcall); +} + +#else + +static __always_inline bool get_and_clear_inhcall(void) { return false; } +static __always_inline void restore_inhcall(bool inhcall) { } + +#endif + struct tls_descs { struct desc_struct desc[3]; }; @@ -687,6 +726,36 @@ DEFINE_IDTENTRY_RAW(xenpv_exc_machine_check) } #endif =20 +static void __xen_pv_evtchn_do_upcall(struct pt_regs *regs) +{ + struct pt_regs *old_regs =3D set_irq_regs(regs); + + inc_irq_stat(irq_hv_callback_count); + + xen_evtchn_do_upcall(); + + set_irq_regs(old_regs); +} + +__visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs) +{ + irqentry_state_t state =3D irqentry_enter(regs); + bool inhcall; + + instrumentation_begin(); + run_sysvec_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs); + + inhcall =3D get_and_clear_inhcall(); + if (inhcall && !WARN_ON_ONCE(state.exit_rcu)) { + irqentry_exit_cond_resched(); + instrumentation_end(); + restore_inhcall(inhcall); + } else { + instrumentation_end(); + irqentry_exit(regs, state); + } +} + struct trap_array_entry { void (*orig)(void); void (*xen)(void); --=20 2.48.1 From nobody Wed Dec 17 20:41:18 2025 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F08F20127A for ; Fri, 14 Mar 2025 15:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965158; cv=none; b=UrolzQ4fEapBXiv3PMkfKjVp+LVzB6memfiR9j67HzAsPGcuT1a3ey10L0fz8YuWxZl74+B2ZcIrdDrJnlXBl0dQzTMDWc4Dtkyjokt9Sr2IBE6f5OvtqZv6xB8dcTDP7IMem0z2jgMW0ubHsjZ5D3v1bFXwX8oa3JGI52uVHDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965158; c=relaxed/simple; bh=pm9T5B4sdsYjPRdVC+F1Byq9w2I4k0t06pELg2M6ip8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ADc3S4tXNIWAGNlrXZX22Jne9x1ftkezVGQhgPtXLXg45Vi5SEemn9+6ajYAk4U2GVnj63a/XvUiZ0CTwaIneAovLgjvy32AOP+dKWyjL3SVU8GlhckpTq057OOq7XdAuu+8X2Fujq6L8F2LaeGTqOUMdHi3dGWdvJrTGtvXY/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BF5zAUUl; arc=none smtp.client-ip=209.85.160.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BF5zAUUl" Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-2c68fd223bcso248384fac.1 for ; Fri, 14 Mar 2025 08:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965155; x=1742569955; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S0FTY0BX5cM6RJWpvhp9iEYhwAETiRxOOx2Wrv6MeBw=; b=BF5zAUUlo026yAX+G/uOoQSQuwzH9SbyqAdVI/tBHShKSFV52KeEzfz2O5FIHY72gJ 6QbPeRZfeKTxd0WTpUc3LW7RG2eI/tLFZU3N+ENhPL2MOUO6o4wBARH23cSqXTyWZ8qJ 2KKONNL2YishaPs7niXA+25o41O+wz1aLj4RHLVvsOecADpFcHi2As2Xk1cmDjowvdeP Uva7FRBjIfzfmFO2dEhmHyolrvbph4SIQdSf6LL0Gt03dOac7tidtGSdThibL9Kjr+Hd n4OUfTSH0gcwz+PKgwDLDobsgD5ru1imrirLLy84Mw0O+DYjdcHRa/6bG5QS5WIKeeEE 1dNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965155; x=1742569955; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S0FTY0BX5cM6RJWpvhp9iEYhwAETiRxOOx2Wrv6MeBw=; b=FiFeHYuRRPNPwGjilo/7P0S1uXOhY2QTOc1YTF3kbEk2aCA26Bly0NLVz24C3cSe6L 2oYnCXG2U5xfOY8oWi18zGLxhlBB9HKr5Aoxn5RikRlJFyugUan7BCay6wlm6XvlAQe4 xcCszJCMZDC2A5PxVigwNMwRB1b730OYPltzBCdx8fUa6rYxHNPsvAkqcC9uwtwz70c8 9MzqGoa/eltnRgS53GlagQwsYQ3w4J9U2z1s2h9jtee3VDrFD6ib9KN1QkqWLstQB/aE PzmO2KDZbsYMqrtgRSwC7+2v8WUngsn3lvA8qKvIUS4NFrftnhDtNUexxcWryAuXKGtH ib1w== X-Gm-Message-State: AOJu0Yy1mPZOoT9Na5ollHs+WlOV1w+/IquUzjSBqBY4F9Jw64QGknxa LZBrCZ5638CC/gxDuKqBjginrRmrcbC2tyRroe6ao04G9iw1I6iL+KuH X-Gm-Gg: ASbGncvQe8pvk3Gae7zAccw0/5VznYNCdSZXFZQgDqxFgTjze5mMHd8lJJ75fT1cYOM SUqyw9fgY5HRkSAk7rJYzky6F0lGOKMwE2J8NJbre1bid4R7+8r6cEaIMuDndPInosbpoh1vlcb WmznAE8lRZigXIbWMrSxMpX+KApZawwDyo1hvW/lxBrEsm8kpdHsjC+Q/vSsEQdyKowIJ0oquTY BImjzw3e45yu1rONpBqMMGoqi1EJkFnS8Ylq+xkmhhbyNfNgBg/UhadnHttlG7cy38+FbtNnEKX zZE5n5sgTGMeZCzF0eqrJ7Rixg== X-Google-Smtp-Source: AGHT+IGbJpju3ed7ZV+RQOwJv2DqAbgUJcqJmkXxx9PxT2C5IaC/lyw0dVBbvmSvQuqzwap+wAPx3g== X-Received: by 2002:a05:6870:20f:b0:2c2:4d76:f1a7 with SMTP id 586e51a60fabf-2c69114dcc0mr1412080fac.25.1741965154341; Fri, 14 Mar 2025 08:12:34 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:32 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst Subject: [PATCH v2 2/7] x86/syscall/32: Move 32-bit syscall dispatch code Date: Fri, 14 Mar 2025 11:12:15 -0400 Message-ID: <20250314151220.862768-3-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" Move the 32-bit syscall dispatch code to syscall_32.c. No functional changes. Signed-off-by: Brian Gerst Reviewed-by: Sohil Mehta --- arch/x86/entry/Makefile | 2 + arch/x86/entry/common.c | 321 ----------------------------------- arch/x86/entry/syscall_32.c | 329 +++++++++++++++++++++++++++++++++++- 3 files changed, 329 insertions(+), 323 deletions(-) diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index ce1cc1622385..96a6b86e0a8b 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -8,8 +8,10 @@ UBSAN_SANITIZE :=3D n KCOV_INSTRUMENT :=3D n =20 CFLAGS_REMOVE_common.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_syscall_32.o =3D $(CC_FLAGS_FTRACE) =20 CFLAGS_common.o +=3D -fno-stack-protector +CFLAGS_syscall_32.o +=3D -fno-stack-protector =20 obj-y :=3D entry.o entry_$(BITS).o syscall_$(BITS).o obj-y +=3D common.o diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index ce4d88eda693..183efabefe57 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -125,327 +125,6 @@ __visible noinstr bool do_syscall_64(struct pt_regs *= regs, int nr) } #endif =20 -#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) -static __always_inline int syscall_32_enter(struct pt_regs *regs) -{ - if (IS_ENABLED(CONFIG_IA32_EMULATION)) - current_thread_info()->status |=3D TS_COMPAT; - - return (int)regs->orig_ax; -} - -#ifdef CONFIG_IA32_EMULATION -bool __ia32_enabled __ro_after_init =3D !IS_ENABLED(CONFIG_IA32_EMULATION_= DEFAULT_DISABLED); - -static int __init ia32_emulation_override_cmdline(char *arg) -{ - return kstrtobool(arg, &__ia32_enabled); -} -early_param("ia32_emulation", ia32_emulation_override_cmdline); -#endif - -/* - * Invoke a 32-bit syscall. Called with IRQs on in CT_STATE_KERNEL. - */ -static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs, in= t nr) -{ - /* - * Convert negative numbers to very high and thus out of range - * numbers for comparisons. - */ - unsigned int unr =3D nr; - - if (likely(unr < IA32_NR_syscalls)) { - unr =3D array_index_nospec(unr, IA32_NR_syscalls); - regs->ax =3D ia32_sys_call(regs, unr); - } else if (nr !=3D -1) { - regs->ax =3D __ia32_sys_ni_syscall(regs); - } -} - -#ifdef CONFIG_IA32_EMULATION -static __always_inline bool int80_is_external(void) -{ - const unsigned int offs =3D (0x80 / 32) * 0x10; - const u32 bit =3D BIT(0x80 % 32); - - /* The local APIC on XENPV guests is fake */ - if (cpu_feature_enabled(X86_FEATURE_XENPV)) - return false; - - /* - * If vector 0x80 is set in the APIC ISR then this is an external - * interrupt. Either from broken hardware or injected by a VMM. - * - * Note: In guest mode this is only valid for secure guests where - * the secure module fully controls the vAPIC exposed to the guest. - */ - return apic_read(APIC_ISR + offs) & bit; -} - -/** - * do_int80_emulation - 32-bit legacy syscall C entry from asm - * @regs: syscall arguments in struct pt_args on the stack. - * - * This entry point can be used by 32-bit and 64-bit programs to perform - * 32-bit system calls. Instances of INT $0x80 can be found inline in - * various programs and libraries. It is also used by the vDSO's - * __kernel_vsyscall fallback for hardware that doesn't support a faster - * entry method. Restarted 32-bit system calls also fall back to INT - * $0x80 regardless of what instruction was originally used to do the - * system call. - * - * This is considered a slow path. It is not used by most libc - * implementations on modern hardware except during process startup. - * - * The arguments for the INT $0x80 based syscall are on stack in the - * pt_regs structure: - * eax: system call number - * ebx, ecx, edx, esi, edi, ebp: arg1 - arg 6 - */ -__visible noinstr void do_int80_emulation(struct pt_regs *regs) -{ - int nr; - - /* Kernel does not use INT $0x80! */ - if (unlikely(!user_mode(regs))) { - irqentry_enter(regs); - instrumentation_begin(); - panic("Unexpected external interrupt 0x80\n"); - } - - /* - * Establish kernel context for instrumentation, including for - * int80_is_external() below which calls into the APIC driver. - * Identical for soft and external interrupts. - */ - enter_from_user_mode(regs); - - instrumentation_begin(); - add_random_kstack_offset(); - - /* Validate that this is a soft interrupt to the extent possible */ - if (unlikely(int80_is_external())) - panic("Unexpected external interrupt 0x80\n"); - - /* - * The low level idtentry code pushed -1 into regs::orig_ax - * and regs::ax contains the syscall number. - * - * User tracing code (ptrace or signal handlers) might assume - * that the regs::orig_ax contains a 32-bit number on invoking - * a 32-bit syscall. - * - * Establish the syscall convention by saving the 32bit truncated - * syscall number in regs::orig_ax and by invalidating regs::ax. - */ - regs->orig_ax =3D regs->ax & GENMASK(31, 0); - regs->ax =3D -ENOSYS; - - nr =3D syscall_32_enter(regs); - - local_irq_enable(); - nr =3D syscall_enter_from_user_mode_work(regs, nr); - do_syscall_32_irqs_on(regs, nr); - - instrumentation_end(); - syscall_exit_to_user_mode(regs); -} - -#ifdef CONFIG_X86_FRED -/* - * A FRED-specific INT80 handler is warranted for the follwing reasons: - * - * 1) As INT instructions and hardware interrupts are separate event - * types, FRED does not preclude the use of vector 0x80 for external - * interrupts. As a result, the FRED setup code does not reserve - * vector 0x80 and calling int80_is_external() is not merely - * suboptimal but actively incorrect: it could cause a system call - * to be incorrectly ignored. - * - * 2) It is called only for handling vector 0x80 of event type - * EVENT_TYPE_SWINT and will never be called to handle any external - * interrupt (event type EVENT_TYPE_EXTINT). - * - * 3) FRED has separate entry flows depending on if the event came from - * user space or kernel space, and because the kernel does not use - * INT insns, the FRED kernel entry handler fred_entry_from_kernel() - * falls through to fred_bad_type() if the event type is - * EVENT_TYPE_SWINT, i.e., INT insns. So if the kernel is handling - * an INT insn, it can only be from a user level. - * - * 4) int80_emulation() does a CLEAR_BRANCH_HISTORY. While FRED will - * likely take a different approach if it is ever needed: it - * probably belongs in either fred_intx()/ fred_other() or - * asm_fred_entrypoint_user(), depending on if this ought to be done - * for all entries from userspace or only system - * calls. - * - * 5) INT $0x80 is the fast path for 32-bit system calls under FRED. - */ -DEFINE_FREDENTRY_RAW(int80_emulation) -{ - int nr; - - enter_from_user_mode(regs); - - instrumentation_begin(); - add_random_kstack_offset(); - - /* - * FRED pushed 0 into regs::orig_ax and regs::ax contains the - * syscall number. - * - * User tracing code (ptrace or signal handlers) might assume - * that the regs::orig_ax contains a 32-bit number on invoking - * a 32-bit syscall. - * - * Establish the syscall convention by saving the 32bit truncated - * syscall number in regs::orig_ax and by invalidating regs::ax. - */ - regs->orig_ax =3D regs->ax & GENMASK(31, 0); - regs->ax =3D -ENOSYS; - - nr =3D syscall_32_enter(regs); - - local_irq_enable(); - nr =3D syscall_enter_from_user_mode_work(regs, nr); - do_syscall_32_irqs_on(regs, nr); - - instrumentation_end(); - syscall_exit_to_user_mode(regs); -} -#endif -#else /* CONFIG_IA32_EMULATION */ - -/* Handles int $0x80 on a 32bit kernel */ -__visible noinstr void do_int80_syscall_32(struct pt_regs *regs) -{ - int nr =3D syscall_32_enter(regs); - - add_random_kstack_offset(); - /* - * Subtlety here: if ptrace pokes something larger than 2^31-1 into - * orig_ax, the int return value truncates it. This matches - * the semantics of syscall_get_nr(). - */ - nr =3D syscall_enter_from_user_mode(regs, nr); - instrumentation_begin(); - - do_syscall_32_irqs_on(regs, nr); - - instrumentation_end(); - syscall_exit_to_user_mode(regs); -} -#endif /* !CONFIG_IA32_EMULATION */ - -static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) -{ - int nr =3D syscall_32_enter(regs); - int res; - - add_random_kstack_offset(); - /* - * This cannot use syscall_enter_from_user_mode() as it has to - * fetch EBP before invoking any of the syscall entry work - * functions. - */ - syscall_enter_from_user_mode_prepare(regs); - - instrumentation_begin(); - /* Fetch EBP from where the vDSO stashed it. */ - if (IS_ENABLED(CONFIG_X86_64)) { - /* - * Micro-optimization: the pointer we're following is - * explicitly 32 bits, so it can't be out of range. - */ - res =3D __get_user(*(u32 *)®s->bp, - (u32 __user __force *)(unsigned long)(u32)regs->sp); - } else { - res =3D get_user(*(u32 *)®s->bp, - (u32 __user __force *)(unsigned long)(u32)regs->sp); - } - - if (res) { - /* User code screwed up. */ - regs->ax =3D -EFAULT; - - local_irq_disable(); - instrumentation_end(); - irqentry_exit_to_user_mode(regs); - return false; - } - - nr =3D syscall_enter_from_user_mode_work(regs, nr); - - /* Now this is just like a normal syscall. */ - do_syscall_32_irqs_on(regs, nr); - - instrumentation_end(); - syscall_exit_to_user_mode(regs); - return true; -} - -/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */ -__visible noinstr bool do_fast_syscall_32(struct pt_regs *regs) -{ - /* - * Called using the internal vDSO SYSENTER/SYSCALL32 calling - * convention. Adjust regs so it looks like we entered using int80. - */ - unsigned long landing_pad =3D (unsigned long)current->mm->context.vdso + - vdso_image_32.sym_int80_landing_pad; - - /* - * SYSENTER loses EIP, and even SYSCALL32 needs us to skip forward - * so that 'regs->ip -=3D 2' lands back on an int $0x80 instruction. - * Fix it up. - */ - regs->ip =3D landing_pad; - - /* Invoke the syscall. If it failed, keep it simple: use IRET. */ - if (!__do_fast_syscall_32(regs)) - return false; - - /* - * Check that the register state is valid for using SYSRETL/SYSEXIT - * to exit to userspace. Otherwise use the slower but fully capable - * IRET exit path. - */ - - /* XEN PV guests always use the IRET path */ - if (cpu_feature_enabled(X86_FEATURE_XENPV)) - return false; - - /* EIP must point to the VDSO landing pad */ - if (unlikely(regs->ip !=3D landing_pad)) - return false; - - /* CS and SS must match the values set in MSR_STAR */ - if (unlikely(regs->cs !=3D __USER32_CS || regs->ss !=3D __USER_DS)) - return false; - - /* If the TF, RF, or VM flags are set, use IRET */ - if (unlikely(regs->flags & (X86_EFLAGS_RF | X86_EFLAGS_TF | X86_EFLAGS_VM= ))) - return false; - - /* Use SYSRETL/SYSEXIT to exit to userspace */ - return true; -} - -/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */ -__visible noinstr bool do_SYSENTER_32(struct pt_regs *regs) -{ - /* SYSENTER loses RSP, but the vDSO saved it in RBP. */ - regs->sp =3D regs->bp; - - /* SYSENTER clobbers EFLAGS.IF. Assume it was set in usermode. */ - regs->flags |=3D X86_EFLAGS_IF; - - return do_fast_syscall_32(regs); -} -#endif - SYSCALL_DEFINE0(ni_syscall) { return -ENOSYS; diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c index 8cc9950d7104..06b9df10f2f8 100644 --- a/arch/x86/entry/syscall_32.c +++ b/arch/x86/entry/syscall_32.c @@ -1,10 +1,16 @@ -// SPDX-License-Identifier: GPL-2.0 -/* System call table for i386. */ +// SPDX-License-Identifier: GPL-2.0-only +/* 32-bit system call dispatch */ =20 #include #include #include #include +#include +#include +#include +#include +#include +#include #include =20 #ifdef CONFIG_IA32_EMULATION @@ -42,3 +48,322 @@ long ia32_sys_call(const struct pt_regs *regs, unsigned= int nr) default: return __ia32_sys_ni_syscall(regs); } }; + +static __always_inline int syscall_32_enter(struct pt_regs *regs) +{ + if (IS_ENABLED(CONFIG_IA32_EMULATION)) + current_thread_info()->status |=3D TS_COMPAT; + + return (int)regs->orig_ax; +} + +#ifdef CONFIG_IA32_EMULATION +bool __ia32_enabled __ro_after_init =3D !IS_ENABLED(CONFIG_IA32_EMULATION_= DEFAULT_DISABLED); + +static int __init ia32_emulation_override_cmdline(char *arg) +{ + return kstrtobool(arg, &__ia32_enabled); +} +early_param("ia32_emulation", ia32_emulation_override_cmdline); +#endif + +/* + * Invoke a 32-bit syscall. Called with IRQs on in CT_STATE_KERNEL. + */ +static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs, in= t nr) +{ + /* + * Convert negative numbers to very high and thus out of range + * numbers for comparisons. + */ + unsigned int unr =3D nr; + + if (likely(unr < IA32_NR_syscalls)) { + unr =3D array_index_nospec(unr, IA32_NR_syscalls); + regs->ax =3D ia32_sys_call(regs, unr); + } else if (nr !=3D -1) { + regs->ax =3D __ia32_sys_ni_syscall(regs); + } +} + +#ifdef CONFIG_IA32_EMULATION +static __always_inline bool int80_is_external(void) +{ + const unsigned int offs =3D (0x80 / 32) * 0x10; + const u32 bit =3D BIT(0x80 % 32); + + /* The local APIC on XENPV guests is fake */ + if (cpu_feature_enabled(X86_FEATURE_XENPV)) + return false; + + /* + * If vector 0x80 is set in the APIC ISR then this is an external + * interrupt. Either from broken hardware or injected by a VMM. + * + * Note: In guest mode this is only valid for secure guests where + * the secure module fully controls the vAPIC exposed to the guest. + */ + return apic_read(APIC_ISR + offs) & bit; +} + +/** + * do_int80_emulation - 32-bit legacy syscall C entry from asm + * @regs: syscall arguments in struct pt_args on the stack. + * + * This entry point can be used by 32-bit and 64-bit programs to perform + * 32-bit system calls. Instances of INT $0x80 can be found inline in + * various programs and libraries. It is also used by the vDSO's + * __kernel_vsyscall fallback for hardware that doesn't support a faster + * entry method. Restarted 32-bit system calls also fall back to INT + * $0x80 regardless of what instruction was originally used to do the + * system call. + * + * This is considered a slow path. It is not used by most libc + * implementations on modern hardware except during process startup. + * + * The arguments for the INT $0x80 based syscall are on stack in the + * pt_regs structure: + * eax: system call number + * ebx, ecx, edx, esi, edi, ebp: arg1 - arg 6 + */ +__visible noinstr void do_int80_emulation(struct pt_regs *regs) +{ + int nr; + + /* Kernel does not use INT $0x80! */ + if (unlikely(!user_mode(regs))) { + irqentry_enter(regs); + instrumentation_begin(); + panic("Unexpected external interrupt 0x80\n"); + } + + /* + * Establish kernel context for instrumentation, including for + * int80_is_external() below which calls into the APIC driver. + * Identical for soft and external interrupts. + */ + enter_from_user_mode(regs); + + instrumentation_begin(); + add_random_kstack_offset(); + + /* Validate that this is a soft interrupt to the extent possible */ + if (unlikely(int80_is_external())) + panic("Unexpected external interrupt 0x80\n"); + + /* + * The low level idtentry code pushed -1 into regs::orig_ax + * and regs::ax contains the syscall number. + * + * User tracing code (ptrace or signal handlers) might assume + * that the regs::orig_ax contains a 32-bit number on invoking + * a 32-bit syscall. + * + * Establish the syscall convention by saving the 32bit truncated + * syscall number in regs::orig_ax and by invalidating regs::ax. + */ + regs->orig_ax =3D regs->ax & GENMASK(31, 0); + regs->ax =3D -ENOSYS; + + nr =3D syscall_32_enter(regs); + + local_irq_enable(); + nr =3D syscall_enter_from_user_mode_work(regs, nr); + do_syscall_32_irqs_on(regs, nr); + + instrumentation_end(); + syscall_exit_to_user_mode(regs); +} + +#ifdef CONFIG_X86_FRED +/* + * A FRED-specific INT80 handler is warranted for the follwing reasons: + * + * 1) As INT instructions and hardware interrupts are separate event + * types, FRED does not preclude the use of vector 0x80 for external + * interrupts. As a result, the FRED setup code does not reserve + * vector 0x80 and calling int80_is_external() is not merely + * suboptimal but actively incorrect: it could cause a system call + * to be incorrectly ignored. + * + * 2) It is called only for handling vector 0x80 of event type + * EVENT_TYPE_SWINT and will never be called to handle any external + * interrupt (event type EVENT_TYPE_EXTINT). + * + * 3) FRED has separate entry flows depending on if the event came from + * user space or kernel space, and because the kernel does not use + * INT insns, the FRED kernel entry handler fred_entry_from_kernel() + * falls through to fred_bad_type() if the event type is + * EVENT_TYPE_SWINT, i.e., INT insns. So if the kernel is handling + * an INT insn, it can only be from a user level. + * + * 4) int80_emulation() does a CLEAR_BRANCH_HISTORY. While FRED will + * likely take a different approach if it is ever needed: it + * probably belongs in either fred_intx()/ fred_other() or + * asm_fred_entrypoint_user(), depending on if this ought to be done + * for all entries from userspace or only system + * calls. + * + * 5) INT $0x80 is the fast path for 32-bit system calls under FRED. + */ +DEFINE_FREDENTRY_RAW(int80_emulation) +{ + int nr; + + enter_from_user_mode(regs); + + instrumentation_begin(); + add_random_kstack_offset(); + + /* + * FRED pushed 0 into regs::orig_ax and regs::ax contains the + * syscall number. + * + * User tracing code (ptrace or signal handlers) might assume + * that the regs::orig_ax contains a 32-bit number on invoking + * a 32-bit syscall. + * + * Establish the syscall convention by saving the 32bit truncated + * syscall number in regs::orig_ax and by invalidating regs::ax. + */ + regs->orig_ax =3D regs->ax & GENMASK(31, 0); + regs->ax =3D -ENOSYS; + + nr =3D syscall_32_enter(regs); + + local_irq_enable(); + nr =3D syscall_enter_from_user_mode_work(regs, nr); + do_syscall_32_irqs_on(regs, nr); + + instrumentation_end(); + syscall_exit_to_user_mode(regs); +} +#endif +#else /* CONFIG_IA32_EMULATION */ + +/* Handles int $0x80 on a 32bit kernel */ +__visible noinstr void do_int80_syscall_32(struct pt_regs *regs) +{ + int nr =3D syscall_32_enter(regs); + + add_random_kstack_offset(); + /* + * Subtlety here: if ptrace pokes something larger than 2^31-1 into + * orig_ax, the int return value truncates it. This matches + * the semantics of syscall_get_nr(). + */ + nr =3D syscall_enter_from_user_mode(regs, nr); + instrumentation_begin(); + + do_syscall_32_irqs_on(regs, nr); + + instrumentation_end(); + syscall_exit_to_user_mode(regs); +} +#endif /* !CONFIG_IA32_EMULATION */ + +static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) +{ + int nr =3D syscall_32_enter(regs); + int res; + + add_random_kstack_offset(); + /* + * This cannot use syscall_enter_from_user_mode() as it has to + * fetch EBP before invoking any of the syscall entry work + * functions. + */ + syscall_enter_from_user_mode_prepare(regs); + + instrumentation_begin(); + /* Fetch EBP from where the vDSO stashed it. */ + if (IS_ENABLED(CONFIG_X86_64)) { + /* + * Micro-optimization: the pointer we're following is + * explicitly 32 bits, so it can't be out of range. + */ + res =3D __get_user(*(u32 *)®s->bp, + (u32 __user __force *)(unsigned long)(u32)regs->sp); + } else { + res =3D get_user(*(u32 *)®s->bp, + (u32 __user __force *)(unsigned long)(u32)regs->sp); + } + + if (res) { + /* User code screwed up. */ + regs->ax =3D -EFAULT; + + local_irq_disable(); + instrumentation_end(); + irqentry_exit_to_user_mode(regs); + return false; + } + + nr =3D syscall_enter_from_user_mode_work(regs, nr); + + /* Now this is just like a normal syscall. */ + do_syscall_32_irqs_on(regs, nr); + + instrumentation_end(); + syscall_exit_to_user_mode(regs); + return true; +} + +/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */ +__visible noinstr bool do_fast_syscall_32(struct pt_regs *regs) +{ + /* + * Called using the internal vDSO SYSENTER/SYSCALL32 calling + * convention. Adjust regs so it looks like we entered using int80. + */ + unsigned long landing_pad =3D (unsigned long)current->mm->context.vdso + + vdso_image_32.sym_int80_landing_pad; + + /* + * SYSENTER loses EIP, and even SYSCALL32 needs us to skip forward + * so that 'regs->ip -=3D 2' lands back on an int $0x80 instruction. + * Fix it up. + */ + regs->ip =3D landing_pad; + + /* Invoke the syscall. If it failed, keep it simple: use IRET. */ + if (!__do_fast_syscall_32(regs)) + return false; + + /* + * Check that the register state is valid for using SYSRETL/SYSEXIT + * to exit to userspace. Otherwise use the slower but fully capable + * IRET exit path. + */ + + /* XEN PV guests always use the IRET path */ + if (cpu_feature_enabled(X86_FEATURE_XENPV)) + return false; + + /* EIP must point to the VDSO landing pad */ + if (unlikely(regs->ip !=3D landing_pad)) + return false; + + /* CS and SS must match the values set in MSR_STAR */ + if (unlikely(regs->cs !=3D __USER32_CS || regs->ss !=3D __USER_DS)) + return false; + + /* If the TF, RF, or VM flags are set, use IRET */ + if (unlikely(regs->flags & (X86_EFLAGS_RF | X86_EFLAGS_TF | X86_EFLAGS_VM= ))) + return false; + + /* Use SYSRETL/SYSEXIT to exit to userspace */ + return true; +} + +/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */ +__visible noinstr bool do_SYSENTER_32(struct pt_regs *regs) +{ + /* SYSENTER loses RSP, but the vDSO saved it in RBP. */ + regs->sp =3D regs->bp; + + /* SYSENTER clobbers EFLAGS.IF. Assume it was set in usermode. */ + regs->flags |=3D X86_EFLAGS_IF; + + return do_fast_syscall_32(regs); +} --=20 2.48.1 From nobody Wed Dec 17 20:41:18 2025 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4274720126B for ; Fri, 14 Mar 2025 15:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965161; cv=none; b=U1qtmSRGHZbJr3rKrJGBt7LY6EZxEZgZ9hjzLf6PE4DfiRrFUfD6RNggBrqzMPYn58oQgqsNQ0e0UNxNckcNKW3dpr8K8ixgEfGmRavsRc2+TjNzAiwBuT3QD/hEe+lH1s3kZpf7KE26heHYV4bBWUXtSts8I5l9gTWD3pegGkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965161; c=relaxed/simple; bh=UcPYSY91IwtgOB4ai8MToI7AlvlP3dEP0pcPPdj1U+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F1kagQfOzxtUyYZdIoXTXkWSf6BN7mENTJgWhXbbcPRqnqKKQ1dafLlUnQ9H9zR7J5fQZuvEpcpCf3uqoHoIyx433eGnPM/dELAKh70G0ex4QbppDomX2s5dNG0V8Utu9yyByA2uXUBnd6yNolbFOF9KTlRYXoqEvTsG6dXr5yk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=j8NKbJJR; arc=none smtp.client-ip=209.85.160.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j8NKbJJR" Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-2bcbd92d5dbso1187530fac.2 for ; Fri, 14 Mar 2025 08:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965157; x=1742569957; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d6+HafW/MGgyXYgn6+okE7Xm8nys/EIGKCy6LM/Z9VQ=; b=j8NKbJJR1hs6VX8+4iG1/dFCqzY+pCO5xiWZHV/WMdYjp9EPI1YMSOCxmTZrPuzXwY rXQTlNPRUdTwb3JC+FKSshHbTf0AS5rYyhxaMbdv+q4KdUqKZxvR9dq7jY8ENk/btaga /G4GNUIJncqPvTqOy6Zg6wgIrvTCwpHKWlMDABI5SDTMOppZpOlLbEhH7nN7B8iQVyZl pI8H1XoUJzBwVlUtETwQb1cMpG//wpkyqwGq1cha8uOhX7kYXIGmJyEF2eUr4FK9f5kz CdJNGPp2umbXiVLWljaN6TJrSmoDkyoxJknFmClPJAxvFYIDpO9IS6cW78YeHzeKoudo 8MDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965157; x=1742569957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d6+HafW/MGgyXYgn6+okE7Xm8nys/EIGKCy6LM/Z9VQ=; b=lbRQEKkse0toVvLulTARcpOjFpFj5JieKjnX+XlTnGAse6QjXqJ8V1aIHtjakW2V8+ 1B5lBr+bWK/UEPen5g+iO1ZVraIHpi1LTop0xpMFaP/4Dr6jAbXBxSMIsbVdAPGjUaDj J/UOD7Jg8QIb52VTexNKcYHYi7bOi9u6tQW/lBZxFSiNEhHkYAxZ17hrzqJZCljzFRMU DAUlU08qFyCB9/TAUFOQUD41MQdpyZHmPGzoaE8e8cw5m4LI+N33VAElfVkXTEM+ljrd 85RE/agL+iqQY0sMHd4YGYwLSc7S8eDtUJyZoETdWHRs7gS4/O4jCiLmTvemgt7G+oxa 7Csw== X-Gm-Message-State: AOJu0YzECx8nE4ZOjwtUoYeLyN1GE5wqczmRUo7C8+SBf1uLLapVf02P YDPaOiSXv5DCQG8d1Fm/GwBtMG/wFFpRmr2hDsNHB9lFILzWNJw9DSsr X-Gm-Gg: ASbGncuDzQ4cikl+l7i14aMZ0CNySmkWaobU+nYe4aigvqo3jXWrvCGpRROG93mfqp1 2Gy9n/RvFEIe4KhK8Hi5skWaBSoSTuMxZzHEf4blENqEIUTY/DA4oxWMAJiZGi93yyoVGUxRIi6 jM2KyNWAYNtOPUNlobbL5C7Lv2hcEqgDp26DFCuIo+v8nvVjePX1my1kXgYA8b03kiEXPz9RrVI eiDKGjZtBtX7iKQGW0U5b9fPncDzQIJ8xOcyALD520yuCA1fiM1uUdanZ99bDjVh1cdguuq6os6 rzr8BHnnVhDoe3CzVXw+OnC1aA== X-Google-Smtp-Source: AGHT+IFD1CaGE2RpgNu5GsbuoCgB4ZtYsC59fwHSOWQMUaE0J9WqCjkeGqQqVqVEV6GTJt5HFWIjwQ== X-Received: by 2002:a05:6871:6017:b0:261:16da:decb with SMTP id 586e51a60fabf-2c690f3c1c4mr1465210fac.11.1741965157525; Fri, 14 Mar 2025 08:12:37 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:36 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst Subject: [PATCH v2 3/7] x86/syscall/64: Move 64-bit syscall dispatch code Date: Fri, 14 Mar 2025 11:12:16 -0400 Message-ID: <20250314151220.862768-4-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" Move the 64-bit syscall dispatch code to syscall_64.c. No functional changes. Signed-off-by: Brian Gerst Reviewed-by: Sohil Mehta --- arch/x86/entry/Makefile | 2 + arch/x86/entry/common.c | 93 ----------------------------------- arch/x86/entry/syscall_64.c | 96 ++++++++++++++++++++++++++++++++++++- 3 files changed, 96 insertions(+), 95 deletions(-) diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index 96a6b86e0a8b..5fd28abfd5a0 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -9,9 +9,11 @@ KCOV_INSTRUMENT :=3D n =20 CFLAGS_REMOVE_common.o =3D $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_syscall_32.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_syscall_64.o =3D $(CC_FLAGS_FTRACE) =20 CFLAGS_common.o +=3D -fno-stack-protector CFLAGS_syscall_32.o +=3D -fno-stack-protector +CFLAGS_syscall_64.o +=3D -fno-stack-protector =20 obj-y :=3D entry.o entry_$(BITS).o syscall_$(BITS).o obj-y +=3D common.o diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 183efabefe57..5bd448c0664f 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -32,99 +32,6 @@ #include #include =20 -#ifdef CONFIG_X86_64 - -static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr) -{ - /* - * Convert negative numbers to very high and thus out of range - * numbers for comparisons. - */ - unsigned int unr =3D nr; - - if (likely(unr < NR_syscalls)) { - unr =3D array_index_nospec(unr, NR_syscalls); - regs->ax =3D x64_sys_call(regs, unr); - return true; - } - return false; -} - -static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr) -{ - /* - * Adjust the starting offset of the table, and convert numbers - * < __X32_SYSCALL_BIT to very high and thus out of range - * numbers for comparisons. - */ - unsigned int xnr =3D nr - __X32_SYSCALL_BIT; - - if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { - xnr =3D array_index_nospec(xnr, X32_NR_syscalls); - regs->ax =3D x32_sys_call(regs, xnr); - return true; - } - return false; -} - -/* Returns true to return using SYSRET, or false to use IRET */ -__visible noinstr bool do_syscall_64(struct pt_regs *regs, int nr) -{ - add_random_kstack_offset(); - nr =3D syscall_enter_from_user_mode(regs, nr); - - instrumentation_begin(); - - if (!do_syscall_x64(regs, nr) && !do_syscall_x32(regs, nr) && nr !=3D -1)= { - /* Invalid system call, but still a system call. */ - regs->ax =3D __x64_sys_ni_syscall(regs); - } - - instrumentation_end(); - syscall_exit_to_user_mode(regs); - - /* - * Check that the register state is valid for using SYSRET to exit - * to userspace. Otherwise use the slower but fully capable IRET - * exit path. - */ - - /* XEN PV guests always use the IRET path */ - if (cpu_feature_enabled(X86_FEATURE_XENPV)) - return false; - - /* SYSRET requires RCX =3D=3D RIP and R11 =3D=3D EFLAGS */ - if (unlikely(regs->cx !=3D regs->ip || regs->r11 !=3D regs->flags)) - return false; - - /* CS and SS must match the values set in MSR_STAR */ - if (unlikely(regs->cs !=3D __USER_CS || regs->ss !=3D __USER_DS)) - return false; - - /* - * On Intel CPUs, SYSRET with non-canonical RCX/RIP will #GP - * in kernel space. This essentially lets the user take over - * the kernel, since userspace controls RSP. - * - * TASK_SIZE_MAX covers all user-accessible addresses other than - * the deprecated vsyscall page. - */ - if (unlikely(regs->ip >=3D TASK_SIZE_MAX)) - return false; - - /* - * SYSRET cannot restore RF. It can restore TF, but unlike IRET, - * restoring TF results in a trap from userspace immediately after - * SYSRET. - */ - if (unlikely(regs->flags & (X86_EFLAGS_RF | X86_EFLAGS_TF))) - return false; - - /* Use SYSRET to exit to userspace */ - return true; -} -#endif - SYSCALL_DEFINE0(ni_syscall) { return -ENOSYS; diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index ba8354424860..e0c62d5a397c 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -1,10 +1,12 @@ -// SPDX-License-Identifier: GPL-2.0 -/* System call table for x86-64. */ +// SPDX-License-Identifier: GPL-2.0-only +/* 64-bit system call dispatch */ =20 #include #include #include #include +#include +#include #include =20 #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); @@ -34,3 +36,93 @@ long x64_sys_call(const struct pt_regs *regs, unsigned i= nt nr) default: return __x64_sys_ni_syscall(regs); } }; + +static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr) +{ + /* + * Convert negative numbers to very high and thus out of range + * numbers for comparisons. + */ + unsigned int unr =3D nr; + + if (likely(unr < NR_syscalls)) { + unr =3D array_index_nospec(unr, NR_syscalls); + regs->ax =3D x64_sys_call(regs, unr); + return true; + } + return false; +} + +static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr) +{ + /* + * Adjust the starting offset of the table, and convert numbers + * < __X32_SYSCALL_BIT to very high and thus out of range + * numbers for comparisons. + */ + unsigned int xnr =3D nr - __X32_SYSCALL_BIT; + + if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { + xnr =3D array_index_nospec(xnr, X32_NR_syscalls); + regs->ax =3D x32_sys_call(regs, xnr); + return true; + } + return false; +} + +/* Returns true to return using SYSRET, or false to use IRET */ +__visible noinstr bool do_syscall_64(struct pt_regs *regs, int nr) +{ + add_random_kstack_offset(); + nr =3D syscall_enter_from_user_mode(regs, nr); + + instrumentation_begin(); + + if (!do_syscall_x64(regs, nr) && !do_syscall_x32(regs, nr) && nr !=3D -1)= { + /* Invalid system call, but still a system call. */ + regs->ax =3D __x64_sys_ni_syscall(regs); + } + + instrumentation_end(); + syscall_exit_to_user_mode(regs); + + /* + * Check that the register state is valid for using SYSRET to exit + * to userspace. Otherwise use the slower but fully capable IRET + * exit path. + */ + + /* XEN PV guests always use the IRET path */ + if (cpu_feature_enabled(X86_FEATURE_XENPV)) + return false; + + /* SYSRET requires RCX =3D=3D RIP and R11 =3D=3D EFLAGS */ + if (unlikely(regs->cx !=3D regs->ip || regs->r11 !=3D regs->flags)) + return false; + + /* CS and SS must match the values set in MSR_STAR */ + if (unlikely(regs->cs !=3D __USER_CS || regs->ss !=3D __USER_DS)) + return false; + + /* + * On Intel CPUs, SYSRET with non-canonical RCX/RIP will #GP + * in kernel space. This essentially lets the user take over + * the kernel, since userspace controls RSP. + * + * TASK_SIZE_MAX covers all user-accessible addresses other than + * the deprecated vsyscall page. + */ + if (unlikely(regs->ip >=3D TASK_SIZE_MAX)) + return false; + + /* + * SYSRET cannot restore RF. It can restore TF, but unlike IRET, + * restoring TF results in a trap from userspace immediately after + * SYSRET. + */ + if (unlikely(regs->flags & (X86_EFLAGS_RF | X86_EFLAGS_TF))) + return false; + + /* Use SYSRET to exit to userspace */ + return true; +} --=20 2.48.1 From nobody Wed Dec 17 20:41:18 2025 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 031DF20299A for ; Fri, 14 Mar 2025 15:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965163; cv=none; b=bcVSbS3nQpoPce8bCdfoeHDt2Jo/70Hfbueyw9IM+xQFzEqopxId2ssWLQ5kGIcbfk32j7BgZPwZq77ZWaByvCoHV4noA2umH23NLgbYS9laYijwj9mu0kvFtVpoSRL0VQ6hAbQFNC9FEMsn3Ueszc9G5tl4u3RcjlJw/HfplU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965163; c=relaxed/simple; bh=sas9Ug/riFyXIKbTfKxtLCM2Iclr6aWcnrwxaMWMiKI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HAGvQ63ENTbK7FJrNb5lEXj7xx7aZWPuJeJpMUBX0JEzgrAGzds+d3pznTJnqXnn/HaGvNjM/5g1sfnkncpnpkD3pGXiesrTbj2QCI74RDyuKX97H3j29ryR7lSdihOOtv5sTNTPUl2W9DOx1ZmKg/DezF8hmGX+8u1YqgX765o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O5O4o9K6; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O5O4o9K6" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-72bbd3a3928so414467a34.2 for ; Fri, 14 Mar 2025 08:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965161; x=1742569961; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9F5BBXrLUjRxyzY0tkrR6J3ro2XGDN/sMXDBFq6KU5Q=; b=O5O4o9K6oB6jQcl4SDMnQkXqTCkM6Ma5+6T3MQpAvbS8WPz0cMhfc5WXXQ/o7/uUqc r1zMN94Vi//FGDhvf2XqxTNosQztLtHNYE9djqHqlN6ApaA7AFsGbl4mT+7Lh2nckszL RL+lnudCA0qD8UO6ioWfZhEraQZqOGqxUPV0hr1GpouZJtVZI6/SU7u/Fc/OdhtlVY2i bLmMo+t/yLzaN9plP6lG5X1axoJpzWbAIZrU8GAYB3yMscNCyd5AF6lxwEoHfPuiyYFK uXbwYbe1HmjHPLOYS12nFWad4Rp3D4hxTTlnLbQqS8co+DO+idW/OF9oLVcH8FPkTlEH y5Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965161; x=1742569961; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9F5BBXrLUjRxyzY0tkrR6J3ro2XGDN/sMXDBFq6KU5Q=; b=qYIdQc+7dJUqSE6bIGVS4PEAsFewE+PWX9elLYsyQeHzWM5Hu5fQTMsGuK7h6p1chx CVzG38pUgvgonTIyIfNYgrTTxUTnPLS9Te1+fhggz1naRzRSym65UwVXc13nFAbJf+zf 4i3gcoDSpp7vTMhjwxWgCddITkBsB0o8BhaPZqVNepqV/g49OzL210lMIDkXfGsf+Ud/ I7LCvP8Yiv1JovTWuCAlFOubpoXvamqHpV0RwxfwLcte8WI5ovAWEApRYcP1kB7F1nft 4df60XH/0xdQ9m9Gt+ZlheD4s/tsOFYy86p+G4vAHjx1QUI1RRP9YKZRqCzytgA0cTNz JlSA== X-Gm-Message-State: AOJu0Yx89kEwrLtVKzzFhd3PBdgK8LZFbYwRYIgAJhOezxvQiCJUE131 0oUcZGYfJdGZ8+n/V+3Vrp7VierS/1lbQ2sK6SxKUU7C4vosztZYRCoe X-Gm-Gg: ASbGncunnJ75PD25DrvEHjjtFcj1hXo5UN9JdIAY1z7gduSepgnbz4xL8Aq45q314Jj A/pgo7ksH5BqqV3N98lCI4owQAVX9m6MZLknpMTYBMX+l49PlIUCV6pA0cmRy+qyYdOSQS45b7w 1Slj03ORS3SMPLpbdtTQMbpI4wiuMIeL3649ueFEogqIuP7syYKqbjf4YyyJpGHOzn4krm2CCMJ jtS8KM3meTH2lYSfMH29aI6rQlnVe46AGP2/ImMpZq9MQH0b4dc+KLTruAoedm3XwjXx8aODKqd 3wfnNfMPWXggM0JAD2l51Ybv0c9ATDiangFg X-Google-Smtp-Source: AGHT+IGV1Xe//W6ld93j5vPoE0yoRrQCRf4SEVnlQ0VJ+baGBRTg72jQKkhvLvzZ34GZ62urDen4gA== X-Received: by 2002:a05:6830:3498:b0:72b:9387:84be with SMTP id 46e09a7af769-72bbc245665mr1321993a34.1.1741965160772; Fri, 14 Mar 2025 08:12:40 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:39 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst Subject: [PATCH v2 4/7] x86/syscall/x32: Move x32 syscall table Date: Fri, 14 Mar 2025 11:12:17 -0400 Message-ID: <20250314151220.862768-5-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" Since commit: 2e958a8a510d ("x86/entry/x32: Rename __x32_compat_sys_* to __x64_compat_sys_*"), the ABI prefix for x32 syscalls is the same as native 64-bit syscalls. Move the x32 syscall table to syscall_64.c No functional changes. Signed-off-by: Brian Gerst Reviewed-by: Sohil Mehta --- arch/x86/entry/Makefile | 1 - arch/x86/entry/syscall_64.c | 13 +++++++++++++ arch/x86/entry/syscall_x32.c | 25 ------------------------- 3 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 arch/x86/entry/syscall_x32.c diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index 5fd28abfd5a0..e870f8aa936c 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -27,4 +27,3 @@ CFLAGS_REMOVE_entry_fred.o +=3D -pg $(CC_FLAGS_FTRACE) obj-$(CONFIG_X86_FRED) +=3D entry_64_fred.o entry_fred.o =20 obj-$(CONFIG_IA32_EMULATION) +=3D entry_64_compat.o syscall_32.o -obj-$(CONFIG_X86_X32_ABI) +=3D syscall_x32.o diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index e0c62d5a397c..a05f7be8a0e2 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -12,6 +12,9 @@ #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); #define __SYSCALL_NORETURN(nr, sym) extern long __noreturn __x64_##sym(con= st struct pt_regs *); #include +#ifdef CONFIG_X86_X32_ABI +#include +#endif #undef __SYSCALL =20 #undef __SYSCALL_NORETURN @@ -37,6 +40,16 @@ long x64_sys_call(const struct pt_regs *regs, unsigned i= nt nr) } }; =20 +#ifdef CONFIG_X86_X32_ABI +long x32_sys_call(const struct pt_regs *regs, unsigned int nr) +{ + switch (nr) { + #include + default: return __x64_sys_ni_syscall(regs); + } +}; +#endif + static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr) { /* diff --git a/arch/x86/entry/syscall_x32.c b/arch/x86/entry/syscall_x32.c deleted file mode 100644 index fb77908f44f3..000000000000 --- a/arch/x86/entry/syscall_x32.c +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* System call table for x32 ABI. */ - -#include -#include -#include -#include -#include - -#define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); -#define __SYSCALL_NORETURN(nr, sym) extern long __noreturn __x64_##sym(con= st struct pt_regs *); -#include -#undef __SYSCALL - -#undef __SYSCALL_NORETURN -#define __SYSCALL_NORETURN __SYSCALL - -#define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs); -long x32_sys_call(const struct pt_regs *regs, unsigned int nr) -{ - switch (nr) { - #include - default: return __x64_sys_ni_syscall(regs); - } -}; --=20 2.48.1 From nobody Wed Dec 17 20:41:18 2025 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 762AB202C33 for ; Fri, 14 Mar 2025 15:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965165; cv=none; b=nYeCRL0xHg4nBbfAAggnpLAmDAXr6keBZxvcP0PyHzQ/hiH7e0JT8soKR5B+HSBizZGXpkQbr+cr1Hm1FbrFy7qqEgV4f2vzF6O+HdzgINzI5m1T6gC4YcYfKgzVmfBtiHwqhBBbQ98GOqqB4YSY/0Wik8cJGU78nNOJ/8chLe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965165; c=relaxed/simple; bh=KfIUC6vHrnWsZFhqX8PmZ3NcRke3NRhejMT28SIgMmo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jK0gt0ff+rD/HSrIHE1gO3DLlyHeQIOZf24Gg+pI4JSKhmB6zZfTUba4pQljO2M3Xoufor7I+FGxieHylJsYjb3wyzsMTcT+YuzpPwc/kWK5rk565Tr+Po9VX6meejDGdDTz9TsbvDg3QLt+8PJuHeF1JntyfhNZx7/NvOmlLAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y3lM2exS; arc=none smtp.client-ip=209.85.160.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y3lM2exS" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-2c12f9e9449so1141977fac.3 for ; Fri, 14 Mar 2025 08:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965162; x=1742569962; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zhSNGE7xuts5hKV7orGt15bPAyx5e48naMNL2aOpQTE=; b=Y3lM2exSCM3XW7XELikAdqNJFlNSXGGwLsa/7YaJtf+2zpTx05a5DUfXGveDJNnF0N cYQ27j/pLSfxZW7HKVIvAuX9vk9VaauB33bnO7X3xiJvsbr2jsWGy8OjkiMmP931XNka /mbQguHOCQiMwsFO1w+McmwPc2DJqY3GcOeI35Lk6JM4dgxF5n0xi3eVMZDhdBdW/sYx r7eCJRqUH/ilHZN5KxfhZOUfU5attZEJnFf6DF+HK8jyLqMjMzVhi+SkJukTtMvRbo8I FDJzWdQoyMfDJbjo5OnmEGRr3n9ZQCLp6xhpTCOuGS9FQHhgclcYTJN8Txw0oJQzApkE wx8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965162; x=1742569962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zhSNGE7xuts5hKV7orGt15bPAyx5e48naMNL2aOpQTE=; b=aDF2WpKLCQ+DoYFNDw8LZ2/VC90o+V+o2kt1lPdM9BcPZ92TtH3Wm3BW5VcRRWKdMN Au4rjlQV8m51AOa+vGAreg7YttWAPXbqW9jtl9DJJXiXlSt6ZelJArcGeIWiiZe/sNK+ fmeAzsgu2LdrtMNW7U1aZxocaulTo/WbBkm3KLZ7wdr9wK/lKjCWxr1rcgvjoKPYnE5N ohmJQluM/LXwALFF8GqupHty4ftkkZj+pPXxvPM7jbuD78omPV29YpRbDyP5g2x11H6B 0uVtBx28V8WQ0KtE5CVzM5cm6Ccdw4AyIZVS2lfq/bHYTQM5H8AQu3jrVg+5Y56quJNt 4oEA== X-Gm-Message-State: AOJu0YwmCeeJMY/hwXaF5vYSAAG1pl/dutp38wH+lANkJXlbuIF/BrfN KcLGgT2HPojpkEdWrXyS4HjHybkAfV1TVU8FfgSvQbwFUhvjrFMsCxww X-Gm-Gg: ASbGncvh4mZIwrLKOqaUGsRDF3faAqPtTBFf2mLf2lm5vtpidMiwImTV1Frdsw8h14N y1N4gxziYdjjLCCHHw5i/I69eW5/uLVDSQylHmCax4/bDEomVGlXqIfCg/Ex3IvlxQ0wpbuN3aX 82glQriC/Ou/dSghHuzlaoacHgun5Aqua/bA8X8bmBN1U9Weg0dpJDpaWJz89kb+teXN7XC21bG mGwcOq30zbQbsl3AMtzwbKqSwRg3NtjXgFAMjj0jl5nR8dzbj0BCM2+CxaYK9aGnuCetkxCFWuJ ze6EpC4mwDz3N8qMut/EiqOfAQ== X-Google-Smtp-Source: AGHT+IE9Pun8M/69Oxe8hQDoyrnp8Z9x9GZqaeDu3Qdflly84bIPP8ymG4VTYORwAOl4HqYWr89uRg== X-Received: by 2002:a05:6870:9690:b0:29f:e018:df85 with SMTP id 586e51a60fabf-2c690fc4385mr1441737fac.22.1741965161985; Fri, 14 Mar 2025 08:12:41 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:41 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst Subject: [PATCH v2 5/7] x86/syscall: Move sys_ni_syscall() Date: Fri, 14 Mar 2025 11:12:18 -0400 Message-ID: <20250314151220.862768-6-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" Move sys_ni_syscall() to kernel/process.c, and remove the now empty entry/common.c No functional changes. Signed-off-by: Brian Gerst Reviewed-by: Sohil Mehta --- arch/x86/entry/Makefile | 3 --- arch/x86/entry/common.c | 38 -------------------------------------- arch/x86/kernel/process.c | 5 +++++ 3 files changed, 5 insertions(+), 41 deletions(-) delete mode 100644 arch/x86/entry/common.c diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index e870f8aa936c..72cae8e0ce85 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -7,16 +7,13 @@ KASAN_SANITIZE :=3D n UBSAN_SANITIZE :=3D n KCOV_INSTRUMENT :=3D n =20 -CFLAGS_REMOVE_common.o =3D $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_syscall_32.o =3D $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_syscall_64.o =3D $(CC_FLAGS_FTRACE) =20 -CFLAGS_common.o +=3D -fno-stack-protector CFLAGS_syscall_32.o +=3D -fno-stack-protector CFLAGS_syscall_64.o +=3D -fno-stack-protector =20 obj-y :=3D entry.o entry_$(BITS).o syscall_$(BITS).o -obj-y +=3D common.o =20 obj-y +=3D vdso/ obj-y +=3D vsyscall/ diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c deleted file mode 100644 index 5bd448c0664f..000000000000 --- a/arch/x86/entry/common.c +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * common.c - C code for kernel entry and exit - * Copyright (c) 2015 Andrew Lutomirski - * - * Based on asm and ptrace code by many authors. The code here originated - * in ptrace.c and signal.c. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -SYSCALL_DEFINE0(ni_syscall) -{ - return -ENOSYS; -} diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 9c75d701011f..91f6ff618852 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -1068,3 +1068,8 @@ SYSCALL_DEFINE2(arch_prctl, int, option, unsigned lon= g, arg2) =20 return -EINVAL; } + +SYSCALL_DEFINE0(ni_syscall) +{ + return -ENOSYS; +} --=20 2.48.1 From nobody Wed Dec 17 20:41:18 2025 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C215200119 for ; Fri, 14 Mar 2025 15:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965168; cv=none; b=UK5Kb+V2UfUDaZIw3pPgmMPidrLKaci4/UBgooAUxUDw+fJVwcFoCrdYTNXFo2s7dST7B9q2Oaqzy0pkbN3XwHlKOopec1pdxbhn+CF+8+k+eF6RATMgGNN+hRkS6Tfw9TxJG3nPAxQDrgoWMVkO2semqldi2gM2U/41lnFQFJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965168; c=relaxed/simple; bh=CRZx8RZJJ4GQURbHjfKNYt+IG1166SlqUw57SHrAEJo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gCfFLBm37pMmiME5FnYqvfDXJKTG2762pxJBZsVGWhbyaDDK4KdBkYEuXPEyK+USzWIgTwD0CRo4p+4bbmCJxg+OIjka2q+9UOTmBvrr9rdBNSKB8FcCIRKd+74EepEgXOZS2v5PF8DkqugznWVlm8PsGP3nSs/xvXmtqmezz80= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OlK+B5pW; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OlK+B5pW" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-7272a839f3dso634879a34.3 for ; Fri, 14 Mar 2025 08:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965165; x=1742569965; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0LYZOViRyT1/ELcDX3aXX2XaY5ZboHM/SnziHQcTBEk=; b=OlK+B5pWlqwCUI48r70pjQfQT3pX9mzvz1vSbxin9JP/4vX4hA9OMqLKwS1zYNBb51 el0NqwZapmEjeOrfU0+q9ys5w60+Im8pq6ibfJoaUZxeOQMqJXHNslt0ChSn3DpGDoUv 2W5PkLG2c3hW0QYGOpRUISHnQujUplK5jkyU40GZ0W5lcli4pVHDe6gSfEYExh1KBSu5 Io0fdQffGSKhDXU8oJVjWzzX5xuJne3KU0GZVU5w4m4fae/ttL3wCRj6Oqo5b0VrkZcP b8FcnoBUno9TWy5ai9GkNK50/T/kJPW4xddtTGqg+V7/Vf7RTmGTjZF77u3NQD982EG0 jhmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965165; x=1742569965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0LYZOViRyT1/ELcDX3aXX2XaY5ZboHM/SnziHQcTBEk=; b=j0gLPX6HdJ+sy0Bd+0qS+D8OKnX0+Rm2GrmcBwdgKMzfY/vFml8xSACbqhr2faSvhd LhHNqCWHAekE2r6cZX5eWA0MX8vccZBibpOcGrQA13TFJBExDCCTHZvSUzcMVCD570Tj aYThq1pDa8ygIamq3DcNPWKwNUZDR5qUJfI5XKL6lHrGXoLbI5Gv3sm4XtZeCxXRKABU AxQ+kIGXBDvgbO2QmwRB8XsNXbdzX0fUh+tA1bjxIgV98f7YjpbzpvIvweLBXQJZrRxc frNAtdx/oy244K5DjLsCsnebPl6TkrgmoZ8B4UEMbH+EbbPSbzm5OHyeOCs38nk9L/LZ p0/w== X-Gm-Message-State: AOJu0YwYD1I/XdAgtNLApfxvoCr9Srsv8nhwIE9QkBiTuI4Dq6zMden6 /kjv3aCapXvz2Hc0GpvE/nRZE/h8n4gfJgz0O3M1+rqlOzUOmcYzMuEm X-Gm-Gg: ASbGncsdR39S8ugARwSiYi1IW0XpH2iA/bT2QRegXXR8OM50JPax54WW64xJXHwE5M6 1UVzxjK1fgG4HjIuxkrFQtwGmNYd2cJPC8v6sOquFOxSFzk4HfxTXHOWN/P6j88OP77Y/dSE5ww 3tD2OzwRrLwNRzfq30d4bx3toPvyUbSc5y3z2hIS0lr1m9nKsa679wAgCqSRzrN8PAT3wjlntIj VYNbkDjuTrf3558J7YoVOGHIQJ2yl/wgUS0w1rc9LQgw2JnW3+ol1HJaLVD7QVHTgSK4xYTm6YY v5JTvFN+LvE4NJDOmlDILyi9qYTkwYKkYjLl X-Google-Smtp-Source: AGHT+IGrA/C8m1HFR7VM+0OlgxeQ+475dUUWnQ3VW7Q+CedVDkvA/sLvxGq6EQ8sZs/Ecrt6O2LR0Q== X-Received: by 2002:a05:6870:9618:b0:2c2:3c88:6ef7 with SMTP id 586e51a60fabf-2c6911c7e25mr1423464fac.26.1741965165381; Fri, 14 Mar 2025 08:12:45 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:44 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst , Sohil Mehta Subject: [PATCH v2 6/7] x86/syscall: Remove stray semicolons Date: Fri, 14 Mar 2025 11:12:19 -0400 Message-ID: <20250314151220.862768-7-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" No functional change. Signed-off-by: Brian Gerst Suggested-by: Sohil Mehta Reviewed-by: Sohil Mehta --- arch/x86/entry/syscall_32.c | 2 +- arch/x86/entry/syscall_64.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c index 06b9df10f2f8..993d72504fc5 100644 --- a/arch/x86/entry/syscall_32.c +++ b/arch/x86/entry/syscall_32.c @@ -47,7 +47,7 @@ long ia32_sys_call(const struct pt_regs *regs, unsigned i= nt nr) #include default: return __ia32_sys_ni_syscall(regs); } -}; +} =20 static __always_inline int syscall_32_enter(struct pt_regs *regs) { diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index a05f7be8a0e2..b6e68ea98b83 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -38,7 +38,7 @@ long x64_sys_call(const struct pt_regs *regs, unsigned in= t nr) #include default: return __x64_sys_ni_syscall(regs); } -}; +} =20 #ifdef CONFIG_X86_X32_ABI long x32_sys_call(const struct pt_regs *regs, unsigned int nr) @@ -47,7 +47,7 @@ long x32_sys_call(const struct pt_regs *regs, unsigned in= t nr) #include default: return __x64_sys_ni_syscall(regs); } -}; +} #endif =20 static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr) --=20 2.48.1 From nobody Wed Dec 17 20:41:18 2025 Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E8A92036E0 for ; Fri, 14 Mar 2025 15:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965171; cv=none; b=CPNVTaztREK2iks/pogzRGvTg3uBVV1uVqlTylpa9U/dc/ZbLaHPhRvZL7Bkxl3JnzbCrtWK3k4xqkwtigCFL6pvL5OvwR0XTJdwES0zrOBMkGEN7NzzrCPK3jWTE2wc3wPh1+r/Dg4zRxQMxmgIRJqHLyqjhadiIpPLAU2MNYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741965171; c=relaxed/simple; bh=DGaQ8KNqj5JX+vu9aJ/q2g9z8GN4HJfBRJSib5L7PVU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lzQQYVV3mjugeu8PQFRNd6Xu7/0bG1mLK7mhrA19zvWhXbYYBn9+EZRwDf76GuiBzPAhO6CVC8fx2lF1cvfdbFw2W5FnAuKJn5RoRr1ttnjddMZmRCo/xQ8BQPyLycuCC3rOSQTJSyx/lcnzjFNaoUhQqZNOCvh/kTPE+8l3p9Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XBdE7JvL; arc=none smtp.client-ip=209.85.160.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XBdE7JvL" Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-2bcc5c887efso1830265fac.2 for ; Fri, 14 Mar 2025 08:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741965169; x=1742569969; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LPkJbM+LB7smtMlLHqRxnuiLsZ6gkfVdWfSfDGioiKY=; b=XBdE7JvLT1ULBph+kYl0nLJcYgdy7PX+5KCE7ax4/HxWQ88+BZ7IFlJhCabL/hCcIV fBlErBJrrA2A29Kww+DFgQdePS3bhn+g+WIOSHZaeX88dHjfywEFU9q85tdO+1Kx2GqC iTnCiTRHnNf9FdBCConGGOGLO6Sps4n8lIQlgCISDsYG44a/xVvkWOVqUeN6Xr5TW5Z1 w3MrYnFEssD3zL8X97020BGvU0ST4Ojdd+Ac74NeHXfiUwDsBcBBG2VLqqhezhenXX8q u1iK/tHpY/EJZHTWXmUukueXhPj475CuAUde1qcPE9/jIrlOfYfWCXzpMmslG1Uy1F8B 1ZlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741965169; x=1742569969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LPkJbM+LB7smtMlLHqRxnuiLsZ6gkfVdWfSfDGioiKY=; b=UGOCacBBXTKNlEmKDv3Wm5RssGtw/KaGfT10qV0dZsMyIOq6gCUCgXRh+7OEnpPgTg a6dLY+CREdUyiYbTIB9qcGwD9errjsHyi3StDkVKqC8ME5qw6sCwZNnDriu8DXiPwlLz LP8nD2GylTcTQXUnhv1t8g0ifkFSmcOUN+B9Py+C2gpSuBa/ggsAjMLws75cVfoT1yx9 yi3pL7UvdIVyBlwqDTAZbR3EKiYVzT10Aaqp2wwCprdNRvjliDBO3wNVpex8PtSNfczl OS+dPAAqS+3GTGxPJECkBEWYpdBvLlR3iMQ+T0rZFO6fjmctMk3bHHQ6HU0ayxZV+xW/ HJYQ== X-Gm-Message-State: AOJu0YyTsTqw50Pi62bcV4sOBKuJ3xVQS/O2OFXx8yGmeqEUMNB32sHU W7QuuM7ffYjCxbYoeQKQJPijILOUfMvnA3K73mAYG6BK4NDHXnTDsj0L X-Gm-Gg: ASbGncu9Ig/81NgjfKUEzMcNRcVteXWmR17hqcjGdQDpgjPgkNTSR+swRtdqk75xcxT YuyAelDoq6Fe5C3eQcPjZptlv+LsacMMrPKoTYPnFi9PGKsRQlzO0BsrjQkhnmpEEBMC669NgdX 26O8SN5cPYP8qFT+rYkk9NfqhJhrX/u6+L5kuiePm0vGAkzIICBRPf23XxIoJRtw9CwdBD+0CVJ SxAVGJbiv0t75yXSfNlNwz2b1GBX/5+GbQo75j/6IvDnD3WQ3UdLd6xxcTQTlAC0TT8pF8PYj7k pLcvhRXnm/+UQRk0CmvsTM5emFjkE2HDfvz4 X-Google-Smtp-Source: AGHT+IEpS/x4kN0eYs37tl0L+r0Fo7v65AtFdSROcUeGHnZ9j2RneAV06uq5ofBr8TOzT+2shiIMCw== X-Received: by 2002:a05:6870:9126:b0:2b8:3d8c:15ad with SMTP id 586e51a60fabf-2c690ec979dmr1476448fac.1.1741965168643; Fri, 14 Mar 2025 08:12:48 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c6710f21efsm883026fac.30.2025.03.14.08.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 08:12:47 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Juergen Gross , Boris Ostrovsky , Brian Gerst , Sohil Mehta Subject: [PATCH v2 7/7] x86/syscall/32: Add comment to conditional Date: Fri, 14 Mar 2025 11:12:20 -0400 Message-ID: <20250314151220.862768-8-brgerst@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250314151220.862768-1-brgerst@gmail.com> References: <20250314151220.862768-1-brgerst@gmail.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" Add a CONFIG_X86_FRED comment, since this conditional is nested. Signed-off-by: Brian Gerst Suggested-by: Sohil Mehta Reviewed-by: Sohil Mehta --- arch/x86/entry/syscall_32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c index 993d72504fc5..2b15ea17bb7c 100644 --- a/arch/x86/entry/syscall_32.c +++ b/arch/x86/entry/syscall_32.c @@ -238,7 +238,8 @@ DEFINE_FREDENTRY_RAW(int80_emulation) instrumentation_end(); syscall_exit_to_user_mode(regs); } -#endif +#endif /* CONFIG_X86_FRED */ + #else /* CONFIG_IA32_EMULATION */ =20 /* Handles int $0x80 on a 32bit kernel */ --=20 2.48.1