]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/trace/trace.c
Fix up for "printk: Drop pr_warning definition"
[linux.git] / kernel / trace / trace.c
index 02a23a6e5e00a073f79bbd139dc668d3a86c628c..6c75410f96988fa887d10a2bbb933890211fcde5 100644 (file)
@@ -1888,6 +1888,12 @@ int __init register_tracer(struct tracer *type)
                return -1;
        }
 
+       if (security_locked_down(LOCKDOWN_TRACEFS)) {
+               pr_warn("Can not register tracer %s due to lockdown\n",
+                          type->name);
+               return -EPERM;
+       }
+
        mutex_lock(&trace_types_lock);
 
        tracing_selftest_running = true;
@@ -8789,6 +8795,11 @@ struct dentry *tracing_init_dentry(void)
 {
        struct trace_array *tr = &global_trace;
 
+       if (security_locked_down(LOCKDOWN_TRACEFS)) {
+               pr_warn("Tracing disabled due to lockdown\n");
+               return ERR_PTR(-EPERM);
+       }
+
        /* The top level trace array uses  NULL as parent */
        if (tr->dir)
                return NULL;
@@ -9231,6 +9242,12 @@ __init static int tracer_alloc_buffers(void)
        int ring_buf_size;
        int ret = -ENOMEM;
 
+
+       if (security_locked_down(LOCKDOWN_TRACEFS)) {
+               pr_warn("Tracing disabled due to lockdown\n");
+               return -EPERM;
+       }
+
        /*
         * Make sure we don't accidently add more trace options
         * than we have bits for.