Re: [uml-devel] [UML] Problems building and running 2.6.17-rc4 on x86-64

From: Jeff Dike
Date: Tue May 16 2006 - 15:11:49 EST


On Mon, May 15, 2006 at 12:29:58PM -0300, Alberto Bertogli wrote:
> Sure, here it is:
> (gdb) disas stub_segv_handler

Sorry, I misread the error message and asked for the wrong thing.
Your UML is seeing a process segfault during a system call, before the
SIGTRAP expected at the end of the system call. I don't know what's
happening there.

Can you apply the following patch, which will just give you a register
dump of the process, and send me the output?

Index: linux-2.6.16/arch/um/os-Linux/skas/process.c
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/skas/process.c
+++ linux-2.6.16/arch/um/os-Linux/skas/process.c
@@ -45,6 +45,22 @@ int is_skas_winch(int pid, int fd, void
return(1);
}

+static int ptrace_dump_regs(int pid)
+{
+ unsigned long regs[HOST_FRAME_SIZE];
+ int i;
+
+ if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
+ return -errno;
+ else {
+ printk("Stub registers -\n");
+ for(i = 0; i < HOST_FRAME_SIZE; i++)
+ printk("\t%d - %lx\n", i, regs[i]);
+ }
+
+ return 0;
+}
+
void wait_stub_done(int pid, int sig, char * fname)
{
int n, status, err;
@@ -68,18 +84,10 @@ void wait_stub_done(int pid, int sig, ch

if((n < 0) || !WIFSTOPPED(status) ||
(WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
- unsigned long regs[HOST_FRAME_SIZE];
-
- if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
- printk("Failed to get registers from stub, "
- "errno = %d\n", errno);
- else {
- int i;
-
- printk("Stub registers -\n");
- for(i = 0; i < HOST_FRAME_SIZE; i++)
- printk("\t%d - %lx\n", i, regs[i]);
- }
+ err = ptrace_dump_regs(pid);
+ if(err)
+ printk("Failed to get registers from stub, "
+ "errno = %d\n", -err);
panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
"pid = %d, n = %d, errno = %d, status = 0x%x\n",
fname, pid, n, errno, status);
@@ -146,9 +154,14 @@ static void handle_trap(int pid, union u

CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
if((err < 0) || !WIFSTOPPED(status) ||
- (WSTOPSIG(status) != SIGTRAP + 0x80))
+ (WSTOPSIG(status) != SIGTRAP + 0x80)){
+ err = ptrace_dump_regs(pid);
+ if(err)
+ printk("Failed to get registers from process, "
+ "errno = %d\n", -err);
panic("handle_trap - failed to wait at end of syscall, "
"errno = %d, status = %d\n", errno, status);
+ }
}

handle_syscall(regs);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/