Received: by 10.223.176.46 with SMTP id f43csp273951wra; Tue, 23 Jan 2018 20:49:00 -0800 (PST) X-Google-Smtp-Source: AH8x2272aJManSjmCUOsEKarz5NUJvQ/OR/rAjFI5lMMdUdiS7z12xMA9/XVAdv/T8FE1FeVo8JN X-Received: by 10.98.174.8 with SMTP id q8mr11829637pff.109.1516769340738; Tue, 23 Jan 2018 20:49:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769340; cv=none; d=google.com; s=arc-20160816; b=Bz+1bSU0My7kd6063xUEM02Zis6/Zlb7CkyzDaBF3ETsn2HRnVnLLE76cqChzDwWq2 GSBnCrGc3rd2xv6dVBG5fRYNYwfqDV0ptmsitdHL+QCIzj+7xkESxQyvY/ANhhWNot9Y ozE9fhxV63xjof1gwIvPD8TvaA6VGmNpstB2uYNA89uafmBe8qrqHDe0pdlphw29ZUb1 CI6fZsz50JpTSf1HcQ3/Igt10DzSsjyAXrHlUhDdK9QcA/HkpqI3X6OYhw5neWke69oA 87cbdBltSz/dAokt29h4b0MqHRwg4yZAagqNiRTbi6USZMP+ym6ZGLe1r0h+nrE4COiS VmiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=1TGgSaRQ23MMpKUy1MSurfMT4utK+QMdabHFaq37Fig=; b=KTvMdEj9nrnWOljeKXbXGrB/hxVYlk93zGs3EOU8q5o2cwSIyj6JmnVLczr2sulZiC U0Fb+XTsEmuIozXIZjOdFU5dC3hE1HRUSNtGS81ZoDjz7MgRuXAeDd0orfrloeB0FwKI kJQtK+uC2mVXdXJmYBfFhJ9qh8suB7wdfa7hk8LJIkBuPiwZTHrfdOh0BTLMv/9IK+ta /bYi8lbeOwL1vCIQ7Mo1kQhWO0O219nXGUOzyDiYKdZgzRHbh+hJTvG0sfp4npP0ul0q UHNBKf3rXsV30vLgUl6pDWJxoEbm6bEsy80LLAOk6DQ915XLnaw9e8tAwLVzub8pBoKE 7r3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=B7UG/Dyv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 87si2251244pfl.300.2018.01.23.20.48.47; Tue, 23 Jan 2018 20:49:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=B7UG/Dyv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932681AbeAXEsB (ORCPT + 99 others); Tue, 23 Jan 2018 23:48:01 -0500 Received: from mail-sn1nam01on0109.outbound.protection.outlook.com ([104.47.32.109]:14147 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932524AbeAXEQJ (ORCPT ); Tue, 23 Jan 2018 23:16:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1TGgSaRQ23MMpKUy1MSurfMT4utK+QMdabHFaq37Fig=; b=B7UG/DyvqE7Lt82y8yaSvQEjR4/PzgAFmtukzytk0As3f64ffkoKUcwmgy4xjK+H600lSKznwJZ23Eqq/qZ5/5k0yeJrQz11PvyoSrwHNpnhUN5e6DjJ4hTV2RypxFK6RdnSGDMOkvtF0lOV0l0hA77yW0jI/vxzftSgrEQtoh8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0727.namprd21.prod.outlook.com (10.167.110.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.1; Wed, 24 Jan 2018 04:16:07 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:16:07 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Vasily Averin , Alexander Shishkin , Arnaldo Carvalho de Melo , Hari Bathini , Jiri Olsa , Linus Torvalds , "Namhyung Kim" , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 090/100] perf/core: Fix memory leak triggered by perf --namespace Thread-Topic: [PATCH AUTOSEL for 4.14 090/100] perf/core: Fix memory leak triggered by perf --namespace Thread-Index: AQHTlMntsC0R2CNAkkaVhJWVJrKzOg== Date: Wed, 24 Jan 2018 04:15:12 +0000 Message-ID: <20180124041414.32065-90-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0727;7:I102Lcc41jb+WkoGPFKwmLAnrzhqWxePqlKt2cFtq51l0/4T/A9CIEshRyx5bjTA5XxJmia1LIIJ0F3tzpTBu9iol2KnDgI+5uqAjsggq204CKL2QQJfBT5j3l5iorEajYpkcZ6NflzQT7GIPZS5u1twRNNl/EdrI313r9M3aMTirkRnSNTC/cuIlH7LtxQ91siY1do/wENoMSYgetyeahBu6QuutUeP6w29aSxZbqf4bot6CocThFM+UdZ2jURn x-ms-office365-filtering-correlation-id: 83252b63-a0a7-4c5e-76e2-08d562e130ef x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB0727; x-ms-traffictypediagnostic: DM5PR2101MB0727: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(42068640409301)(104084551191319)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231046)(2400081)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0727;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0727; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(396003)(366004)(39380400002)(39860400002)(376002)(189003)(199004)(86612001)(6506007)(106356001)(76176011)(6346003)(54906003)(86362001)(2501003)(110136005)(966005)(1076002)(7736002)(5250100002)(3660700001)(316002)(26005)(102836004)(2950100002)(6666003)(99286004)(97736004)(22452003)(107886003)(6436002)(53936002)(478600001)(66066001)(14454004)(6306002)(2900100001)(6512007)(2906002)(5660300001)(8936002)(4326008)(7416002)(10290500003)(305945005)(10090500001)(68736007)(25786009)(81166006)(72206003)(36756003)(8676002)(81156014)(3846002)(6116002)(3280700002)(105586002)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0727;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: JQwAmZcQMBP5nARr2zWvVv8LOF7pYBNwi7V2wyPnMNLmXteZvrIFeZI2rnTxj5GE+rPUgh8ZQ1p0KdRliWeBCA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83252b63-a0a7-4c5e-76e2-08d562e130ef X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:15:12.3418 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0727 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Averin [ 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 dentr= y, 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 Acked-by: Peter Zijlstra Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Hari Bathini Cc: Jiri Olsa Cc: Linus Torvalds Cc: Namhyung Kim Cc: Thomas Gleixner Fixes: commit e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include na= mespaces related info") Link: http://lkml.kernel.org/r/c510711b-3904-e5e1-d296-61273d21118d@virtuoz= zo.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index 24ebad5567b4..8c20af8738ac 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_lin= k_info *ns_link_info, ns_inode =3D ns_path.dentry->d_inode; ns_link_info->dev =3D new_encode_dev(ns_inode->i_sb->s_dev); ns_link_info->ino =3D ns_inode->i_ino; + path_put(&ns_path); } } =20 --=20 2.11.0