Skip to content

Commit 00198a6

Browse files
samitolvanenIngo Molnar
authored andcommitted
syscalls/x86: Use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn
Use COMPAT_SYSCALL_DEFINE0 to define (rt_)sigreturn() syscalls to replace sys32_sigreturn() and sys32_rt_sigreturn(). This fixes indirect call 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 cf3b83e commit 00198a6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

arch/x86/entry/syscalls/syscall_32.tbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
116 i386 sysinfo sys_sysinfo __ia32_compat_sys_sysinfo
131131
117 i386 ipc sys_ipc __ia32_compat_sys_ipc
132132
118 i386 fsync sys_fsync __ia32_sys_fsync
133-
119 i386 sigreturn sys_sigreturn sys32_sigreturn
133+
119 i386 sigreturn sys_sigreturn __ia32_compat_sys_sigreturn
134134
120 i386 clone sys_clone __ia32_compat_sys_x86_clone
135135
121 i386 setdomainname sys_setdomainname __ia32_sys_setdomainname
136136
122 i386 uname sys_newuname __ia32_sys_newuname
@@ -184,7 +184,7 @@
184184
170 i386 setresgid sys_setresgid16 __ia32_sys_setresgid16
185185
171 i386 getresgid sys_getresgid16 __ia32_sys_getresgid16
186186
172 i386 prctl sys_prctl __ia32_sys_prctl
187-
173 i386 rt_sigreturn sys_rt_sigreturn sys32_rt_sigreturn
187+
173 i386 rt_sigreturn sys_rt_sigreturn __ia32_compat_sys_rt_sigreturn
188188
174 i386 rt_sigaction sys_rt_sigaction __ia32_compat_sys_rt_sigaction
189189
175 i386 rt_sigprocmask sys_rt_sigprocmask __ia32_compat_sys_rt_sigprocmask
190190
176 i386 rt_sigpending sys_rt_sigpending __ia32_compat_sys_rt_sigpending

arch/x86/ia32/ia32_signal.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/personality.h>
2222
#include <linux/compat.h>
2323
#include <linux/binfmts.h>
24+
#include <linux/syscalls.h>
2425
#include <asm/ucontext.h>
2526
#include <linux/uaccess.h>
2627
#include <asm/fpu/internal.h>
@@ -118,7 +119,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
118119
return err;
119120
}
120121

121-
asmlinkage long sys32_sigreturn(void)
122+
COMPAT_SYSCALL_DEFINE0(sigreturn)
122123
{
123124
struct pt_regs *regs = current_pt_regs();
124125
struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(regs->sp-8);
@@ -144,7 +145,7 @@ asmlinkage long sys32_sigreturn(void)
144145
return 0;
145146
}
146147

147-
asmlinkage long sys32_rt_sigreturn(void)
148+
COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
148149
{
149150
struct pt_regs *regs = current_pt_regs();
150151
struct rt_sigframe_ia32 __user *frame;

0 commit comments

Comments
 (0)