Skip to content

Commit

Permalink
resume_user_mode: Move to resume_user_mode.h
Browse files Browse the repository at this point in the history
Move set_notify_resume and tracehook_notify_resume into resume_user_mode.h.
While doing that rename tracehook_notify_resume to resume_user_mode_work.

Update all of the places that included tracehook.h for these functions to
include resume_user_mode.h instead.

Update all of the callers of tracehook_notify_resume to call
resume_user_mode_work.

Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/20220309162454.123006-12-ebiederm@xmission.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed Mar 10, 2022
1 parent d3c51a0 commit 03248ad
Show file tree
Hide file tree
Showing 35 changed files with 117 additions and 107 deletions.
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ config TRACE_IRQFLAGS_SUPPORT
# linux/regset.h user_regset interfaces
# CORE_DUMP_USE_REGSET #define'd in linux/elf.h
# TIF_SYSCALL_TRACE calls ptrace_report_syscall_{entry,exit}
# TIF_NOTIFY_RESUME calls tracehook_notify_resume()
# TIF_NOTIFY_RESUME calls resume_user_mode_work()
#
config HAVE_ARCH_TRACEHOOK
bool
Expand Down
4 changes: 2 additions & 2 deletions arch/alpha/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/binfmts.h>
#include <linux/bitops.h>
#include <linux/syscalls.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <linux/uaccess.h>
#include <asm/sigcontext.h>
Expand Down Expand Up @@ -531,7 +531,7 @@ do_work_pending(struct pt_regs *regs, unsigned long thread_flags,
do_signal(regs, r0, r19);
r0 = 0;
} else {
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
}
local_irq_disable();
Expand Down
4 changes: 2 additions & 2 deletions arch/arc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <linux/personality.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/sched/task_stack.h>

#include <asm/ucontext.h>
Expand Down Expand Up @@ -438,5 +438,5 @@ void do_notify_resume(struct pt_regs *regs)
* user mode
*/
if (test_thread_flag(TIF_NOTIFY_RESUME))
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/arm/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/signal.h>
#include <linux/personality.h>
#include <linux/uaccess.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/uprobes.h>
#include <linux/syscalls.h>

Expand Down Expand Up @@ -627,7 +627,7 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
} else if (thread_flags & _TIF_UPROBE) {
uprobe_notify_resume(regs);
} else {
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
}
local_irq_disable();
Expand Down
4 changes: 2 additions & 2 deletions arch/arm64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/uaccess.h>
#include <linux/sizes.h>
#include <linux/string.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/ratelimit.h>
#include <linux/syscalls.h>

Expand Down Expand Up @@ -941,7 +941,7 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags)
do_signal(regs);

if (thread_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);

if (thread_flags & _TIF_FOREIGN_FPSTATE)
fpsimd_restore_current_state();
Expand Down
4 changes: 2 additions & 2 deletions arch/csky/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <linux/signal.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/traps.h>
#include <asm/ucontext.h>
Expand Down Expand Up @@ -265,5 +265,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
do_signal(regs);

if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/h8300/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <linux/personality.h>
#include <linux/tty.h>
#include <linux/binfmts.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/setup.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -283,5 +283,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
do_signal(regs);

if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/hexagon/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/tick.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

/*
* Program thread launch. Often defined as a macro in processor.h,
Expand Down Expand Up @@ -178,7 +178,7 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
}

if (thread_info_flags & _TIF_NOTIFY_RESUME) {
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
return 1;
}

Expand Down
1 change: 0 additions & 1 deletion arch/hexagon/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <linux/linkage.h>
#include <linux/syscalls.h>
#include <linux/tracehook.h>
#include <linux/sched/task_stack.h>

#include <asm/registers.h>
Expand Down
4 changes: 2 additions & 2 deletions arch/ia64/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <linux/delay.h>
#include <linux/kdebug.h>
#include <linux/utsname.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/rcupdate.h>

#include <asm/cpu.h>
Expand Down Expand Up @@ -179,7 +179,7 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)

if (test_thread_flag(TIF_NOTIFY_RESUME)) {
local_irq_enable(); /* force interrupt enable */
tracehook_notify_resume(&scr->pt);
resume_user_mode_work(&scr->pt);
}

/* copy user rbs to kernel rbs */
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <linux/signal.h>
#include <linux/regset.h>
#include <linux/elf.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/processor.h>
#include <asm/ptrace_offsets.h>
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/smp.h>
Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <linux/tty.h>
#include <linux/binfmts.h>
#include <linux/extable.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/setup.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -1109,5 +1109,5 @@ void do_notify_resume(struct pt_regs *regs)
do_signal(regs);

if (test_thread_flag(TIF_NOTIFY_RESUME))
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/microblaze/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <linux/personality.h>
#include <linux/percpu.h>
#include <linux/linkage.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <asm/entry.h>
#include <asm/ucontext.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -311,5 +311,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall)
do_signal(regs, in_syscall);

if (test_thread_flag(TIF_NOTIFY_RESUME))
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/mips/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <linux/compiler.h>
#include <linux/syscalls.h>
#include <linux/uaccess.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/abi.h>
#include <asm/asm.h>
Expand Down Expand Up @@ -916,7 +916,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
do_signal(regs);

if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);

user_enter();
}
Expand Down
4 changes: 2 additions & 2 deletions arch/nds32/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <linux/ptrace.h>
#include <linux/personality.h>
#include <linux/freezer.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/uaccess.h>

#include <asm/cacheflush.h>
Expand Down Expand Up @@ -380,5 +380,5 @@ do_notify_resume(struct pt_regs *regs, unsigned int thread_flags)
do_signal(regs);

if (thread_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/nios2/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/uaccess.h>
#include <linux/unistd.h>
#include <linux/personality.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/ucontext.h>
#include <asm/cacheflush.h>
Expand Down Expand Up @@ -319,7 +319,7 @@ asmlinkage int do_notify_resume(struct pt_regs *regs)
return restart;
}
} else if (test_thread_flag(TIF_NOTIFY_RESUME))
tracehook_notify_resume(regs);
resume_user_mode_work(regs);

return 0;
}
4 changes: 2 additions & 2 deletions arch/openrisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <asm/processor.h>
#include <asm/syscall.h>
Expand Down Expand Up @@ -309,7 +309,7 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
}
syscall = 0;
} else {
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
}
local_irq_disable();
Expand Down
4 changes: 2 additions & 2 deletions arch/parisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/compat.h>
Expand Down Expand Up @@ -602,5 +602,5 @@ void do_notify_resume(struct pt_regs *regs, long in_syscall)
do_signal(regs, in_syscall);

if (test_thread_flag(TIF_NOTIFY_RESUME))
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* this archive for more details.
*/

#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/signal.h>
#include <linux/uprobes.h>
#include <linux/key.h>
Expand Down Expand Up @@ -294,7 +294,7 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
}

if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}

static unsigned long get_tm_stackpointer(struct task_struct *tsk)
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/signal.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/linkage.h>

#include <asm/ucontext.h>
Expand Down Expand Up @@ -317,5 +317,5 @@ asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
do_signal(regs);

if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
4 changes: 2 additions & 2 deletions arch/sh/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <linux/personality.h>
#include <linux/binfmts.h>
#include <linux/io.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <asm/ucontext.h>
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
Expand Down Expand Up @@ -503,5 +503,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
do_signal(regs, save_r0);

if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}
1 change: 0 additions & 1 deletion arch/sparc/kernel/signal32.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/binfmts.h>
#include <linux/compat.h>
#include <linux/bitops.h>
#include <linux/tracehook.h>

#include <linux/uaccess.h>
#include <asm/ptrace.h>
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <linux/smp.h>
#include <linux/binfmts.h> /* do_coredum */
#include <linux/bitops.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>

#include <linux/uaccess.h>
#include <asm/ptrace.h>
Expand Down Expand Up @@ -524,7 +524,7 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
do_signal(regs, orig_i0);
if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
}

asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc/kernel/signal_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/resume_user_mode.h>
#include <linux/unistd.h>
#include <linux/mm.h>
#include <linux/tty.h>
Expand Down Expand Up @@ -552,7 +552,7 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long
if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
do_signal(regs, orig_i0);
if (thread_info_flags & _TIF_NOTIFY_RESUME)
tracehook_notify_resume(regs);
resume_user_mode_work(regs);
user_enter();
}

Expand Down
Loading

0 comments on commit 03248ad

Please sign in to comment.