Re: A patch for the file kernel/fork.c

From: André Pereira de Almeida
Date: Wed May 04 2005 - 14:07:01 EST


Chris Wedgwood wrote:

On Wed, May 04, 2005 at 03:26:44PM -0300, Andr? Pereira de Almeida wrote:



- if (tsk->clear_child_tid && atomic_read(&mm->mm_users) > 1) {
+ if (mm && tsk->clear_child_tid && atomic_read(&mm->mm_users) > 1)





In a preemptible kernel with the serport module and a serial port try to
run the following program:

int main(int argc, char **argv)
{
int ldisc,fd;

fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NONBLOCK);
ldisc = N_MOUSE;
ioctl(fd, TIOCSETD, &ldisc);
read(fd, NULL, 0);
return 0;
}

and kill it. In my case it will hang the computer. I think this is
a problem with the serport module. With this patch, the serial mouse
stop working, but the computer don't hang.



then above something like:

BUG_ON(!mm);

or something might be better and eyeball the stack trace.


In my example, a stack trace will be already generated by an oops:
[4300748.423000] Unable to handle kernel paging request at virtual address 6b6b6b7b
[4300748.423000] printing eip:
[4300748.423000] d0927366
[4300748.423000] *pde = 00000000
[4300748.423000] Oops: 0000 [#1]
[4300748.423000] PREEMPT
and so on, with a call trace:
[4300748.423000] Call Trace:
[4300748.423000] [<c0104bfa>] show_stack+0x7a/0x90
[4300748.423000] [<c0104d7d>] show_registers+0x14d/0x1b0
[4300748.423000] [<c0104fcc>] die+0x14c/0x2c0
[4300748.423000] [<c0118b6f>] do_page_fault+0x31f/0x638
[4300748.423000] [<c01046df>] error_code+0x4f/0x54
[4300748.423000] [<c02b88fd>] tty_wakeup+0x5d/0x60

I think that maybe it's good to put a:
WARN_ON(!mm);
but a BUG_ON or without this patch, the kernel will halt, even if the problem is not so severe.
André.
-
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/