Skip to content

Commit 8661d76

Browse files
samitolvanenIngo Molnar
authored andcommitted
syscalls/x86: Use the correct function type in SYSCALL_DEFINE0
Although a syscall defined using SYSCALL_DEFINE0 doesn't accept parameters, use the correct function type to avoid type mismatches with Control-Flow Integrity (CFI) checking. Signed-off-by: Sami Tolvanen <[email protected]> Acked-by: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: H . Peter Anvin <[email protected]> Cc: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 8a8c600 commit 8661d76

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

arch/x86/include/asm/syscall_wrapper.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@
4848
* To keep the naming coherent, re-define SYSCALL_DEFINE0 to create an alias
4949
* named __ia32_sys_*()
5050
*/
51-
#define SYSCALL_DEFINE0(sname) \
52-
SYSCALL_METADATA(_##sname, 0); \
53-
asmlinkage long __x64_sys_##sname(void); \
54-
ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \
55-
SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \
56-
asmlinkage long __x64_sys_##sname(void)
51+
52+
#define SYSCALL_DEFINE0(sname) \
53+
SYSCALL_METADATA(_##sname, 0); \
54+
asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused);\
55+
ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \
56+
SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \
57+
asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused)
5758

5859
#define COND_SYSCALL(name) \
5960
cond_syscall(__x64_sys_##name); \
@@ -181,11 +182,11 @@
181182
* macros to work correctly.
182183
*/
183184
#ifndef SYSCALL_DEFINE0
184-
#define SYSCALL_DEFINE0(sname) \
185-
SYSCALL_METADATA(_##sname, 0); \
186-
asmlinkage long __x64_sys_##sname(void); \
187-
ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \
188-
asmlinkage long __x64_sys_##sname(void)
185+
#define SYSCALL_DEFINE0(sname) \
186+
SYSCALL_METADATA(_##sname, 0); \
187+
asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused);\
188+
ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \
189+
asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused)
189190
#endif
190191

191192
#ifndef COND_SYSCALL

0 commit comments

Comments
 (0)