Skip to content

Commit

Permalink
[PATCH] uml: fix strace -f
Browse files Browse the repository at this point in the history
It turns out that we need to check for pending signals when a newly forked
process is run for the first time.  With strace -f, strace needs to know about
the forked process before it gets going.  If it doesn't, then it ptraces some
bogus values into its registers, and the process segfaults.  So, I added calls
to interrupt_end, which does that, plus checks for reschedules.  There
shouldn't be any of those, but x86 does the same thing, so I'm copying that
behavior to be safe.

Signed-off-by: Jeff Dike <[email protected]>
Cc: Paolo 'Blaisorblade' Giarrusso <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
cfd-36 authored and Linus Torvalds committed Jun 8, 2005
1 parent da00d9a commit 501cb02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/um/kernel/skas/process_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ void new_thread_handler(int sig)
* 0 if it just exits
*/
n = run_kernel_thread(fn, arg, &current->thread.exec_buf);
if(n == 1)
if(n == 1){
/* Handle any immediate reschedules or signals */
interrupt_end();
userspace(&current->thread.regs.regs);
}
else do_exit(0);
}

Expand All @@ -96,6 +99,8 @@ void fork_handler(int sig)
schedule_tail(current->thread.prev_sched);
current->thread.prev_sched = NULL;

/* Handle any immediate reschedules or signals */
interrupt_end();
userspace(&current->thread.regs.regs);
}

Expand Down

0 comments on commit 501cb02

Please sign in to comment.