linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: fix kernel panic on serror exception caused by user process
Date: Tue, 17 Jul 2018 15:45:47 +0100	[thread overview]
Message-ID: <20180717144547.GE17271@n2100.armlinux.org.uk> (raw)
In-Reply-To: <CAM5rFu8avWLrUhEsCHBTKv=sM6dE3Sh_0=5M3Eh0WcT9EdmtSg@mail.gmail.com>

On Tue, Jul 17, 2018 at 07:10:25PM +0530, Hari Vyas wrote:
> Okay. Don't think it is a question of trust. If access happens from
> kernel mode, I understand but If user mode initiated
> access(from devmem(which is just an example) or any other application)
> into outside or invalid region of system
> address brings complete kernel down, at least I will be surprised.
> If all other also think kernel panic okay in this case, then no
> further action is required from my side.

There are many, many ways that someone with privileged access can take
the system down.

It's _well_ known that accesses through /dev/mem (which gives _direct_
access to the hardware in the system) has the capability to take the
system down.

Your example may be through an exception, but another way could be to
find the clock controller and disable system clocks, or find the RAM
controller in physical memory and disable that.  Or the L2 cache in
older ARMs and tell it to invalidate all its contents, leading to
system data corruption and probably a kernel panic.

Other ways (on x86) that have been known for years include configuring
an 8250 serial port at an address or interrupt (this doesn't involve
/dev/mem, but merely the setserial program.)

Another, non-hardware way is the killall program used from a privileged
context.  On some flavours of Unix, it terminates programs that match
the argument.  On others, it terminates _all_ programs without warning,
effectively taking the system down.

There are 32-bit ARM SoCs that hard-lock if you try to access a device
and the clocks for that device are disabled - irrespective of whether
that is a kernel or user mode access.

Whoever has privileged system access (iow, the ability to directly
talk to hardware or configure drivers) has a responsibility to know
what to do and, more importantly, what not to do.  Poking around in
/dev/mem definitely comes under the heading of "don't do that unless
you know *exactly* what you are doing".

In normal circumstances, _nothing_ in userspace should have /dev/mem
open - indeed, the kernel build system provides an option to disable
this special device file via the CONFIG_DEVMEM.

It has to be said that /dev/mem should _never_ be exposed to non-
privileged users on the system - it's way too dangerous to do so,
since as soon as you do that, you have *no* system security what so
ever.  Your average user is then at liberty to manually read *and*
*write* the hardware *including* the kernel code _and_ page tables,
which means they can bypass *all* software protections and some
hardware ones as well.

TBH, I'd say that for people who don't know what they're doing, poking
about in /dev/mem is like pointing a gun at your foot while squeezing
the trigger.  It won't end well.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up

  parent reply	other threads:[~2018-07-17 14:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  9:31 [PATCH] arm64: fix kernel panic on serror caused by user process Hari Vyas
2018-07-17  9:31 ` [PATCH] arm64: fix kernel panic on serror exception " Hari Vyas
2018-07-17 10:06   ` Mark Rutland
2018-07-17 11:32     ` Hari Vyas
2018-07-17 11:48       ` Mark Rutland
2018-07-17 13:40         ` Hari Vyas
2018-07-17 14:20           ` James Morse
2018-07-17 14:26           ` Robin Murphy
2018-07-17 14:45           ` Russell King - ARM Linux [this message]
2018-07-18  9:14             ` Hari Vyas

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=20180717144547.GE17271@n2100.armlinux.org.uk \
    --to=linux@armlinux.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;
as well as URLs for NNTP newsgroup(s).