* [PATCH] memory leaks triggered by perf --namespace
@ 2017-11-15 5:47 Vasily Averin
2017-11-15 8:51 ` [tip:perf/urgent] perf/core: Fix memory leak " tip-bot for Vasily Averin
2017-11-29 6:15 ` tip-bot for Vasily Averin
0 siblings, 2 replies; 3+ messages in thread
From: Vasily Averin @ 2017-11-15 5:47 UTC (permalink / raw)
To: linux-kernel, Hari Bathini, Alexander Shishkin
Cc: Namhyung Kim, Jiri Olsa, Arnaldo Carvalho de Melo, Ingo Molnar,
Peter Zijlstra
perf with --namespace key leaks various memory objects including namespaces
# uname -r
4.14.0+
# perf record -q --namespace unshare -n -U -p --fork true
# grep namespace /proc/slabinfo
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.
Fixes: commit e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
kernel/events/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 10cdb9c..ab5ac84 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6756,6 +6756,7 @@ static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
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);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf/core: Fix memory leak triggered by perf --namespace
2017-11-15 5:47 [PATCH] memory leaks triggered by perf --namespace Vasily Averin
@ 2017-11-15 8:51 ` tip-bot for Vasily Averin
2017-11-29 6:15 ` tip-bot for Vasily Averin
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Vasily Averin @ 2017-11-15 8:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, jolsa, peterz, torvalds, namhyung, linux-kernel, mingo,
alexander.shishkin, tglx, hbathini, vvs, hpa
Commit-ID: 4a31b424ac0656d1bb17520ee861144fe7a19664
Gitweb: https://git.kernel.org/tip/4a31b424ac0656d1bb17520ee861144fe7a19664
Author: Vasily Averin <vvs@virtuozzo.com>
AuthorDate: Wed, 15 Nov 2017 08:47:02 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 15 Nov 2017 09:48:10 +0100
perf/core: Fix memory leak triggered by perf --namespace
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.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: commit e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info")
Link: http://lkml.kernel.org/r/c510711b-3904-e5e1-d296-61273d21118d@virtuozzo.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/events/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 10cdb9c..ab5ac84 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6756,6 +6756,7 @@ static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
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);
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf/core: Fix memory leak triggered by perf --namespace
2017-11-15 5:47 [PATCH] memory leaks triggered by perf --namespace Vasily Averin
2017-11-15 8:51 ` [tip:perf/urgent] perf/core: Fix memory leak " tip-bot for Vasily Averin
@ 2017-11-29 6:15 ` tip-bot for Vasily Averin
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Vasily Averin @ 2017-11-29 6:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: alexander.shishkin, torvalds, vvs, hpa, acme, peterz, hbathini,
mingo, jolsa, tglx, linux-kernel, namhyung
Commit-ID: 0e18dd12064e07519f7cbff4149ca7fff620cbed
Gitweb: https://git.kernel.org/tip/0e18dd12064e07519f7cbff4149ca7fff620cbed
Author: Vasily Averin <vvs@virtuozzo.com>
AuthorDate: Wed, 15 Nov 2017 08:47:02 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 15 Nov 2017 09:47:27 +0100
perf/core: Fix memory leak triggered by perf --namespace
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.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: commit e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info")
Link: http://lkml.kernel.org/r/c510711b-3904-e5e1-d296-61273d21118d@virtuozzo.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/events/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 10cdb9c..ab5ac84 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6756,6 +6756,7 @@ static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
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);
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-29 6:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 5:47 [PATCH] memory leaks triggered by perf --namespace Vasily Averin
2017-11-15 8:51 ` [tip:perf/urgent] perf/core: Fix memory leak " tip-bot for Vasily Averin
2017-11-29 6:15 ` tip-bot for Vasily Averin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).