summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2019-10-11 20:41:41 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-10-12 20:49:07 -0400
commitbf8e602186ec402ed937b2cbd6c39a34c0029757 (patch)
tree06d4ed33b44d822c1a04e7239f23a0db722e6d82
parent17911ff38aa58d3c95c07589dbf5d3564c4cf3c5 (diff)
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 <torvalds@linux-foundation.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--fs/tracefs/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index eeeae0475da9..0caa151cae4e 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -16,6 +16,7 @@
16#include <linux/namei.h> 16#include <linux/namei.h>
17#include <linux/tracefs.h> 17#include <linux/tracefs.h>
18#include <linux/fsnotify.h> 18#include <linux/fsnotify.h>
19#include <linux/security.h>
19#include <linux/seq_file.h> 20#include <linux/seq_file.h>
20#include <linux/parser.h> 21#include <linux/parser.h>
21#include <linux/magic.h> 22#include <linux/magic.h>
@@ -390,6 +391,9 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
390 struct dentry *dentry; 391 struct dentry *dentry;
391 struct inode *inode; 392 struct inode *inode;
392 393
394 if (security_locked_down(LOCKDOWN_TRACEFS))
395 return NULL;
396
393 if (!(mode & S_IFMT)) 397 if (!(mode & S_IFMT))
394 mode |= S_IFREG; 398 mode |= S_IFREG;
395 BUG_ON(!S_ISREG(mode)); 399 BUG_ON(!S_ISREG(mode));