aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/entry/common.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-04-03 16:36:44 -0700
committerThomas Gleixner <tglx@linutronix.de>2024-04-08 19:27:05 +0200
commit1e3ad78334a69b36e107232e337f9d693dcc9df2 (patch)
tree11162955093106a59ca3825365580797e0aff750 /arch/x86/entry/common.c
parentx86/bugs: Change commas to semicolons in 'spectre_v2' sysfs file (diff)
downloadlinux-1e3ad78334a69b36e107232e337f9d693dcc9df2.tar.gz
linux-1e3ad78334a69b36e107232e337f9d693dcc9df2.zip
x86/syscall: Don't force use of indirect calls for system calls
Make <asm/syscall.h> build a switch statement instead, and the compiler can either decide to generate an indirect jump, or - more likely these days due to mitigations - just a series of conditional branches. Yes, the conditional branches also have branch prediction, but the branch prediction is much more controlled, in that it just causes speculatively running the wrong system call (harmless), rather than speculatively running possibly wrong random less controlled code gadgets. This doesn't mitigate other indirect calls, but the system call indirection is the first and most easily triggered case. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Daniel Sneddon <daniel.sneddon@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'arch/x86/entry/common.c')
-rw-r--r--arch/x86/entry/common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 6356060caaf3..cea0e2a23b42 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -49,7 +49,7 @@ static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr)
if (likely(unr < NR_syscalls)) {
unr = array_index_nospec(unr, NR_syscalls);
- regs->ax = sys_call_table[unr](regs);
+ regs->ax = x64_sys_call(regs, unr);
return true;
}
return false;
@@ -66,7 +66,7 @@ static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr)
if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) {
xnr = array_index_nospec(xnr, X32_NR_syscalls);
- regs->ax = x32_sys_call_table[xnr](regs);
+ regs->ax = x32_sys_call(regs, xnr);
return true;
}
return false;
@@ -162,7 +162,7 @@ static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs, int nr)
if (likely(unr < IA32_NR_syscalls)) {
unr = array_index_nospec(unr, IA32_NR_syscalls);
- regs->ax = ia32_sys_call_table[unr](regs);
+ regs->ax = ia32_sys_call(regs, unr);
} else if (nr != -1) {
regs->ax = __ia32_sys_ni_syscall(regs);
}
it/commit/userdiff.c?h=main&id=b79e6925f0ff8ae0afa6554224a5a2e1c41a4605&follow=1'>userdiff: add tests for Fortran xfuncname regexPhilippe Blain11-0/+100 2020-08-13fetch, pull doc: correct description of '--set-upstream'Philippe Blain1-1/+1 2020-08-13docs: commit-graph: fix some whitespace in the diagramJohannes Berg1-3/+3 2020-08-13blame: only coalesce lines that are adjacent in resultJeff King2-0/+10 2020-08-13t8003: factor setup out of coalesce testJeff King1-6/+10 2020-08-13t8003: check output of coalesced blameJeff King1-7/+4 2020-08-12rebase: remove unused function reschedule_last_actionRené Scharfe1-10/+0 2020-08-11Sixth batchJunio C Hamano1-0/+11 2020-08-11t/t4013: add test for --diff-merges=offSergey Organov3-0/+158 2020-08-11doc/git-log: describe --diff-merges=offSergey Organov1-1/+5 2020-08-11revision: change "--diff-merges" option to require parameterSergey Organov1-1/+8 2020-08-11t1416: avoid hard-coded sha1 idsJeff King1-2/+3 2020-08-11upload-pack: remove superfluous sigchain_pop() callRené Scharfe1-1/+0 2020-08-10t6425: be more flexible with rename/delete conflict messagesElijah Newren1-1/+2 2020-08-10t642[23]: be more flexible for add/add conflicts involving pair renamesElijah Newren2-8/+14 2020-08-10t6422, t6426: be more flexible for add/add conflicts involving renamesElijah Newren2-9/+14 2020-08-10t6423: add an explanation about why one of the tests does not passElijah Newren1-0/+8 2020-08-10t6416, t6423: clarify some comments and fix some typosElijah Newren2-14/+13 2020-08-10t6422: fix multiple errors with the mod6 test expectationsElijah Newren1-9/+10 2020-08-10t6423: fix test setup for a couple testsElijah Newren1-0/+2 2020-08-10t6416, t6422: fix incorrect untracked file countElijah Newren2-3/+3 2020-08-10t6422: fix bad check against missing fileElijah Newren1-3/+3 2020-08-10t6418: tighten delete/normalize conflict testcaseElijah Newren1-1/+2 2020-08-10Collect merge-related tests to t64xxElijah Newren35-0/+0 2020-08-10progress: don't dereference before checking for NULLMartin Ågren1-2/+10 2020-08-10Fifth batchJunio C Hamano1-0/+15 2020-08-09test_cmp: diagnose incorrect argumentsEric Sunshine1-2/+14 2020-08-09diff-lib: use worktree mode in diffs from i-t-a entriesRaymond E. Pasco1-1/+2