linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: avoid returning from bad_mode
Date: Thu, 19 Jan 2017 15:40:08 +0000	[thread overview]
Message-ID: <20170119154008.GC21809@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <1484760221-30205-1-git-send-email-mark.rutland@arm.com>

On Wed, Jan 18, 2017 at 05:23:41PM +0000, Mark Rutland wrote:
> Generally, taking an unexpected exception should be a fatal event, and
> bad_mode is intended to cater for this. However, it should be possible
> to contain unexpected synchronous exceptions from EL0 without bringing
> the kernel down, by sending a SIGILL to the task.
> 
> We tried to apply this approach in commit 9955ac47f4ba1c95 ("arm64:
> don't kill the kernel on a bad esr from el0"), by sending a signal for
> any bad_mode call resulting from an EL0 exception.
> 
> However, this also applies to other unexpected exceptions, such as
> SError and FIQ. The entry paths for these exceptions branch to bad_mode
> without configuring the link register, and have no kernel_exit. Thus, if
> we take one of these exceptions from EL0, bad_mode will eventually
> return to the original user link register value.
> 
> This patch fixes this by introducing a new bad_el0_sync handler to cater
> for the recoverable case, and restoring bad_mode to its original state,
> whereby it calls panic() and never returns. The recoverable case
> branches to bad_el0_sync with a bl, and returns to userspace via the
> usual ret_to_user mechanism.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Fixes: 9955ac47f4ba1c95 ("arm64: don't kill the kernel on a bad esr from el0")
> Reported-by: Mark Salter <msalter@redhat.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: stable at vger.kernel.org

Thanks. I'll queue this for 4.10.

-- 
Catalin

      reply	other threads:[~2017-01-19 15:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 17:23 [PATCH] arm64: avoid returning from bad_mode Mark Rutland
2017-01-19 15:40 ` Catalin Marinas [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=20170119154008.GC21809@e104818-lin.cambridge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).