From: Andrew Morton <akpm@linux-foundation.org>
To: Robert Hancock <hancockr@shaw.ca>
Cc: Masoud Asgharifard Sharbiani <masouds@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Make i386 kernel show the segfaults in kernel dmesg, like x86_64.
Date: Thu, 7 Jun 2007 19:34:31 -0700 [thread overview]
Message-ID: <20070607193431.af9ab198.akpm@linux-foundation.org> (raw)
In-Reply-To: <4668B939.1070304@shaw.ca>
On Thu, 07 Jun 2007 20:04:41 -0600 Robert Hancock <hancockr@shaw.ca> wrote:
> Masoud Asgharifard Sharbiani wrote:
> > Hello,
> > This patch makes the i386 behave the same way that x86_64 does when a
> > segfault happens. A line gets printed to the kernel log so that tools
> > that need to check for failures can behave more uniformly between
> > different kernels. Like x86_64, it can be disabled by setting
> > debug.exception-trace sysctl variable to 0 (or by doing
> > echo 0 > /proc/sys/debug/exception-trace)
> >
> > Same behaviour can be extended to other architectures, if needed.
> > cheers,
> > Masoud.
> >
> > Signed-off-by: Masoud Sharbiani <masouds@google.com>
> >
> > diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
> > index 29d7d61..6aa56db 100644
> > --- a/arch/i386/mm/fault.c
> > +++ b/arch/i386/mm/fault.c
> > @@ -283,6 +283,8 @@ static inline int vmalloc_fault(unsigned long address)
> > return 0;
> > }
> >
> > +int exception_trace = 1;
> > +
> > /*
> > * This routine handles page faults. It determines the address,
> > * and the problem, and then passes it off to one of the appropriate
> > @@ -464,7 +466,14 @@ bad_area_nosemaphore:
> > */
> > if (is_prefetch(regs, address, error_code))
> > return;
> > -
> > + if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {
> > + printk(
> > + "%s%s[%d]: segfault at %08lx eip %08lx esp %08lx error %lx\n",
> > + tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
> > + tsk->comm, tsk->pid, address, regs->eip,
> > + regs->esp, error_code);
>
> Shouldn't we use printk_ratelimit() here, to prevent some nasty person
> from creating some rapidly-segfaulting process that floods the kernel
> logs? (Same with the x86_64 version if it doesn't already..)
Yes. In fact I thought that was in there, but I must have dreamed it.
next prev parent reply other threads:[~2007-06-08 2:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.FB3wQKN6ltiEi81XcB14YVcLGgE@ifi.uio.no>
2007-06-08 2:04 ` [PATCH] Make i386 kernel show the segfaults in kernel dmesg, like x86_64 Robert Hancock
2007-06-08 2:34 ` Andrew Morton [this message]
2007-06-08 3:50 ` Masoud Sharbiani
2007-06-05 21:52 Masoud Asgharifard Sharbiani
2007-06-07 22:41 ` Andrew Morton
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=20070607193431.af9ab198.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hancockr@shaw.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=masouds@google.com \
/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