mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
Cc: linux-kernel@vger.kernel.org, kernel@avr32linux.org
Subject: Re: [PATCH] AVR32: Fix random segfault with preemption
Date: Thu, 11 Oct 2007 10:24:54 +0200	[thread overview]
Message-ID: <20071011102454.4ff0225f@dhcp-255-175.norway.atmel.com> (raw)
In-Reply-To: <200710101852.27213.philippe.retornaz@epfl.ch>

On Wed, 10 Oct 2007 18:52:24 -0400
Philippe Rétornaz <philippe.retornaz@epfl.ch> wrote:

> As explained on:
> http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=53307
> If the current process is preempted before it can copy RAR_SUP and
> RSR_SUP both register are lost and the process will segfault as soon
> as it return from the syscall since the return adress will be
> corrupted. 
> 
> This patch disable IRQ as soon as we enter the syscall path and
> reenable them when the copy is done. 
> 
> In the interrupt handlers, check if we are interrupting the srrf
> instruction, if so disable interrupts and return. The interrupt
> handler will be re-called immediatly when the interrupts are
> reenabled.

Just to make it clear: It will disable interrupts in the return
context, so interrupts will be disabled when the interrupt handler
returns.

> After some stressing workload:
> - find / > /dev/null in loop
> - top (in ssh)
> - ping -f avr32
> 
> The segfaults are not seen anymore.
> 
> Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>

Nice work. The patch looks correct as far as I can tell, so I think
I'll merge it as soon as possible, and perhaps enable CONFIG_PREEMPT in
the defconfig, to give it some more exposure.

Thanks!

Håvard

      reply	other threads:[~2007-10-11  8:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10 22:52 Philippe Rétornaz
2007-10-11  8:24 ` Haavard Skinnemoen [this message]

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=20071011102454.4ff0225f@dhcp-255-175.norway.atmel.com \
    --to=hskinnemoen@atmel.com \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philippe.retornaz@epfl.ch \
    /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®