Re: [PATCH] kernel: Restrict permissions of /proc/iomem.

From: Christian Kujau
Date: Tue Oct 29 2019 - 07:05:20 EST


On Mon, 28 Oct 2019, Kees Cook wrote:
> > It's risky to change things like this - heaven knows which userspace
> > applications might break.
> >
> > Possibly we could obfuscate the information if that is considered
> > desirable. Why is this a problem anyway? What are the possible
> > exploit scenarios?
>
> This is already done: kptr_restrict sysctl already zeros these values
> if it is set. e.g.:
>
> 00000000-00000000 : System RAM
> 00000000-00000000 : Kernel code
> 00000000-00000000 : Kernel data
> 00000000-00000000 : Kernel bss
>
> > Can't the same info be obtained by running dmesg and looking at the
> > startup info?
>
> Both virtual and physical address dumps in dmesg are considered "bad
> form" these days and most have been removed.
>
> > Can't the user who is concerned about this run chmod 0400 /proc/iomem
> > at boot?
>
> That is also possible.

As a user, I still like this patch, or some variation of it. On various
(server and desktop) systems I do this during boot for some time now and
never had a problem:

find /proc -xdev -mindepth 1 -maxdepth 1 ! \( -name "[0-9]*" \
-o -name cpuinfo -o -name modules -o -name loadavg -o -name meminfo \
-o -name mounts -o -name net -o -name self -o -name diskstats \
-o -name stat -o -name sys -o -name swaps -o -name thread-self \
-o -name vmstat -o -name uptime \) -exec chmod -c go-rwx '{}' +

C.
--
BOFH excuse #436:

Daemon escaped from pentagram