Skip to contentSkip to conversation

Patch "perf/core: Fix memory leak triggered by perf --namespace" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Feb 1, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

perf/core: Fix memory leak triggered by perf --namespace

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
perf-core-fix-memory-leak-triggered-by-perf-namespace.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Feb 1 13:45:42 CET 2018

From: Vasily Averin <[email protected]>
Date: Wed, 15 Nov 2017 08:47:02 +0300
Subject: perf/core: Fix memory leak triggered by perf --namespace

From: Vasily Averin <[email protected]>

[ Upstream commit 0e18dd12064e07519f7cbff4149ca7fff620cbed ]

perf with --namespace key leaks various memory objects including namespaces

4.14.0+

  pid_namespace          1     12   2568   12    8
  user_namespace         1     39    824   39    8
  net_namespace          1      5   6272    5    8

This happen because perf_fill_ns_link_info() struct patch ns_path:
during initialization ns_path incremented counters on related mnt and dentry, but without lost path_put nobody decremented them back.
Leaked dentry is name of related namespace,
and its leak does not allow to free unused namespace.

Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Hari Bathini <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes commit e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info")
---
 kernel/events/core.c |    1 +
 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
@@ -6756,6 +6756,7 @@ static void perf_fill_ns_link_info(struc
 		ns_inode = ns_path.dentry->d_inode;
 		ns_link_info->dev = new_encode_dev(ns_inode->i_sb->s_dev);
 		ns_link_info->ino = ns_inode->i_ino;
+		path_put(&ns_path);
 	}
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/lockd-fix-list_add-double-add-caused-by-legacy-signal-interface.patch queue-4.14/grace-replace-bug_on-by-warn_once-in-exit_net-hook.patch queue-4.14/perf-core-fix-memory-leak-triggered-by-perf-namespace.patch queue-4.14/race-of-lockd-inetaddr-notifiers-vs-nlmsvc_rqst-change.patch