Commit 4a3d2717 authored by Eric W. Biederman's avatar Eric W. Biederman

ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP

xtensa is the last user of the PT_SINGLESTEP flag.  Changing tsk->ptrace in
user_enable_single_step and user_disable_single_step without locking could
potentiallly cause problems.

So use a thread info flag instead of a flag in tsk->ptrace.  Use TIF_SINGLESTEP
that xtensa already had defined but unused.

Remove the definitions of PT_SINGLESTEP and PT_BLOCKSTEP as they have no more users.

Cc: stable@vger.kernel.org
Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Tested-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
Link: https://lkml.kernel.org/r/20220505182645.497868-4-ebiederm@xmission.comSigned-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent c200e4bb
...@@ -225,12 +225,12 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task) ...@@ -225,12 +225,12 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
void user_enable_single_step(struct task_struct *child) void user_enable_single_step(struct task_struct *child)
{ {
child->ptrace |= PT_SINGLESTEP; set_tsk_thread_flag(child, TIF_SINGLESTEP);
} }
void user_disable_single_step(struct task_struct *child) void user_disable_single_step(struct task_struct *child)
{ {
child->ptrace &= ~PT_SINGLESTEP; clear_tsk_thread_flag(child, TIF_SINGLESTEP);
} }
/* /*
......
...@@ -473,7 +473,7 @@ static void do_signal(struct pt_regs *regs) ...@@ -473,7 +473,7 @@ static void do_signal(struct pt_regs *regs)
/* Set up the stack frame */ /* Set up the stack frame */
ret = setup_frame(&ksig, sigmask_to_save(), regs); ret = setup_frame(&ksig, sigmask_to_save(), regs);
signal_setup_done(ret, &ksig, 0); signal_setup_done(ret, &ksig, 0);
if (current->ptrace & PT_SINGLESTEP) if (test_thread_flag(TIF_SINGLESTEP))
task_pt_regs(current)->icountlevel = 1; task_pt_regs(current)->icountlevel = 1;
return; return;
...@@ -499,7 +499,7 @@ static void do_signal(struct pt_regs *regs) ...@@ -499,7 +499,7 @@ static void do_signal(struct pt_regs *regs)
/* If there's no signal to deliver, we just restore the saved mask. */ /* If there's no signal to deliver, we just restore the saved mask. */
restore_saved_sigmask(); restore_saved_sigmask();
if (current->ptrace & PT_SINGLESTEP) if (test_thread_flag(TIF_SINGLESTEP))
task_pt_regs(current)->icountlevel = 1; task_pt_regs(current)->icountlevel = 1;
return; return;
} }
......
...@@ -46,12 +46,6 @@ extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr, ...@@ -46,12 +46,6 @@ extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,
#define PT_EXITKILL (PTRACE_O_EXITKILL << PT_OPT_FLAG_SHIFT) #define PT_EXITKILL (PTRACE_O_EXITKILL << PT_OPT_FLAG_SHIFT)
#define PT_SUSPEND_SECCOMP (PTRACE_O_SUSPEND_SECCOMP << PT_OPT_FLAG_SHIFT) #define PT_SUSPEND_SECCOMP (PTRACE_O_SUSPEND_SECCOMP << PT_OPT_FLAG_SHIFT)
/* single stepping state bits (used on ARM and PA-RISC) */
#define PT_SINGLESTEP_BIT 31
#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT)
#define PT_BLOCKSTEP_BIT 30
#define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT)
extern long arch_ptrace(struct task_struct *child, long request, extern long arch_ptrace(struct task_struct *child, long request,
unsigned long addr, unsigned long data); unsigned long addr, unsigned long data);
extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment