kern/52198: Kernel trap 12 when debugging fork() with ald
[/usr/ports/devel/ald]
Thomas Moestl
t.moestl at tu-bs.de
Tue May 13 18:20:18 PDT 2003
The following reply was made to PR kern/52198; it has been noted by GNATS.
From: Thomas Moestl <t.moestl at tu-bs.de>
To: Lolownia <lolownia at polbox.com>
Cc: FreeBSD-gnats-submit at freebsd.org
Subject: Re: kern/52198: Kernel trap 12 when debugging fork() with ald [/usr/ports/devel/ald]
Date: Wed, 14 May 2003 03:19:24 +0200
On Wed, 2003/05/14 at 00:36:36 +0200, Lolownia wrote:
>
> >Number: 52198
> >Category: kern
> >Synopsis: Kernel trap 12 when debugging fork() with ald [/usr/ports/devel/ald]
> [...]
> When stepping through simple assembler program with fork() syscall,
> system drops into DDB
> db> trace
> sw1b(2f,2f,2f,bfbff64c,bfbff654) at sw1b+0xa9
> fork_trampoline() at fork_trampoline
> --- trap 0xa, eip = 0x804849c, esp = 0xbfbff628, ebp = 0xbfbff644 ---
This is a bug in cpu_fork(); it bogusly bases the kernel eflags to be
set for a new process on the user eflags of the forking process (since
a commit which seems to originally have been intended to clear PSL_I,
about a year ago).
The patch below should fix this; it will just use a sane initial
value, since cloning the forking process' kernel eflags (as was done
before the commit mentioned above) does not really make sense
either. This will also avoid possible problems due to proc0's pcb_psl
being unitialized.
- Thomas
--
Thomas Moestl <t.moestl at tu-bs.de> http://www.tu-bs.de/~y0015675/
<tmm at FreeBSD.org> http://people.FreeBSD.org/~tmm/
PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C
Index: vm_machdep.c
===================================================================
RCS file: /d/ncvs/src/sys/i386/i386/vm_machdep.c,v
retrieving revision 1.206
diff -u -r1.206 vm_machdep.c
--- vm_machdep.c 21 Apr 2003 15:05:05 -0000 1.206
+++ vm_machdep.c 14 May 2003 00:47:49 -0000
@@ -181,7 +181,7 @@
pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *);
pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */
pcb2->pcb_eip = (int)fork_trampoline;
- pcb2->pcb_psl = td2->td_frame->tf_eflags & ~PSL_I; /* ints disabled */
+ pcb2->pcb_psl = PSL_KERNEL; /* ints disabled */
pcb2->pcb_gs = rgs();
/*-
* pcb2->pcb_dr*: cloned above.
More information about the freebsd-bugs
mailing list