tracing: Add locked_down checks to the open calls of files created for tracefs
Added various checks on open tracefs calls to see if tracefs is in lockdown mode, and if so, to return -EPERM. Note, the event format files (which are basically standard on all machines) as well as the enabled_functions file (which shows what is currently being traced) are not lockde down. Perhaps they should be, but it seems counter intuitive to lockdown information to help you know if the system has been modified. Link: http://lkml.kernel.org/r/CAHk-=wj7fGPKUspr579Cii-w_y60PtRaiDgKuxVtBAMK0VNNkA@mail.gmail.com Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
#include <linux/sched/task_stack.h>
|
||||
#include <linux/stacktrace.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/kallsyms.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/spinlock.h>
|
||||
@@ -470,6 +471,12 @@ static const struct seq_operations stack_trace_seq_ops = {
|
||||
|
||||
static int stack_trace_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = security_locked_down(LOCKDOWN_TRACEFS);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return seq_open(file, &stack_trace_seq_ops);
|
||||
}
|
||||
|
||||
@@ -487,6 +494,7 @@ stack_trace_filter_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct ftrace_ops *ops = inode->i_private;
|
||||
|
||||
/* Checks for tracefs lockdown */
|
||||
return ftrace_regex_open(ops, FTRACE_ITER_FILTER,
|
||||
inode, file);
|
||||
}
|
||||
|
Reference in New Issue
Block a user