On martedì 27 marzo 2007, Pravin wrote:
> > Hmm, I published a 2.6.18 -bs patchset time ago with some bugfixes, and
> > some other were merged into -stable, so you may want to try these. CKRM
> > will still work with them (98 % sure).

> I tried both of the following patches on vanilla 2.6.18 kernel.
> (Without CKRM patch)
> http://www.user-mode-linux.org/~blaisorblade/patches/guest/uml-2.6.18.1-bb2
>/uml-2.6.18.1-bb2.patch.bz2 and
> http://www.user-mode-linux.org/~blaisorblade/patches/guest/uml-2.6.18-bb1/u
>ml-2.6.18-bb1.patch.bz2

> But still it UML didnt worked.
> I used GDB to locate the point where it is failing, so i got following.
> {{{
> (gdb) bt
> #0  __const_udelay (usecs=4295000) at arch/um/sys-i386/delay.c:36
> #1  0x0806c878 in panic (fmt=0x804e79c "\203�\024h;�\035\b��\226") at
> kernel/panic.c:137
> #2  0x0804e79c in check_ptrace ()
> #3  0x0806384b in os_early_checks () at include/linux/timer.h:41
> #4  0x0805c1c3 in linux_main (argc=1, argv=0xafdc3e24) at
> arch/um/kernel/um_arch.c:352
> #5  0x08061fb2 in main () at include/linux/timer.h:41
> (gdb)
> }}}
>
> So, what I concluded from this that, panic is getting called from
> "check_ptrace" function.
>
> To find out why exactly panic is getting called, I added few printf
> statements in "check_ptrace" function in
> "arch/um/os-Linux/start_up.c".
> I managed to find out that panic is getting called from
> {{{
> if(!WIFSTOPPED(status) || (WSTOPSIG(status) != (SIGTRAP|0x80)))
>                    panic("check_ptrace : expected (SIGTRAP|0x80), "
>                     "got status = %d", status);
> }}}
> It was not calling panic in first iteration but it was calling in
> second iteration inside while loop, with panic statement as
> {{{
> check_ptrace : expected (SIGTRAP|0x80), got status = 256
> }}}
> At first iteration, the value of status was "34175".

My program decodes it as SIGTRAP|0x80, which is correct.

$ ./waitstatus 34175
WSTOPSIG(status) is 0x80|5
The signal is: Trace/breakpoint trap

> I suppose that it should have passed the condition in following "if
> statement" and should have taken a break in first iteration only.
Yes.

> ///////////////////////////////////////////////////////////////////////////
>// syscall = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET,0);
> if(syscall == __NR_getpid){
>              n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET,
> __NR_getppid);
>             if(n < 0)
>                       panic("check_ptrace : failed to modify system "
>                                  "call, errno = %d", errno);
>            break ;
> }
> ///////////////////////////////////////////////////////////////////////////
>// But the value of syscall in first iteration was 252 but it was
> expected to be 20 (i.e.  __NR_getpid ).
> Value 252 represented "__NR_exit_group"

Hmm, there are some glibc which cache the result of getpid(), so we use 
syscall(getpid). It seems this is happening again here, but it's strange. I 
looked in 2.6.18 source code and the bug had already been fixed.

Can you test if 2.6.17 compiles for you and has this bug?

Now, again, I need to know:

- distribution
- host kernel
- glibc version used
- whether the host processor/distro is a 64-bit one

The only difference in source code between 2.6.18 and 2.6.19 which may be 
related (but I have serious doubts, there shouldn't be different definitions) 
is this:

diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b98d3ca..c692a19 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -7,10 +7,10 @@
 #include <stdio.h>
 #include <errno.h>
 #include <signal.h>
-#include <linux/unistd.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
 #include <sys/mman.h>
+#include <sys/syscall.h>
 #include "ptrace_user.h"
 #include "os.h"
 #include "user.h"

> I am not able to proceed further from this point in debugging this problem.
That's already a lot 
> > nothing of interest. Have you double-checked your compile-time options?
> >
> >
> > Looked at what's happening with strace?
>
> on using strace on uml i got following. But I am not able to make any
> sense out of it :-(

Argh, strace -f breaks UML, but would be what is needed, so strace is useless.

Btw, adding stderr=1 should make UML print its error message in such cases.
-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to