Monday, September 11, 2017

Re: Open /dev/mem file failed when running as a root priviledge

On Mon, September 11, 2017 8:58 pm, Nan Xiao wrote:
> Hi all,
>
> Greetings from me!
>
> I want to run dmidecode (https://github.com/mirror/dmidecode) on OpenBSD
> 6.1, but executing it will report following errors:
>
> # ./dmidecode
> # dmidecode 3.1
> Scanning /dev/mem for entry point.
> /dev/mem: Operation not permitted
>
> After single-step debugging, I find the error is from open /dev/mem:
>
> if ((fd = open(filename, O_RDONLY)) == -1)
> {
> if (errno != ENOENT)
> perror(filename);
> return NULL;
> }
>
> I execute program as a root, and the attributes of `/dev/mem`:
>
> # ls -lt /dev/mem
> crw-r----- 1 root kmem 2, 0 Aug 25 18:38 /dev/mem
>
> So it should open successfully. Could anyone give some clues of this
> issue?
>
> Thanks very much in advance!
>
> Best Regards
> Nan Xiao
>

/dev/mem and /dev/kmem were locked down.

https://marc.info/?l=openbsd-cvs&m=147481705211536&w=2

I can't recall if it's been further closed since last year.

No comments:

Post a Comment