Skip to content

Commit abfb949

Browse files
0x7f454c46Ingo Molnar
authored andcommitted
x86/entry: Rename is_{ia32,x32}_task() to in_{ia32,x32}_syscall()
The is_ia32_task()/is_x32_task() function names are a big misnomer: they suggests that the compat-ness of a system call is a task property, which is not true, the compatness of a system call purely depends on how it was invoked through the system call layer. A task may call 32-bit and 64-bit and x32 system calls without changing any of its kernel visible state. This specific minomer is also actively dangerous, as it might cause kernel developers to use the wrong kind of security checks within system calls. So rename it to in_{ia32,x32}_syscall(). Suggested-by: Andy Lutomirski <[email protected]> Suggested-by: Ingo Molnar <[email protected]> Signed-off-by: Dmitry Safonov <[email protected]> [ Expanded the changelog. ] Acked-by: Andy Lutomirski <[email protected]> Cc: [email protected] Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 6666ea5 commit abfb949

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

arch/x86/entry/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ long syscall_trace_enter_phase2(struct pt_regs *regs, u32 arch,
191191

192192
long syscall_trace_enter(struct pt_regs *regs)
193193
{
194-
u32 arch = is_ia32_task() ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
194+
u32 arch = in_ia32_syscall() ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
195195
unsigned long phase1_result = syscall_trace_enter_phase1(regs, arch);
196196

197197
if (phase1_result == 0)

arch/x86/include/asm/compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static inline void __user *arch_compat_alloc_user_space(long len)
307307
return (void __user *)round_down(sp - len, 16);
308308
}
309309

310-
static inline bool is_x32_task(void)
310+
static inline bool in_x32_syscall(void)
311311
{
312312
#ifdef CONFIG_X86_X32_ABI
313313
if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
@@ -318,7 +318,7 @@ static inline bool is_x32_task(void)
318318

319319
static inline bool in_compat_syscall(void)
320320
{
321-
return is_ia32_task() || is_x32_task();
321+
return in_ia32_syscall() || in_x32_syscall();
322322
}
323323
#define in_compat_syscall in_compat_syscall /* override the generic impl */
324324

arch/x86/include/asm/thread_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static inline bool test_and_clear_restore_sigmask(void)
255255
return true;
256256
}
257257

258-
static inline bool is_ia32_task(void)
258+
static inline bool in_ia32_syscall(void)
259259
{
260260
#ifdef CONFIG_X86_32
261261
return true;

arch/x86/kernel/process_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
210210
*/
211211
if (clone_flags & CLONE_SETTLS) {
212212
#ifdef CONFIG_IA32_EMULATION
213-
if (is_ia32_task())
213+
if (in_ia32_syscall())
214214
err = do_set_thread_area(p, -1,
215215
(struct user_desc __user *)tls, 0);
216216
else

arch/x86/kernel/ptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
12661266
compat_ulong_t caddr, compat_ulong_t cdata)
12671267
{
12681268
#ifdef CONFIG_X86_X32_ABI
1269-
if (!is_ia32_task())
1269+
if (!in_ia32_syscall())
12701270
return x32_arch_ptrace(child, request, caddr, cdata);
12711271
#endif
12721272
#ifdef CONFIG_IA32_EMULATION

arch/x86/kernel/signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
762762
static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
763763
{
764764
#ifdef CONFIG_X86_64
765-
if (is_ia32_task())
765+
if (in_ia32_syscall())
766766
return __NR_ia32_restart_syscall;
767767
#endif
768768
#ifdef CONFIG_X86_X32_ABI

arch/x86/kernel/uprobes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ struct uprobe_xol_ops {
516516

517517
static inline int sizeof_long(void)
518518
{
519-
return is_ia32_task() ? 4 : 8;
519+
return in_ia32_syscall() ? 4 : 8;
520520
}
521521

522522
static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)

0 commit comments

Comments
 (0)