Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 2007 10:15:30 +0100
From:      Divacky Roman <xdivac02@stud.fit.vutbr.cz>
To:        Scot Hetzel <swhetzel@gmail.com>
Cc:        emulation@freebsd.org, Alexander Leidinger <Alexander@leidinger.net>
Subject:   Re: linuxolator: fatal trap 12 when compiling libX11
Message-ID:  <20070117091530.GA48578@stud.fit.vutbr.cz>
In-Reply-To: <790a9fff0701162000s5f48d51fk2e5a4a74bd7021f9@mail.gmail.com>
References:  <790a9fff0701151314x6dd48ecbg90a54729813e84e@mail.gmail.com> <20070116080015.8dus0vamssso0sww@webmail.leidinger.net> <790a9fff0701161005t75222f2l439e8c0c1153ffd2@mail.gmail.com> <20070116181839.GA80994@stud.fit.vutbr.cz> <790a9fff0701161317q74b28955jf61b6e9651168a36@mail.gmail.com> <20070116221150.GA9429@stud.fit.vutbr.cz> <790a9fff0701162000s5f48d51fk2e5a4a74bd7021f9@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 16, 2007 at 10:00:21PM -0600, Scot Hetzel wrote:
> On 1/16/07, Divacky Roman <xdivac02@stud.fit.vutbr.cz> wrote:
> >please test this patch:
> >
> >Index: linux_emul.c
> >===================================================================
> >RCS file: /home/ncvs/src/sys/compat/linux/linux_emul.c,v
> >retrieving revision 1.12
> >diff -u -r1.12 linux_emul.c
> >--- linux_emul.c        7 Jan 2007 19:09:20 -0000       1.12
> >+++ linux_emul.c        16 Jan 2007 22:11:06 -0000
> >@@ -170,7 +170,8 @@
> >        EMUL_UNLOCK(&emul_lock);
> >
> >        EMUL_SHARED_WLOCK(&emul_shared_lock);
> >-       LIST_REMOVE(em, threads);
> >+       if (!LIST_EMPTY(em->shared->threads)
> 
> Wouldn't compile as shown above (complained about '->' when
> compiling), changed it to:
> 
>             if (!LIST_EMPTY(&em->shared->threads))
> 
> but now I'm getting:
> 
> Fatal trap 9: general protection fault while in kernel mode
> cpuid = 0; apic id = 00
> instruction pointer     = 0x8:0xffffffffa2cb3b2c
> stack pointer           = 0x10:0xffffffffa3135ad0
> frame pointer           = 0x10:0xffffffffa3135b10
> code segment            = base 0x0, limit 0xfffff, type 0x1b
>                        = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags        = interrupt enabled, resume, IOPL = 0
> current process         = 20225 (bash)
> panic: from debugger
> cpuid = 0
> Uptime: 9m59s
> Physical memory: 1008 MB
> 
> (kgdb) list *0xffffffffa2cb3b2c
> 0xffffffffa2cb3b2c is in linux_proc_init
> (/usr/src/7x/sys-orig/modules/linux/../../compat/linux/linux_emul.c:138).
> 133                     }
> 134             }
> 135             if (child != 0) {
> 136                     EMUL_UNLOCK(&emul_lock);
> 137                     EMUL_SHARED_WLOCK(&emul_shared_lock);
> 138                     LIST_INSERT_HEAD(&em->shared->threads, em, threads);
> 139                     EMUL_SHARED_WUNLOCK(&emul_shared_lock);
> 140
> 141                     p = pfind(child);
> 142                     /* we might have a sleeping linux_schedtail */
> (kgdb) bt
> #0  doadump () at pcpu.h:172
> During symbol reading, Incomplete CFI data; unspecified registers at
> 0xffffffff80445bbc.
> #1  0xffffffff804464b9 in boot (howto=0x104) at
> ../../../kern/kern_shutdown.c:411
> #2  0xffffffff80445f47 in panic (fmt=0xffffffff806a82a7 "from
> debugger") at ../../../kern/kern_shutdown.c:567
> #3  0xffffffff801ac8c7 in db_panic (addr=0x0, have_addr=0x0,
> count=0x0, modif=0x0) at ../../../ddb/db_command.c:433
> #4  0xffffffff801acd69 in db_command_loop () at 
> ../../../ddb/db_command.c:401
> #5  0xffffffff801aec73 in db_trap (type=0xa3135830, code=0x0) at
> ../../../ddb/db_main.c:222
> #6  0xffffffff8046c428 in kdb_trap (type=0x9, code=0x0,
> tf=0xffffffffa3135a20) at ../../../kern/subr_kdb.c:502
> #7  0xffffffff80654f41 in trap_fatal (frame=0xffffffffa3135a20,
> eva=0xffffff002d1d9290)
>    at ../../../amd64/amd64/trap.c:691
> #8  0xffffffff8065551a in trap (frame=0xffffffffa3135a20) at
> ../../../amd64/amd64/trap.c:499
> #9  0xffffffff8063d39e in calltrap () at 
> ../../../amd64/amd64/exception.S:169
> #10 0xffffffffa2cb3b2c in linux_proc_init (td=0xffffff002d1d9290,
> child=0x4f5c, flags=0x0)
>    at /usr/src/7x/sys-orig/modules/linux/../../compat/linux/linux_emul.c:138
> #11 0xffffffffa2cbb810 in linux_fork (td=0xffffff002d1d9290, args=0x0)
>    at 
>    /usr/src/7x/sys-orig/modules/linux/../../amd64/linux32/linux32_machdep.c:467
> #12 0xffffffff8068e0a0 in ia32_syscall (frame=0xffffffffa3135c80) at
> ../../../amd64/ia32/ia32_syscall.c:187
> #13 0xffffffff8063d780 in Xint0x80_syscall () at ia32_exception.S:65
> #14 0x0000000028192358 in ?? ()
> Previous frame inner to this frame (corrupt stack?)
> (kgdb) frame 10
> #10 0xffffffffa2cb3b2c in linux_proc_init (td=0xffffff002d1d9290,
> child=0x4f5c, flags=0x0)
>    at /usr/src/7x/sys-orig/modules/linux/../../compat/linux/linux_emul.c:138
> 138                     LIST_INSERT_HEAD(&em->shared->threads, em, threads);
> (kgdb) p &em->shared->threads
> $1 = (struct {...} *) 0xdeadc0dedeadc0e6
> (kgdb) p *em
> $3 = {
>  pid = 0xdeadc0de,
>  child_set_tid = 0x0,
>  child_clear_tid = 0x0,
>  shared = 0xdeadc0dedeadc0de,
>  pdeath_signal = 0xdeadc0de,
>  threads = {
>    le_next = 0xdeadc0dedeadc0de,
>    le_prev = 0xdeadc0dedeadc0de
>  }
> }

scot, please test this patch and report me what it prints out 
just before the panic, btw.. your machine is SMP?

thnx

Index: linux_emul.c
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_emul.c,v
retrieving revision 1.12
diff -u -r1.12 linux_emul.c
--- linux_emul.c        7 Jan 2007 19:09:20 -0000       1.12
+++ linux_emul.c        17 Jan 2007 09:13:08 -0000
@@ -133,8 +133,11 @@
                }
        }
        if (child != 0) {
+               printf("before: %p\n", em->shared);
                EMUL_UNLOCK(&emul_lock);
+               printf("after1: %p\n", em->shared);
                EMUL_SHARED_WLOCK(&emul_shared_lock);
+               printf("after2: %p\n", em->shared);
                LIST_INSERT_HEAD(&em->shared->threads, em, threads);
                EMUL_SHARED_WUNLOCK(&emul_shared_lock);

@@ -170,7 +173,8 @@
        EMUL_UNLOCK(&emul_lock);

        EMUL_SHARED_WLOCK(&emul_shared_lock);
-       LIST_REMOVE(em, threads);
+       if (!LIST_EMPTY(&em->shared->threads))
+               LIST_REMOVE(em, threads);

        PROC_LOCK(p);
        p->p_emuldata = NULL;








Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070117091530.GA48578>