Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56878
b: refs/heads/master
c: cf6aced
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed May 24, 2007
1 parent f2c3901 commit 5ceb6d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da90fa8ff671a0139772ec3b3e82c06077e82122
refs/heads/master: cf6acedbeac17dea1c1eed85048a72e188f3f768
24 changes: 16 additions & 8 deletions trunk/arch/um/os-Linux/start_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
int exit_with = WEXITSTATUS(status);
if (exit_with == 2)
non_fatal("check_ptrace : child exited with status 2. "
"Serious trouble happening! Try updating "
"your host skas patch!\nDisabling SYSEMU "
"support.");
"\nDisabling SYSEMU support.\n");
non_fatal("check_ptrace : child exited with exitcode %d, while "
"expecting %d; status 0x%x\n", exit_with,
exitcode, status);
Expand Down Expand Up @@ -209,6 +207,7 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
static void __init check_sysemu(void)
{
void *stack;
unsigned long regs[MAX_REG_NR];
int pid, n, status, count=0;

non_fatal("Checking syscall emulation patch for ptrace...");
Expand All @@ -225,11 +224,20 @@ static void __init check_sysemu(void)
fatal("check_sysemu : expected SIGTRAP, got status = %d",
status);

n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
os_getpid());
if(n < 0)
fatal_perror("check_sysemu : failed to modify system call "
"return");
if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
fatal_perror("check_sysemu : PTRACE_GETREGS failed");
if(PT_SYSCALL_NR(regs) != __NR_getpid){
non_fatal("check_sysemu got system call number %d, "
"expected %d...", PT_SYSCALL_NR(regs), __NR_getpid);
goto fail;
}

n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid());
if(n < 0){
non_fatal("check_sysemu : failed to modify system call "
"return");
goto fail;
}

if (stop_ptraced_child(pid, stack, 0, 0) < 0)
goto fail_stopped;
Expand Down

0 comments on commit 5ceb6d5

Please sign in to comment.