mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Nyberg <alexn@dsv.su.se>
To: Andrew Morton <akpm@osdl.org>
Cc: andre@cachola.com.br, cw@f00f.org, linux-kernel@vger.kernel.org
Subject: Re: A patch for the file kernel/fork.c
Date: Wed, 04 May 2005 23:21:27 +0200	[thread overview]
Message-ID: <1115241687.2562.50.camel@localhost.localdomain> (raw)
In-Reply-To: <20050504124104.3573e7f3.akpm@osdl.org>

> > > 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.
> > 
> > Patching up the kernel hiding things that must not happen is not the way
> > to go. All kernel bugs are severe (as you just showed us!). Adding extra
> > checks like your original patch did may even cause much more harm
> > because it may hide other problems causing silent problems.
> 
> If I understand Andre correctly, his patch will prevent infinite recursion
> in the oops path - if some process oopses after having run exit_mm().
> 
> If so then it's a reasonable debugging aid.  Although there might be better
> places to do it, such as
> 
> 	if (!current->i_tried_to_exit++)
> 		return;
> 
> in do_exit().   Dunno.

This patch is very crude but it is quite resistant to recursive faults
in do_exit(), survives the LTP hammering I've given it. The problem is
not knowing where in the previous path it broke down so I'd rather just
leave it lying around and try a graceful reset/power off. But if anyone
has a better suggestion than the msleep() I'm all ears but this area is
sensitive.

Where is that anonymous patch hot-line...


Index: mm/kernel/exit.c
===================================================================
--- mm.orig/kernel/exit.c	2005-05-04 22:24:57.000000000 +0200
+++ mm/kernel/exit.c	2005-05-04 23:19:08.000000000 +0200
@@ -29,6 +29,7 @@
 #include <linux/perfctr.h>
 #include <linux/syscalls.h>
 #include <linux/signal.h>
+#include <linux/delay.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -797,6 +798,14 @@
 		ptrace_notify((PTRACE_EVENT_EXIT << 8) | SIGTRAP);
 	}
 
+	/* We're taking recursive faults originating here in do_exit. Safest 
+	 * is to just leave this task alone and wait for reboot. */
+	if (tsk->flags & PF_EXITING) {
+		printk(KERN_ALERT "\nFixing recursive fault but reboot is needed!\n");
+		for (;;)
+			msleep(1000 * 10);
+	}
+
 	tsk->flags |= PF_EXITING;
 
 	/*



  parent reply	other threads:[~2005-05-04 21:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-04 14:46 André Pereira de Almeida
2005-05-04 17:54 ` Chris Wedgwood
2005-05-04 18:26   ` André Pereira de Almeida
2005-05-04 18:43     ` Chris Wedgwood
2005-05-04 19:04       ` André Pereira de Almeida
2005-05-04 19:16         ` Alexander Nyberg
2005-05-04 19:41           ` Andrew Morton
2005-05-04 20:54             ` André Pereira de Almeida
2005-05-04 21:21             ` Alexander Nyberg [this message]
2005-05-05 13:48               ` Steven Rostedt
2005-05-05 15:32                 ` Alexander Nyberg
2005-05-07  1:08                   ` Andrew Morton
2005-05-04 19:11     ` Valdis.Kletnieks
2005-05-04 19:34       ` Dmitry Torokhov
2005-05-04 19:35       ` André Pereira de Almeida

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=1115241687.2562.50.camel@localhost.localdomain \
    --to=alexn@dsv.su.se \
    --cc=akpm@osdl.org \
    --cc=andre@cachola.com.br \
    --cc=cw@f00f.org \
    --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®