Re: [PATCH] tracing: do not leak kernel addresses

From: Mark Salyzyn
Date: Fri Jul 27 2018 - 14:41:09 EST


Any system can chose to change the permissions of a sysfs node, default, DAC (and MAC) is just layers of multi-level security (or lack thereof). As well intentioned as a default DAC is in the kernel, leaking kernel addresses is still an attack surface that we want to close tightly.

For instance on Android:

  Âchmod 0755 /sys/kernel/debug/tracing

is in the common init.rc file ...

If DAC has been adjusted at runtime to permit access to the node, I would think that if the caller does not have all the credentials/capabilities, we do want the addresses to be abstracted by the kernel.

-- Mark

On Fri, Jul 27, 2018 at 11:31 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
On Fri, 27 Jul 2018 11:13:51 -0700
Nick Desaulniers <ndesaulniers@xxxxxxxxxx> wrote:

> I found the internal bug report (reported Jan '17, you'll have to
> forgive me if my memory of the issue is hazy, or if the fix used at
> the time wasn't perfect), which was reported against the Nexus 6.
> >From the report, it was possible to `catÂ
> /sys/kernel/debug/tracing/printk_formats` without being root, which I
> can't do on my workstations much more modern kernel (Nexus 6 was
> 3.10). So I guess the question is what governs access to files below
> /sys/kernel/debug, and why was it missing from those kernels? I
> assume some check was added, but either not backported to 3.10 stable
> (or more likely not pulled in to Nexus 6's kernel through stable;
> Android is now in a much better place for that kind of issue).

As of commit 82aceae4f0d4 ("debugfs: more tightly restrict default
mount mode") /sys/kernel/debug has been default mounted as 0700 (root
only). But that was introduced in 3.7. Not sure why your 3.10 kernel
didn't have that. Perhaps there's another commit that fixed
permissions not being inherited?

-- Steve

--
You received this message because you are subscribed to the Google Groups "kernel-team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.