Commit 29af4232 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: clear singlestep

The patch syscall-security-3 is wrong (provided by me, sorry).  I missed,
that singlestepping_skas() used to reset PT_DTRACE.  This was handled
differently in tt and skas.  With syscall-security-3 applied, a process in
SKAS that singlestepped once continues to singlestep until the next
systemcall occurs, even if it is resumed with PTRACE_CONT or
PTRACE_SYSCALL.

This fix unifies the usage of PT_DTRACE in TT and SKAS.  PT_DTRACE now is
set by ptrace(PTRACE_SINGLESTEP,...) and reset by singlestepping() and it
is evaluated in kern_do_signal().
Signed-off-by: default avatarBodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c91d2220
...@@ -459,9 +459,15 @@ int singlestepping(void * t) ...@@ -459,9 +459,15 @@ int singlestepping(void * t)
{ {
struct task_struct *task = t ? t : current; struct task_struct *task = t ? t : current;
if ( ! (task->ptrace & PT_DTRACE) )
return(0);
task->ptrace &= ~PT_DTRACE;
if (task->thread.singlestep_syscall) if (task->thread.singlestep_syscall)
return(0); return(0);
return(task->ptrace & PT_DTRACE);
return 1;
} }
/* /*
......
...@@ -30,7 +30,6 @@ long execute_syscall_skas(void *r) ...@@ -30,7 +30,6 @@ long execute_syscall_skas(void *r)
if(current->thread.singlestep_syscall){ if(current->thread.singlestep_syscall){
current->thread.singlestep_syscall = 0; current->thread.singlestep_syscall = 0;
current->ptrace &= ~PT_DTRACE;
force_sig(SIGTRAP, current); force_sig(SIGTRAP, current);
} }
......
...@@ -24,7 +24,6 @@ extern void set_init_pid(int pid); ...@@ -24,7 +24,6 @@ extern void set_init_pid(int pid);
extern int set_user_mode(void *task); extern int set_user_mode(void *task);
extern void set_tracing(void *t, int tracing); extern void set_tracing(void *t, int tracing);
extern int is_tracing(void *task); extern int is_tracing(void *task);
extern void clear_singlestep(void *t);
extern void syscall_handler(int sig, union uml_pt_regs *regs); extern void syscall_handler(int sig, union uml_pt_regs *regs);
extern void exit_kernel(int pid, void *task); extern void exit_kernel(int pid, void *task);
extern int do_syscall(void *task, int pid, int local_using_sysemu); extern int do_syscall(void *task, int pid, int local_using_sysemu);
......
...@@ -523,13 +523,6 @@ void set_init_pid(int pid) ...@@ -523,13 +523,6 @@ void set_init_pid(int pid)
-err); -err);
} }
void clear_singlestep(void *t)
{
struct task_struct *task = t;
task->ptrace &= ~PT_DTRACE;
}
int start_uml_tt(void) int start_uml_tt(void)
{ {
void *sp; void *sp;
......
...@@ -125,7 +125,6 @@ long execute_syscall_tt(void *r) ...@@ -125,7 +125,6 @@ long execute_syscall_tt(void *r)
if(current->thread.singlestep_syscall){ if(current->thread.singlestep_syscall){
current->thread.singlestep_syscall = 0; current->thread.singlestep_syscall = 0;
current->ptrace &= ~PT_DTRACE;
force_sig(SIGTRAP, current); force_sig(SIGTRAP, current);
} }
......
...@@ -336,7 +336,6 @@ int tracer(int (*init_proc)(void *), void *sp) ...@@ -336,7 +336,6 @@ int tracer(int (*init_proc)(void *), void *sp)
tracing = 0; tracing = 0;
if(do_syscall(task, pid, local_using_sysemu)) if(do_syscall(task, pid, local_using_sysemu))
sig = SIGUSR2; sig = SIGUSR2;
else clear_singlestep(task);
break; break;
case SIGPROF: case SIGPROF:
if(tracing) sig = 0; if(tracing) sig = 0;
......
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