> On Aug 27, 2019, at 5:44 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > On Tue, 27 Aug 2019 16:34:47 -0700 > Andy Lutomirski <luto@xxxxxxxxxx> wrote: > >>>> CAP_TRACING does not override normal permissions on sysfs or debugfs. >>>> This means that, unless a new interface for programming kprobes and >>>> such is added, it does not directly allow use of kprobes. >>> >>> kprobes can be created in the tracefs filesystem (which is separate from >>> debugfs, tracefs just gets automatically mounted >>> in /sys/kernel/debug/tracing when debugfs is mounted) from the >>> kprobe_events file. /sys/kernel/tracing is just the tracefs >>> directory without debugfs, and was created specifically to allow >>> tracing to be access without opening up the can of worms in debugfs. >> >> I think that, in principle, CAP_TRACING should allow this, but I'm not >> sure how to achieve that. I suppose we could set up >> inode_operations.permission on tracefs, but what exactly would it do? >> Would it be just like generic_permission() except that it would look >> at CAP_TRACING instead of CAP_DAC_OVERRIDE? That is, you can use >> tracefs if you have CAP_TRACING *or* acl access? Or would it be: >> >> int tracing_permission(struct inode *inode, int mask) >> { >> if (!capable(CAP_TRACING)) >> return -EPERM; >> >> return generic_permission(inode, mask); >> } > > Perhaps we should make a group for it? > Hmm. That means that you’d need CAP_TRACING and a group. That’s probably not terrible, but it could be annoying. >> >> Which would mean that you need ACL *and* CAP_TRACING, so >> administrators would change the mode to 777. That's a bit scary. >> >> And this still doesn't let people even *find* tracefs, since it's >> hidden in debugfs. >> >> So maybe make CAP_TRACING override ACLs but also add /sys/fs/tracing >> and mount tracefs there, too, so that regular users can at least find >> the mountpoint. > > I think you missed what I said. It's not hidden in /sys/kernel/debug. > If you enable tracefs, you have /sys/kernel/tracing created, and is > completely separate from debugfs. I only have it *also* automatically > mounted to /sys/kernel/debug/tracing for backward compatibility > reasons, as older versions of trace-cmd will only mount debugfs (as > root), and expect to find it there. > > mount -t tracefs nodev /sys/kernel/tracing Too many slashes :/ A group could work for v1. Maybe all the tools should get updated to use this path? > > -- Steve > >> >>> >>> Should we allow CAP_TRACING access to /proc/kallsyms? as it is helpful >>> to convert perf and trace-cmd's function pointers into names. Once you >>> allow tracing of the kernel, hiding /proc/kallsyms is pretty useless. >> >> I think we should. >