Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: robin.murphy@arm.com (Robin Murphy)
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:26:45 +0100
Message-ID: <9b9c4cd5-4428-c08d-d4a3-7352c6c80583@arm.com> (raw)
In-Reply-To: <CAM5rFu8avWLrUhEsCHBTKv=sM6dE3Sh_0=5M3Eh0WcT9EdmtSg@mail.gmail.com>

On 17/07/18 14:40, Hari Vyas wrote:
[...]
>> Sorry, but this is simply a risk of exposing /dev/mem to userspace.
>>
>> The user could also use devmem to poke devices in ways which could
>> permanently damage them. If you cannot trust the user to not do such
>> things, you must not give them access to /dev/mem.
>>
> 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 you have an Arm Juno board, why not try this fun little demonstration 
I once wrote for a colleague:


#include <fcntl.h>
#include <sys/mman.h>

int main(void) {
	int *dmc, fd = open("/dev/mem", O_RDWR|O_SYNC);
	
	dmc = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x2b0a0000);
	dmc[2] = 1;
}


The simple fact is that anyone with access to /dev/mem *can* take down 
the system any number of ways. It's foolish to think there's any way of 
protecting against that other than by not giving them access at all.

Robin.


[ For anyone interested, it puts the DRAM controller into sleep mode. 
The kernel can't even panic if all the memory suddenly disappears :D ]

  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  9:31 [PATCH] arm64: fix kernel panic on serror " 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 [this message]
2018-07-17 14:45           ` Russell King - ARM Linux
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=9b9c4cd5-4428-c08d-d4a3-7352c6c80583@arm.com \
    --to=robin.murphy@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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git