2005-04-24 01:50:52

by mbellett

[permalink] [raw]
Subject: PROBLEM: Kernel BUG() in exit.c in ptrace/pthread interaction

When you run the program in attachment, *even as an ordinary user*, the kernel
panic. Tested kernel is a 2.6.11.7 vanilla with alleged .config. Tested with
similar configuration on both a qemu machine and a real one (only fs changes).
The code is taken by a program of mine, and slightly simplified, but don't
trust comments.

Keywords: ptrace, (p)thread
Kernel version: 2.6.11.7 vanilla
Output:

When the program is run, the kernel triggers a BUG(), and the following one is
repeated quite a lot of times, with increasing Call Trace:

------------[ cut here ]------------
kernel BUG at kernel/exit.c:520!
invalid operand: 0000 [#1]
CPU: 0
EIP: 0060:[<c0110cd0>] Not tainted VLI
EFLAGS: 00000046 (2.6.11.7-crasher)
EIP is at exit_notify+0x5c0/0x840
eax: d7fffb04 ebx: d7fffaa0 ecx: 00000000 edx: d7fff5fc
esi: d7fff5a0 edi: d75b8540 ebp: d7fff5a0 esp: d6fadf54
ds: 007b es: 007b ss: 0068
Process ptrace-thread-f (pid: 808, threadinfo=d6fac000 task=d7fff5a0)
Stack: c010d3b0 b7e9d2e8 00000001 d7fff5fc d7fff640 00000000 00000000 d7fff5fc
d6fadf74 d6fadf74 c138a560 d7fff5a0 00000000 00000000 c0111067 d7fff5a0
d6fac000 c01184d4 c0118ebe d6fac000 00000000 b7fc8934 d6fac000 c0111244
Call Trace:
[<c010d3b0>] mm_release+0x90/0xa0
[<c0111067>] do_exit+0x117/0x280
[<c01184d4>] signal_wake_up+0x24/0x30
[<c0118ebe>] zap_other_threads+0x5e/0xb0
[<c0111244>] do_group_exit+0x34/0x70
[<c0102483>] syscall_call+0x7/0xb
Code: 0f 85 79 ff ff ff eb dc 8d 76 00 89 5c 24 08 31 c0 89 44 24 04 8b 83 84 00 00 00 89 04 24 e8 48 82 00 00 e9 0c fc ff ff 8d 76 00 <0f> 0b 08 02 ff cc 27 c0 e9 da fb ff ff 8d 76 00 0f 0b 05 02 ff
------------[ cut here ]------------

Last time this appears, before outputting '=======================' endlessly,
has this form:

------------[ cut here ]------------
kernel BUG at kernel/exit.c:520!
invalid operand: 0000 [#19]
CPU: 0
EIP: 0060:[<c0110cd0>] Not tainted VLI
EFLAGS: 00000046 (2.6.11.7-crasher)
EIP is at exit_notify+0x5c0/0x840
eax: d7fffb04 ebx: d7fffaa0 ecx: d7fff5a0 edx: d7fff5fc
esi: d7fff5a0 edi: d75b8540 ebp: d7fff5a0 esp: d6fac2a4
ds: 007b es: 007b ss: 0068
Process ptrace-thread-f (pid: 808, threadinfo=d6fac000 task=d7fff5a0)
Stack: 0000000a d7fff5a0 c011356b d7fff5fc d7fff640 c027bc4c c0103130 d7fff5fc
d6fac2c4 d6fac2c4 00000000 d7fff5a0 0000000b 00000000 c0111067 d7fff5a0
d7fff5a0 ffffffff 0000007b d6fac000 00000000 c0103130 d7fff5a0 c0102d5e
Call Trace:
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c019b912>] __delay+0x12/0x20
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c01be900>] i8042_timer_func+0x0/0x20
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c01be900>] i8042_timer_func+0x0/0x20
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010c10d>] scheduler_tick+0x23d/0x290
[<c01172a2>] update_process_times+0x32/0x110
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c01064c4>] timer_interrupt+0x54/0xf0
[<c011351e>] __do_softirq+0x2e/0x90
[<c0124020>] handle_IRQ_event+0x30/0x70
[<c01240b1>] __do_IRQ+0x51/0xf0
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c01064c4>] timer_interrupt+0x54/0xf0
[<c011351e>] __do_softirq+0x2e/0x90
[<c0124020>] handle_IRQ_event+0x30/0x70
[<c01240b1>] __do_IRQ+0x51/0xf0
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c01064c4>] timer_interrupt+0x54/0xf0
[<c011351e>] __do_softirq+0x2e/0x90
[<c0124020>] handle_IRQ_event+0x30/0x70
[<c01240b1>] __do_IRQ+0x51/0xf0
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c019b912>] __delay+0x12/0x20
[<c01c4ea0>] serial8250_console_write+0x160/0x250
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c010b6d2>] activate_task+0x62/0x80
[<c010bf6e>] scheduler_tick+0x9e/0x290
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c011356b>] __do_softirq+0x7b/0x90
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0111067>] do_exit+0x117/0x280
[<c0103130>] do_invalid_op+0x0/0xd0
[<c0102d5e>] die+0x14e/0x150
[<c01031e2>] do_invalid_op+0xb2/0xd0
[<c0121b12>] get_futex_key+0x42/0x160
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c0121d26>] futex_wake+0x46/0xd0
[<c012252c>] do_futex+0x6c/0xa0
[<c010262b>] error_code+0x2b/0x30
[<c0110cd0>] exit_notify+0x5c0/0x840
[<c010d3b0>] mm_release+0x90/0xa0
[<c0111067>] do_exit+0x117/0x280
[<c01184d4>] signal_wake_up+0x24/0x30
[<c0118ebe>] zap_other_threads+0x5e/0xb0
[<c0111244>] do_group_exit+0x34/0x70
[<c0102483>] syscall_call+0x7/0xb
=======================

Software:
kernel was compiled under a system with the following characteristics:

>>>
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux ale 2.6.10-as3-virtuale #1 SMP Wed Feb 9 13:43:48 CET 2005 i686 GNU/Linux

Gnu C 3.3.5
Gnu make 3.80
binutils 2.15
util-linux 2.12
mount 2.12
module-init-tools 3.2-pre1
e2fsprogs 1.35
reiserfsprogs line
reiser4progs line
xfsprogs 2.6.20
quota-tools 3.12.
nfs-utils 1.0.6
Linux C Library 2.3.2
Dynamic linker (ldd) 2.3.2
Procps 3.2.1
Net-tools 1.60
Console-tools 0.2.3
Sh-utils 5.2.1
./scripts/ver_linux: line 90: udevinfo: command not found
Modules Loaded
>>>

And run on a qemu machine, between the others:

>>>
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux ubuntu-zoo 2.6.11.7-crasher #1 Tue Apr 19 22:08:08 CEST 2005 i686 GNU/Linux

Gnu C 3.3.4
Gnu make 3.80
binutils 2.14.90.0.7
util-linux 2.12
mount 2.12
module-init-tools 3.1-pre2
e2fsprogs 1.35
jfsutils 1.1.4
reiserfsprogs 3.6.17
reiser4progs 0.5.3
xfsprogs 2.6.18
Linux C Library 2.3.2
Dynamic linker (ldd) 2.3.2
Procps 3.2.1
Net-tools 1.60
Console-tools 0.2.3
Sh-utils 5.0.91
udev 026
>>>

But in fact I tried the original program (which shows the same behaviour) on at
least other two hardwares, with similar results, and this cut down version on
both qemu and my hardware, so I think it's quite indipendent.

I'm not subscribed to lkml, so please CC me in this thread.

--
Mat/tia Belletti - Graduate student @ cs.unibo.it
ICQ: 33292311 - email: [email protected]
IRC: RedGlow - site(s): http://mbellett.web.cs.unibo.it/
[email protected]/Gaim - Linux user 299762 @ machine 213003


Attachments:
(No filename) (13.62 kB)
ptrace-thread-bug.c (4.25 kB)
config-2.6.11.7-crasher (15.85 kB)
Download all attachments

2005-04-24 01:59:55

by Jesper Juhl

[permalink] [raw]
Subject: Re: PROBLEM: Kernel BUG() in exit.c in ptrace/pthread interaction

On Sun, 24 Apr 2005 [email protected] wrote:

> When you run the program in attachment, *even as an ordinary user*, the kernel
> panic. Tested kernel is a 2.6.11.7 vanilla with alleged .config. Tested with

Just tried running it on my box here with a 2.6.12-rc2-mm3 kernel and it
survived just fine.
Here's what I did and the output I got :

$ gcc -lpthread ptrace-thread-bug.c
ptrace-thread-bug.c:158:2: warning: no newline at end of file
$ ./a.out
child: pid=5664
child: self sigstopping
father: pid=5663
father: waiting child's selfstopping
father: making child go again under ptrace
father: detaching
father: thread creation
father: waiting for end
thread 16386: attaching
thread 16386: unlocking
father: destroying semaphore
father: all done
thread 16386: unlocking child
$

--
Jesper Juhl

2005-04-24 08:41:28

by Mike Galbraith

[permalink] [raw]
Subject: Re: PROBLEM: Kernel BUG() in exit.c in ptrace/pthread interaction

At 04:02 AM 4/24/2005 +0200, Jesper Juhl wrote:
>On Sun, 24 Apr 2005 [email protected] wrote:
>
> > When you run the program in attachment, *even as an ordinary user*, the
> kernel
> > panic. Tested kernel is a 2.6 vanilla with alleged .config. Tested with
>
>Just tried running it on my box here with a 2.6.12-rc2-mm3 kernel and it
>survived just fine.

Works fine here too running a 2.6.11.7 kernel, built with both gcc-2.95.3
and gcc-3.4.3. FWIW, If I had this problem, the first thing I'd try is
building with good old 2.95.3. My box didn't much care for gcc-3.3.x.

-Mike