From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: enable IRQs in user undefined instruction vector
Date: Thu, 6 Feb 2014 11:20:39 +0000 [thread overview]
Message-ID: <20140206112039.GA31054@arm.com> (raw)
In-Reply-To: <1391545146-8320-1-git-send-email-kevin@bracey.fi>
On Tue, Feb 04, 2014 at 10:19:06PM +0200, Kevin Bracey wrote:
> If an abort occurs while loading an instruction from user space in
> __und_usr, the resulting do_page_fault() can output "sleeping function
> called from invalid context" warnings, due to IRQs being disabled in
> __und_usr, and hence in do_page_fault().
>
> Avoid the problem by enabling IRQs in __und_usr before attempting to
> load the instruction, and modify code and comments in the undefined
> instruction handlers to note that IRQs are enabled on entry iff the
> instruction was executed in user mode.
>
> See http://comments.gmane.org/gmane.linux.ports.arm.omap/59256 for
> an earlier report of the observed might_sleep() warning.
There was a follow-up on this:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/263765
> arch/arm/kernel/entry-armv.S | 11 ++++++++---
> arch/arm/mach-ep93xx/crunch-bits.S | 7 ++++++-
> arch/arm/vfp/entry.S | 2 +-
> 3 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
> index b3fb8c9..bed1567 100644
> --- a/arch/arm/kernel/entry-armv.S
> +++ b/arch/arm/kernel/entry-armv.S
> @@ -399,6 +399,7 @@ ENDPROC(__irq_usr)
> .align 5
> __und_usr:
> usr_entry
> + enable_irq
The problem is that you can be preempted here and parts of the kernel
may not cope with this.
The reason I haven't pushed my patches to mainline is that I was worried
about such preemption cases. We enter iwmmxt_task_enable for example
with interrupts and preemption enabled, we disable preemption there but
is it too late? I don't have a way to test these and even for VFP I'm
not sure testing would guarantee it in all scenarios.
So it needs more thinking. Please have a look at my patches, if we get
to the conclusion there is no issue, I'll push them upstream.
--
Catalin
next prev parent reply other threads:[~2014-02-06 11:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 20:19 [PATCH] ARM: enable IRQs in user undefined instruction vector Kevin Bracey
2014-02-06 11:20 ` Catalin Marinas [this message]
2014-02-06 18:10 ` Kevin Bracey
2014-02-06 20:54 ` Russell King - ARM Linux
2014-02-07 10:00 ` vinayak menon
2014-02-07 10:06 ` Russell King - ARM Linux
2014-02-07 12:19 ` vinayak menon
2014-02-07 16:25 ` Catalin Marinas
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=20140206112039.GA31054@arm.com \
--to=catalin.marinas@arm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.