Skip to contentSkip to conversation

tracing: Fix permissions for the buffer_percent file

PATCH Applied Ondrej Mosnacek 2 participants 2 messages May 3, 2023 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Fix permissions for the buffer_percent file

This file defines both read and write operations, yet it is being created as read-only. This means that it can't be written to without the CAP_DAC_OVERRIDE capability. Fix the permissions to allow root to write to it without the need to override DAC perms.

Fixes 03329f993978 ("tracing: Add tracefs file buffer_percentage")
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 45551c7b4c365..e278f4202a7ed 100644
@@ -9655,7 +9655,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
 
 	tr->buffer_percent = 50;
 
-	trace_create_file("buffer_percent", TRACE_MODE_READ, d_tracer,
+	trace_create_file("buffer_percent", TRACE_MODE_WRITE, d_tracer,
 			tr, &buffer_percent_fops);
 
 	create_trace_options_dir(tr);
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 7 lines · On Wed, 3 May 2023 16:01:14 +0200 Ondrej Mosnacek <[email protected]> wrote:

This file defines both read and write operations, yet it is being created as read-only. This means that it can't be written to without the CAP_DAC_OVERRIDE capability. Fix the permissions to allow root to write to it without the need to override DAC perms.

Fixes 03329f993978 ("tracing: Add tracefs file buffer_percentage")

Applied. Thanks Ondrej!

-- Steve