2

I am using OpenBSD 7.7.

So I know that procfs is not mounted on /proc, and I need to use sysctl to fetch process maps. But this fails as I am not running as a root user. The secure level is set to 1 so that is why I can't use sysctl without root. But even procmap is not permitted as a root user.

Is there any way I can fetch the process maps without root?

0

1 Answer 1

3

If securelevel is set to 1 you simply can't access /dev/kmem (nor /dev/mem), which is used by procmap. And you also can't change securelevel back to 0 on-the-fly (you'd need to set it in /etc/sysctl.conf and reboot). From securelevel(7):

1 Secure mode
     -   default mode when system is multi-user
     -   securelevel may no longer be lowered except by init
     -   /dev/mem and /dev/kmem cannot be opened
    (...)
     -   the hw.allowpowerdown, kern.allowkmem, kern.utc_offset,
         net.inet.ip.sourceroute, and machdep.kbdreset sysctl(8)
         variables may not be changed

Furthermore, procmap(1) says that:

procmap requires the ability to open /dev/kmem which may be restricted
based upon the value of the kern.allowkmem sysctl(8).

and on my machine ls -l /dev/kmem shows that

crw-r-----  1 root  kmem  2, 1 May 14 16:37 /dev/kmem

So to be able to use procmap, you would need:

  1. to set kern.securelevel=0 in /etc/sysctl.conf, and reboot the machine,
  2. set kern.allowkmem to 1 (or add this to /etc/sysctl.conf, while you're at it), and
  3. be either root or a user in the kmem group to be able to access /dev/kmem.

So no, there is no way you can fetch the process maps without root, nor without fiddling with some knobs.

1
  • Thanks :) , I would just run as root using doas then Commented Jul 31 at 15:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.