Skip to content

tracing: instance_rmdir() leaks ftrace_event_file->filter

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7tracing: instance_rmdir() leaks ftrace_event_file->filterkernel/trace/trace_events.c+1 -02 replies
2/7tracing: kill destroy_preds() and destroy_file_preds()include/linux/ftrace_event.h kernel/trace/trace_events.c kernel/trace/trace_events_filter.c+0 -220 replies
3/7tracing: kill destroy_call_preds()include/linux/ftrace_event.h kernel/trace/trace_events.c kernel/trace/trace_events_filter.c+2 -80 replies
4/7tracing: kill call_filter_disable()kernel/trace/trace_events_filter.c+1 -61 reply
5/7tracing/uprobes: kill the dead TRACE_EVENT_FL_USE_CALL_FILTER logickernel/trace/trace_uprobe.c+1 -22 replies
6/7tracing: kill ftrace_event_call->filesinclude/linux/ftrace_event.h+0 -11 reply
7/7tracing: change filter_free_subsystem_*() to check ->subsystem rather then ->namekernel/trace/trace_events_filter.c+2 -75 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchSrikar Dronamraju
1/7
2/7
3/7
4/7
5/7A-b
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] tracing: instance_rmdir() leaks ftrace_event_file->filter

Hello,

Sorry for delay, I was distracted by other problems.

To remind, we discussed the potential uprobes "mix perf/ftrace" changes and found some off-topic problems. Lets start with ->filter fixes/cleanups.

So far I didn't even try to test this series, although it looks simple except perhaps the last patch. I'll try to somehow test this tomorrow, but I do not really now how.

So please review, these patches need acks anyway.

As for 1/7, I added BUG_ON(file->filter) into remove_event_file_dir() before kmem_cache_free() to verify that yes, the leak does exist. Perhaps this patch should go to stable, or at least to v3.16.

--------------------------------------------------------------------------------
And could someone explain me why apply_subsystem_event_filter("0") clears ->filter_string first, then the whole ->filter? It seems that the only thing filter_free_subsystem_preds() should do is filter_disable(), no? IOW, why the patch below (on top of this series) is wrong?

Oleg.

kernel/trace/trace_events_filter.c +1 -12
@@ -831,17 +831,6 @@ static int __alloc_preds(struct event_filter *filter, int n_preds)
 	return 0;
 }
 
-static inline void __remove_filter(struct ftrace_event_file *file)
-{
-	struct ftrace_event_call *call = file->event_call;
-
-	filter_disable(file);
-	if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-		remove_filter_string(call->filter);
-	else
-		remove_filter_string(file->filter);
-}
-
 static void filter_free_subsystem_preds(struct event_subsystem *system,
 					struct trace_array *tr)
 {
@@ -850,7 +839,7 @@ static void filter_free_subsystem_preds(struct event_subsystem *system,
 	list_for_each_entry(file, &tr->events, list) {
 		if (file->system->subsystem != system)
 			continue;
-		__remove_filter(file);
+		filter_disable(file);
 	}
 }