Re: [PATCH] arm64: fix kernel panic on serror exception caused by user process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ]



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux