lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 9 Nov 2020 12:22:56 +0100 From: Alexandre Chartre <alexandre.chartre@...cle.com> To: "tglx@...utronix.de"@aserv0122.oracle.com, "mingo@...hat.com"@aserv0122.oracle.com, "bp@...en8.de"@aserv0122.oracle.com, "hpa@...or.com"@aserv0122.oracle.com, "x86@...nel.org"@aserv0122.oracle.com, "dave.hansen@...ux.intel.com"@aserv0122.oracle.com, "luto@...nel.org"@aserv0122.oracle.com, "peterz@...radead.org"@aserv0122.oracle.com, "linux-kernel@...r.kernel.org"@aserv0122.oracle.com, "thomas.lendacky@....com"@aserv0122.oracle.com, "jroedel@...e.de"@aserv0122.oracle.com Cc: "konrad.wilk@...cle.com"@aserv0122.oracle.com, "jan.setjeeilers@...cle.com"@aserv0122.oracle.com, "junaids@...gle.com"@aserv0122.oracle.com, "oweisse@...gle.com"@aserv0122.oracle.com, "rppt@...ux.vnet.ibm.com"@aserv0122.oracle.com, "graf@...zon.de"@aserv0122.oracle.com, "mgross@...ux.intel.com"@aserv0122.oracle.com, "kuzuno@...il.com"@aserv0122.oracle.com, "alexandre.chartre@...cle.com"@aserv0122.oracle.com Subject: [RFC][PATCH 01/24] x86/syscall: Add wrapper for invoking syscall function Add a wrapper function for invoking a syscall function. Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com> --- arch/x86/entry/common.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 870efeec8bda..d222212908ad 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -35,6 +35,15 @@ #include <asm/syscall.h> #include <asm/irq_stack.h> +static __always_inline void run_syscall(sys_call_ptr_t sysfunc, + struct pt_regs *regs) +{ + if (!sysfunc) + return; + + regs->ax = sysfunc(regs); +} + #ifdef CONFIG_X86_64 __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs) { @@ -43,15 +52,16 @@ __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs) instrumentation_begin(); if (likely(nr < NR_syscalls)) { nr = array_index_nospec(nr, NR_syscalls); - regs->ax = sys_call_table[nr](regs); + run_syscall(sys_call_table[nr], regs); #ifdef CONFIG_X86_X32_ABI } else if (likely((nr & __X32_SYSCALL_BIT) && (nr & ~__X32_SYSCALL_BIT) < X32_NR_syscalls)) { nr = array_index_nospec(nr & ~__X32_SYSCALL_BIT, X32_NR_syscalls); - regs->ax = x32_sys_call_table[nr](regs); + run_syscall(x32_sys_call_table[nr], regs); #endif } + instrumentation_end(); syscall_exit_to_user_mode(regs); } @@ -75,7 +85,7 @@ static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs, if (likely(nr < IA32_NR_syscalls)) { instrumentation_begin(); nr = array_index_nospec(nr, IA32_NR_syscalls); - regs->ax = ia32_sys_call_table[nr](regs); + run_syscall(ia32_sys_call_table[nr], regs); instrumentation_end(); } } -- 2.18.4
Powered by blists - more mailing lists