2001-10-02 19:04:12

by Carles Pina i Estany

[permalink] [raw]
Subject: System reset on Kernel 2.4.10


Hi,

I have compiled Kernel 2.4.10 in a Debian Woody/Sid with a Pentium 2 450.

The Kernel works fine. But for error I execute /usr/src/linux/vmlinux as
root user. Then the system is rebooted (without unmounting anything)

Curious.

Then I execute vmlinux as normal user, and the system is rebooted!!!

If I execute this file in Kernel 2.4.6, then tell me "Segmentation
fault"

I copy this file to my laptop computer with Kernel 2.4.10 (Pentium 166
MMX) and execute as user. And reboot the system!

With a 2.4.9 Kernel, tell me "Segmentation fault".

A friend with Pentium 3, too reboot his system.

My /proc/cpuinfo of computer laptop:

carles@pinux:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 5
model : 4
model name : Pentium MMX
stepping : 4
cpu MHz : 167.047
fdiv_bug : no
hlt_bug : no
f00f_bug : yes
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr mce cx8 mmx
bogomips : 333.41

I do:

dd if=vmlinux of=hang bs=1k count=10

and this "mini-file" too reboot the system.

You can get this file here:
http://www.salleurl.edu/~is08139/hang.html
(10 k)

I think that it is some bad instruction for CPU. But I think that Kernel
would control no? and a bad instruction in Pentium MMX (laptop), Pentium
3, and Pentium 2?

Thank you very much, and excuse me my bad English.

If you need more information about systems, configuration, etc. tell me.

----
Carles Pina i Estany | Nick: Pinux / Pine / Teufeus
http://www.salleURL.edu/~is08139/

Tienes menos vocabulario que el diccionario de tarz?n



2001-10-02 19:22:58

by Mika Liljeberg

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

Carles Pina i Estany wrote:

> The Kernel works fine. But for error I execute /usr/src/linux/vmlinux as
> root user. Then the system is rebooted (without unmounting anything)
>
> Curious.

And like a headstrong child, I refused to believe, instead thrusting my
finger into the fire.

Ouch! Curious indeed.

MikaL

2001-10-02 20:10:27

by Denis Vlasenko

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

Tuesday, October 02, 2001, 9:22:49 PM,
Mika Liljeberg <[email protected]> wrote:

ML> Carles Pina i Estany wrote:
>> The Kernel works fine. But for error I execute /usr/src/linux/vmlinux as
>> root user. Then the system is rebooted (without unmounting anything)
>>
>> Curious.

ML> And like a headstrong child, I refused to believe, instead thrusting my
ML> finger into the fire.
ML> Ouch! Curious indeed.

Come on guys, that can't be true! Linux can't fail that miserably!
Look:

# su user
$ ./vmlinux
Segmentation fault
*** screen went blank, then POST screen appears ***

Eh... Oh... So... it actually can. 8-(

Straced vmlinux does not reboot.
Kernel: 2.4.10+ext3+preempt
--
Best regards, VDA
mailto:[email protected]


2001-10-02 20:52:52

by Denis Vlasenko

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

V> # su user
V> $ ./vmlinux
V> Segmentation fault
V> *** screen went blank, then POST screen appears ***

V> Straced vmlinux does not reboot.
V> Kernel: 2.4.10+ext3+preempt

Well... sometimes it reboots too.
Once it rebooted ~10 mins after strace (system was at zero load).
Also it rebooted after two strace's in succession.
--
Best regards, VDA
mailto:[email protected]


2001-10-02 20:59:12

by Carles Pina i Estany

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10



Hi,

> You can get this file here:
> http://www.salleurl.edu/~is08139/hang.html
> (10 k)

It seems that before the "mini-file" was a compressed file.

Now the web is good (with the entire file compressed and the first 10kb of
file decompressed)

Sorry...


----
Carles Pina i Estany | Nick: Pinux / Pine / Teufeus
http://www.salleURL.edu/~is08139/

???Creoquesemehaestropeadolabarraespaciadora!!!

2001-10-02 21:03:12

by Petr Vandrovec

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

On 2 Oct 01 at 23:52, VDA wrote:
> V> Straced vmlinux does not reboot.
> V> Kernel: 2.4.10+ext3+preempt
>
> Well... sometimes it reboots too.
> Once it rebooted ~10 mins after strace (system was at zero load).
> Also it rebooted after two strace's in succession.

Look at fs/binfmt_elf.c, at line 642 (in -ac2). There is

error = elf_map(....)

but nobody bothers with checking error value, it even tries it
to use as an offset if stars are in wrong constellation.
If you could add these lines below the call:

if ((unsigned long)error >= (unsigned long)(-256)) {
set_fs(old_fs);
printk(KERN_DEBUG "Something went wrong with elf_map()\n");
kfree(elf_phdata);
send_sig(SIGSEGV, current, 0);
return 0;
}

and then report results...
Petr Vandrovec
(not willing to test it myself)

2001-10-02 21:06:32

by Kenneth Johansson

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

VDA wrote:

> Tuesday, October 02, 2001, 9:22:49 PM,
> Mika Liljeberg <[email protected]> wrote:
>
> ML> Carles Pina i Estany wrote:
> >> The Kernel works fine. But for error I execute /usr/src/linux/vmlinux as
> >> root user. Then the system is rebooted (without unmounting anything)
> >>
> >> Curious.
>
> ML> And like a headstrong child, I refused to believe, instead thrusting my
> ML> finger into the fire.
> ML> Ouch! Curious indeed.
>
> Come on guys, that can't be true! Linux can't fail that miserably!
> Look:
>
> # su user
> $ ./vmlinux
> Segmentation fault
> *** screen went blank, then POST screen appears ***
>
> Eh... Oh... So... it actually can. 8-(
>

I installed reiserfs this weekend so I tried it and yes me to :))

I have another one that happens with stuff that use SDL (loki stuff) but then
the computer turns off like I had pressed the power button. So I can use both
shutdown -h or plaympeg to turn the computer off :)


2001-10-02 21:41:14

by Petr Vandrovec

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

On Tue, Oct 02, 2001 at 11:02:28PM +0000, Petr Vandrovec wrote:
> On 2 Oct 01 at 23:52, VDA wrote:
> > V> Straced vmlinux does not reboot.
> > V> Kernel: 2.4.10+ext3+preempt
> >
> > Well... sometimes it reboots too.
> > Once it rebooted ~10 mins after strace (system was at zero load).
> > Also it rebooted after two strace's in succession.
>
> Look at fs/binfmt_elf.c, at line 642 (in -ac2). There is
>
> error = elf_map(....)
>
> but nobody bothers with checking error value, it even tries it
> to use as an offset if stars are in wrong constellation.
> If you could add these lines below the call:
>
> if ((unsigned long)error >= (unsigned long)(-256)) {
> set_fs(old_fs);
> printk(KERN_DEBUG "Something went wrong with elf_map()\n");
> kfree(elf_phdata);
> send_sig(SIGSEGV, current, 0);
> return 0;
> }
>
> and then report results...

Well, I was not able to trigger reboot with unpatched kernel. With
patched one behavior looks same to me, except that elf_map went wrong
is printed by kernel.

I was not able to find where problem could be with unpatched
kernel, but arguments passed to do_brk(), set into mm->start_brk,
{start,end}_code and so on looks very suspicious... But as on my
system it does not crash neither with nor without patch below, I
leave answer on someone else.

Btw, my system is 2.4.10-ac2, SMP PIII, compiled with Debian 2.95.4.
Petr Vandrovec
[email protected]


--- linux/fs/binfmt_elf.c.xx Mon Oct 1 18:34:46 2001
+++ linux/fs/binfmt_elf.c Tue Oct 2 23:04:18 2001
@@ -640,7 +640,13 @@
}

error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, elf_prot, elf_flags);
-
+ if ((unsigned long)error >= (unsigned long)(-256)) {
+ set_fs(old_fs);
+ printk(KERN_DEBUG "elf_map went wrong\n");
+ kfree(elf_phdata);
+ send_sig(SIGSEGV, current, 0);
+ return 0;
+ }
if (!load_addr_set) {
load_addr_set = 1;
load_addr = (elf_ppnt->p_vaddr - elf_ppnt->p_offset);

2001-10-02 22:15:09

by Mika Liljeberg

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

Petr Vandrovec wrote:

> I was not able to find where problem could be with unpatched
> kernel, but arguments passed to do_brk(), set into mm->start_brk,
> {start,end}_code and so on looks very suspicious... But as on my
> system it does not crash neither with nor without patch below, I
> leave answer on someone else.

Well, your patch does seem to fix it:

$ /usr/src/linux-2.4.10/vmlinux
Segmentation fault
$ dmesg
...
elf_map error code: -22

Cheers,

MikaL

2001-10-02 22:19:40

by Kenneth Johansson

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

Petr Vandrovec wrote:

>
> I was not able to find where problem could be with unpatched
> kernel, but arguments passed to do_brk(), set into mm->start_brk,
> {start,end}_code and so on looks very suspicious... But as on my
> system it does not crash neither with nor without patch below, I
> leave answer on someone else.

I no longer get the restart but then I also made more than this change to the kernel and tested
with the new vmlinux image.

2001-10-02 22:51:26

by Andreas Dilger

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

On Oct 02, 2001 23:02 +0000, Petr Vandrovec wrote:
> but nobody bothers with checking error value, it even tries it
> to use as an offset if stars are in wrong constellation.
> If you could add these lines below the call:
>
> if ((unsigned long)error >= (unsigned long)(-256)) {

What's wrong with IS_ERR(error)?

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert

2001-10-03 07:51:16

by Denis Vlasenko

[permalink] [raw]
Subject: Re: System reset on Kernel 2.4.10

Hello Petr,
Wednesday, October 03, 2001, 2:02:28 PM, you wrote:
PV> Look at fs/binfmt_elf.c, at line 642 (in -ac2). There is

PV> error = elf_map(....)

PV> but nobody bothers with checking error value, it even tries it
PV> to use as an offset if stars are in wrong constellation.
PV> If you could add these lines below the call:

PV> if ((unsigned long)error >= (unsigned long)(-256)) {
PV> set_fs(old_fs);
PV> printk(KERN_DEBUG "Something went wrong with elf_map()\n");
PV> kfree(elf_phdata);
PV> send_sig(SIGSEGV, current, 0);
PV> return 0;
PV> }

PV> and then report results...

It fixes reboot for me. Now vmlinux segfaults, and I see
"Something went wrong with elf_map()" in the log.
--
Best regards, VDA
mailto:[email protected]