Skip to content

Commit bf8e602

Browse files
committed
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 <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 17911ff commit bf8e602

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/tracefs/inode.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/namei.h>
1717
#include <linux/tracefs.h>
1818
#include <linux/fsnotify.h>
19+
#include <linux/security.h>
1920
#include <linux/seq_file.h>
2021
#include <linux/parser.h>
2122
#include <linux/magic.h>
@@ -390,6 +391,9 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
390391
struct dentry *dentry;
391392
struct inode *inode;
392393

394+
if (security_locked_down(LOCKDOWN_TRACEFS))
395+
return NULL;
396+
393397
if (!(mode & S_IFMT))
394398
mode |= S_IFREG;
395399
BUG_ON(!S_ISREG(mode));

0 commit comments

Comments
 (0)