From owner-freebsd-emulation@FreeBSD.ORG  Wed Jan 17 04:00:22 2007
Return-Path: <owner-freebsd-emulation@FreeBSD.ORG>
X-Original-To: emulation@freebsd.org
Delivered-To: freebsd-emulation@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8CAA916A412
	for <emulation@freebsd.org>; Wed, 17 Jan 2007 04:00:22 +0000 (UTC)
	(envelope-from swhetzel@gmail.com)
Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.234])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BFA013C45B
	for <emulation@freebsd.org>; Wed, 17 Jan 2007 04:00:22 +0000 (UTC)
	(envelope-from swhetzel@gmail.com)
Received: by nz-out-0506.google.com with SMTP id i11so343956nzh
	for <emulation@freebsd.org>; Tue, 16 Jan 2007 20:00:21 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta;
	h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
	b=b8x35iq0FquKxsw6r6CyK5o0lvbqoezqmFEBkDh7G7f80jalWq8ArFaZbZugfh1qxGKFDJS2R2wmTXWkZq3CTtBgf8gdQUaqKbibyZAXMS9WgCTwJyHeYL+kfjZqPnSL0kJeXxCuGI5kkbsUpi78gbVBszNjW/k7a8fvuuDcXCg=
Received: by 10.65.23.3 with SMTP id a3mr2536234qbj.1169006421344;
	Tue, 16 Jan 2007 20:00:21 -0800 (PST)
Received: by 10.65.189.7 with HTTP; Tue, 16 Jan 2007 20:00:21 -0800 (PST)
Message-ID: <790a9fff0701162000s5f48d51fk2e5a4a74bd7021f9@mail.gmail.com>
Date: Tue, 16 Jan 2007 22:00:21 -0600
From: "Scot Hetzel" <swhetzel@gmail.com>
To: "Divacky Roman" <xdivac02@stud.fit.vutbr.cz>
In-Reply-To: <20070116221150.GA9429@stud.fit.vutbr.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
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>
Cc: emulation@freebsd.org, Alexander Leidinger <Alexander@leidinger.net>
Subject: Re: linuxolator: fatal trap 12 when compiling libX11
X-BeenThere: freebsd-emulation@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Development of Emulators of other operating systems
	<freebsd-emulation.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-emulation>, 
	<mailto:freebsd-emulation-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-emulation>
List-Post: <mailto:freebsd-emulation@freebsd.org>
List-Help: <mailto:freebsd-emulation-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-emulation>, 
	<mailto:freebsd-emulation-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jan 2007 04:00:22 -0000

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
-- 
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.