System reset on Kernel 2.4.10
Subsystems (2)
Quoted 6 lines · VDA
V> Straced vmlinux does not reboot.
V> Kernel: 2.4.10+ext3+preemptWell... 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)
Quoted 24 lines · Petr Vandrovec
Quoted 6 lines · VDA
V> Straced vmlinux does not reboot.
V> Kernel: 2.4.10+ext3+preemptWell... 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 iserror =
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;
}
Quoted 1 line
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]
fs/binfmt_elf.c renamed from fs/binfmt_elf.c.xx +7 -1
@@ -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);
Quoted 5 lines · Petr Vandrovec
I was not able to find where problem could be with unpatched kernel, but arguments passed to
do_brk(), set intomm->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
Quoted 6 lines · Petr Vandrovec
I was not able to find where problem could be with unpatched kernel, but arguments passed to
do_brk(), set intomm->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.
Quoted 5 lines · Petr Vandrovec
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
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.
Signature · 2 lines
Best regards, VDA mailto:[email protected]