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.comSuggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 17911ff3
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/tracefs.h> #include <linux/tracefs.h>
#include <linux/fsnotify.h> #include <linux/fsnotify.h>
#include <linux/security.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/magic.h> #include <linux/magic.h>
...@@ -390,6 +391,9 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, ...@@ -390,6 +391,9 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
struct dentry *dentry; struct dentry *dentry;
struct inode *inode; struct inode *inode;
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
if (!(mode & S_IFMT)) if (!(mode & S_IFMT))
mode |= S_IFREG; mode |= S_IFREG;
BUG_ON(!S_ISREG(mode)); BUG_ON(!S_ISREG(mode));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment