mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: linux-kernel@vger.kernel.org
Subject: Re: System reset on Kernel 2.4.10
Date: Tue, 2 Oct 2001 23:41:15 +0200	[thread overview]
Message-ID: <20011002234115.A1891@vana.vc.cvut.cz> (raw)
In-Reply-To: <527872464EC@vcnet.vc.cvut.cz>
In-Reply-To: <527872464EC@vcnet.vc.cvut.cz>

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
						vandrove@vc.cvut.cz


--- 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);

  reply	other threads:[~2001-10-02 21:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-02 23:02 Petr Vandrovec
2001-10-02 21:41 ` Petr Vandrovec [this message]
2001-10-02 22:15   ` Mika Liljeberg
2001-10-02 22:19   ` Kenneth Johansson
2001-10-02 22:50 ` Andreas Dilger
2001-10-03  8:49 ` VDA
  -- strict thread matches above, loose matches on Subject: below --
2001-10-02 19:22 Carles Pina i Estany
2001-10-02 19:22 ` Mika Liljeberg
2001-10-02 21:52   ` VDA
2001-10-02 21:09 ` VDA
2001-10-02 21:06   ` Kenneth Johansson
2001-10-02 21:17 ` Carles Pina i Estany

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011002234115.A1891@vana.vc.cvut.cz \
    --to=vandrove@vc.cvut.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®