From: Steven Rostedt (VMware) Date: Sat, 12 Oct 2019 00:41:41 +0000 (-0400) Subject: tracing: Do not create tracefs files if tracefs lockdown is in effect X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bf8e602186ec402ed937b2cbd6c39a34c0029757;p=linux.git tracing: Do not create tracefs files if tracefs lockdown is in effect If on boot up, lockdown is activated for tracefs, don't even bother creating the files. This can also prevent instances from being created if lockdown is in effect. Link: http://lkml.kernel.org/r/CAHk-=whC6Ji=fWnjh2+eS4b15TnbsS4VPVtvBOwCy1jjEG_JHQ@mail.gmail.com Suggested-by: Linus Torvalds Signed-off-by: Steven Rostedt (VMware) --- diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index eeeae0475da9d..0caa151cae4ee 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -390,6 +391,9 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, struct dentry *dentry; struct inode *inode; + if (security_locked_down(LOCKDOWN_TRACEFS)) + return NULL; + if (!(mode & S_IFMT)) mode |= S_IFREG; BUG_ON(!S_ISREG(mode));