public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: Masoud Asgharifard Sharbiani <masouds@google.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Make i386 kernel show the segfaults in kernel dmesg, like x86_64.
Date: Thu, 07 Jun 2007 20:04:41 -0600	[thread overview]
Message-ID: <4668B939.1070304@shaw.ca> (raw)
In-Reply-To: <fa.FB3wQKN6ltiEi81XcB14YVcLGgE@ifi.uio.no>

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

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/


       reply	other threads:[~2007-06-08  2:05 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 ` Robert Hancock [this message]
2007-06-08  2:34   ` [PATCH] Make i386 kernel show the segfaults in kernel dmesg, like x86_64 Andrew Morton
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=4668B939.1070304@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=akpm@linux-foundation.org \
    --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