mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 22:42:04 +00:00
ptrace: Move ptrace_report_syscall into ptrace.h
Move ptrace_report_syscall from tracehook.h into ptrace.h where it belongs. Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lkml.kernel.org/r/20220309162454.123006-1-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
e783362eb5
commit
19397e8b54
@ -413,4 +413,31 @@ static inline void user_single_step_report(struct pt_regs *regs)
|
|||||||
extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
|
extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
|
||||||
|
|
||||||
extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
|
extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ptrace report for syscall entry and exit looks identical.
|
||||||
|
*/
|
||||||
|
static inline int ptrace_report_syscall(unsigned long message)
|
||||||
|
{
|
||||||
|
int ptrace = current->ptrace;
|
||||||
|
|
||||||
|
if (!(ptrace & PT_PTRACED))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
current->ptrace_message = message;
|
||||||
|
ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this isn't the same as continuing with a signal, but it will do
|
||||||
|
* for normal use. strace only continues with a signal if the
|
||||||
|
* stopping signal is not SIGTRAP. -brl
|
||||||
|
*/
|
||||||
|
if (current->exit_code) {
|
||||||
|
send_sig(current->exit_code, current, 1);
|
||||||
|
current->exit_code = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
current->ptrace_message = 0;
|
||||||
|
return fatal_signal_pending(current);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,32 +51,6 @@
|
|||||||
#include <linux/blk-cgroup.h>
|
#include <linux/blk-cgroup.h>
|
||||||
struct linux_binprm;
|
struct linux_binprm;
|
||||||
|
|
||||||
/*
|
|
||||||
* ptrace report for syscall entry and exit looks identical.
|
|
||||||
*/
|
|
||||||
static inline int ptrace_report_syscall(unsigned long message)
|
|
||||||
{
|
|
||||||
int ptrace = current->ptrace;
|
|
||||||
|
|
||||||
if (!(ptrace & PT_PTRACED))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
current->ptrace_message = message;
|
|
||||||
ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* this isn't the same as continuing with a signal, but it will do
|
|
||||||
* for normal use. strace only continues with a signal if the
|
|
||||||
* stopping signal is not SIGTRAP. -brl
|
|
||||||
*/
|
|
||||||
if (current->exit_code) {
|
|
||||||
send_sig(current->exit_code, current, 1);
|
|
||||||
current->exit_code = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
current->ptrace_message = 0;
|
|
||||||
return fatal_signal_pending(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tracehook_report_syscall_entry - task is about to attempt a system call
|
* tracehook_report_syscall_entry - task is about to attempt a system call
|
||||||
|
Loading…
Reference in New Issue
Block a user