public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: plug a race with the alignment trap handler
Date: Mon, 20 Sep 2010 15:51:38 +0100	[thread overview]
Message-ID: <20100920145138.GE30793@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.00.1009142332070.19366@xanadu.home>

On Tue, Sep 14, 2010 at 11:35:27PM -0400, Nicolas Pitre wrote:
> There is however a small race window when a misaligned access in user
> space is trapped and the alignment trap disabled, but the CPU didn't
> return to user space just yet.  Any exception would be entered from kernel
> space at that point and the kernel would then execute with the alignment
> trap disabled.

This isn't good enough - you can't just disable interrupts and hope
that they'll remain that way.

Consider what happens if the threads time slice has expired, and
TIF_NEED_RESCHED is set - the result will be that we call schedule()
and possibly switch to another thread with alignment faults disabled.

I keep on toying with an idea to use prctl() for alignment faults,
and whether to revamp this code to interact with that - which means
programs can on an individual basis decide how they want alignment
faults to be dealt with.

This would mean storing a per-thread copy of the control register,
which means that the entry*.S code can deal with updating the A bit.

  reply	other threads:[~2010-09-20 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15  3:35 [PATCH] ARM: plug a race with the alignment trap handler Nicolas Pitre
2010-09-20 14:51 ` Russell King - ARM Linux [this message]
2010-09-20 15:33   ` Nicolas Pitre

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=20100920145138.GE30793@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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