Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934071AbdC3Oaa (ORCPT ); Thu, 30 Mar 2017 10:30:30 -0400 Received: from mail-eopbgr10134.outbound.protection.outlook.com ([40.107.1.134]:9952 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933693AbdC3Oa2 (ORCPT ); Thu, 30 Mar 2017 10:30:28 -0400 Authentication-Results: samsung.com; dkim=none (message not signed) header.d=none;samsung.com; dmarc=none action=none header.from=virtuozzo.com; Subject: Re: [PATCH v2] module: check if memory leak by module. To: Pavel Machek References: <1490767322-9914-1-git-send-email-maninder1.s@samsung.com> <460c5798-1f4d-6fd0-cf32-349fbd605862@virtuozzo.com> <20170330133712.GA23946@amd> CC: Maninder Singh , , , , , , , , , , , , , , , , , , , , , , , , , Vaneet Narang From: Andrey Ryabinin Message-ID: <06383e49-148e-e31f-e66e-e50db7df470b@virtuozzo.com> Date: Thu, 30 Mar 2017 17:31:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170330133712.GA23946@amd> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: VI1PR0902CA0015.eurprd09.prod.outlook.com (10.171.100.25) To DB6PR0801MB2055.eurprd08.prod.outlook.com (10.168.86.136) X-MS-Office365-Filtering-Correlation-Id: 4993a0c0-cb41-4903-81f0-08d477794e13 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:DB6PR0801MB2055; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2055;3:VDT3/KIylbDrB8HclcKcLmGQ2a4TfDMgJEla7oa/kKXhBsgALDBze7TLl3A5aYa2Fs7T09PY9jxZ5mWj4EtFNRnMiBU+BZ+/ydJWXmS1x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EwrV+ez/d9hQHX6LE3eiHr1GMlYWyn0/cjATg81GXlVtrLl8E6g17TXcIHJdbwY9l2szqn+Eh18VJJqtSwWumVDe4dNJXwsn0Phxbz4Ow+nj+M4u5tGdnUd3Zxwn43F1LeUVNSOBrQ7qGhf8YqwrQDIfab3lMVBmRRKgbAe+8xb2i1xB/HwGqwkE2QeDD6Q7zkMYwK/9YrGWeYsuHMABHTQStQlIP463GEpbvEn2bMsLYGiS7MazRz18jRrS3+blft5emg222Q7iIN8+bCZdhWsnfDe2Jjy39QFb+2DccsIA8tLcksVfvVwoXAxZswwTOXjgLGgEQKdXjNdNYLE/fzrrz9zXInixmGSRKmO/Xbz6XiY+H3YJfw4WRzyyIQr+77fsG/EHJpG0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006067)(93001067)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(6072148);SRVR:DB6PR0801MB2055;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2055; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2055;4:FHNdWjdPMDLWlIZz/5pKni+rFg+w5H+hLfZyGEez9UJcTIIfSy+cOKST9Y8Ob6CyFw2IwhR3r5Da686m8HAFbT1yyR2JooVslbUoupr1UWGLYstX9B8IKA97QQokSZBSJw5+6UbGl+PhI7wD1X2eTyd5mBfOX5sxVUeX4fFa41mx5ZjfGRsuPLe+S83UykIl+MZPLwb+06+ESuHDUgEsJE9ILTEIsOUlLytm7ujORi2TL0dxIiIUCAR1Qt+XfXtXXfwJHlpq0AprTQ2rkQVFG0ieR65aXRK8w6YoxaKZowJnVok2yX8oAOdESDnYD+nJE2p/Itj4LH52vVVZXZUjL+SFNpKy7kMB3XpErZYC6wkOgk1UA9QHni3hwEANVIJxPvUExv9G37EuvS7OLciAJN3waMGJZSXGk0PPb+WqRwBuxLWpgEA5ZmbwvvgD4jDFmLpCGVNP/wOoH9fb1ubJvhNZKi7zCo3axgPrzHAXcrEDuI/MgRGzTdrJ3YMc9UDhBci0be3Y9JCrN+rOZT4mfEXGpkti2wrZst1DH5PiA8Csw8957zG1b7b0TylCJgid92VeqI8rSQQPC3zy3Qpgc+T9QKV1pHaK2SLs3GHY2Ck6DRQ/D7pHk8Wqn+Z/5XK8XQoI49kNW79DRJ+8zwUGXEuS5k9XXtYmKaCdTgtPheXk4SdeDXkSHQ5iIzj+c7R+e741NhPRMtUm/Dd7RxYYMA== X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(39840400002)(39410400002)(39400400002)(39450400003)(377454003)(24454002)(25786009)(7416002)(33646002)(7736002)(31696002)(86362001)(189998001)(93886004)(53546009)(36756003)(229853002)(3846002)(6116002)(6246003)(83506001)(54356999)(50986999)(76176999)(305945005)(65826007)(110136004)(38730400002)(47776003)(5660300001)(65956001)(66066001)(8666007)(4001350100001)(230700001)(4326008)(23746002)(53936002)(8676002)(42186005)(31686004)(50466002)(54906002)(64126003)(2906002)(6486002)(77096006)(90366009)(6666003)(81166006)(2950100002)(6916009);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2055;H:[172.16.25.12];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0801MB2055;23:UbSDM/XuqvlJ3yav8Dr0BGfDm6wIyke0jwM?= =?Windows-1252?Q?p4wWQOTkVfw3tw297YBaWqhJ68/akI83EvE06apSDDxDxGzvXnE4oqVb?= =?Windows-1252?Q?A4l1YXz85zCPBt32LyELSU0Lit5aTNBj2iBIA+TuGEQm8CBusrTUiPva?= =?Windows-1252?Q?1enEUsnfmkLdmftfSC8NMdCC4kcUMjA+rJIcVQqCjVXyOKdtKRln0Evr?= =?Windows-1252?Q?qCdwcvW646HE9cqEwkgWO0jD51fFRI+hT8pip9kOeOuCgRRhsCAFLB3e?= =?Windows-1252?Q?eITP9MRV4N4XUptd3AzSkJMfHX7+HqZY+IthMJRywA9aNO7Iv4oH5vEI?= =?Windows-1252?Q?x5s8AHX4VE0laq26KD66C7XdUR+eqNyfU4JMKdir1OeariMBXYEswAP1?= =?Windows-1252?Q?cuhdYgrIaPvPVcpU1WV+ASonte1o+ilEXZqM+GHvW0q075AP2FnvfOWj?= =?Windows-1252?Q?wSwlFaeLKzE45qqiWHPHYMTbIaQJlOnHJqfJ722sO3Tk1WSzZtnT5+w6?= =?Windows-1252?Q?jjPfkcE+iGQsodFu2pq0iqy3q3d/1XRLctFlVWnIqy+KRn5/BMA2K4pM?= =?Windows-1252?Q?4ZgyemYtwP2zqtRzZ2j9WgRivjjSkP2GnzNnc2OFwQUQWUKCA3LMQSGl?= =?Windows-1252?Q?WBH/sdyHIAdzudltqaIdWuawcKcCvajAanoeoyhuUiAZNWlciA2QCwRk?= =?Windows-1252?Q?aXGOAcDdxY/a87JubmPxedRB0UmZOXPl1vMI1qTiEzZCmCQzXjZO63dO?= =?Windows-1252?Q?nU6A9bQKX2c87zlkw4gNW2Qw/cCsmQfeA1LW2I0T2z5fanh6H+cV37Lb?= =?Windows-1252?Q?sVq+K1QJL72l+NYAYiMsW6c9XwK17VLeZite3/1/D0nrcUi+yRdyOU6t?= =?Windows-1252?Q?wkisurw0kT4oIlSInQObnQeOR4SInPBy7GuGUL9xlIXDWDYdtVHIFOah?= =?Windows-1252?Q?tm/mPYCEBlIsSwG74j/z1ugI8HzKJiHhBY6//5Z5ofanAvgTsKO6hTi+?= =?Windows-1252?Q?qy82E2ALHZhO0NxrVbrTyXbKq0Qshc0xwpg70xpUtcpcZH86ANKyIVLq?= =?Windows-1252?Q?7I1awPl414YRW/GBXpe+2LNvWIZ4p633YNceb7AMVAcn/wXHTFglJ9TC?= =?Windows-1252?Q?1fwWxzOi9EpqbJ9V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pamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2055;7:YbvGa9QjIz0xzfnW7RClRvMcr1HEbVAFGlts/dFnBsKOFLqKJU8u1FzHN5yYgqW3OwS90L4yTKBAHAJIJUo/RTU3Kd+TLGjZ79GNbslqYv5/W0Tw2kis5dDbmmwhhdq8848XCe4baspc8CylD1k1WqTaE2ykvTDmSgB5T5q5amvn40a0uvBbuYwhJRH/yK0tUBeZKRgcPyfJmDf4jr7zgk2UCrf18VOb2Wri6nO+INyv64wavDQ7TDH+eh5tSzL3y7hlrZ1MY9CnNHnKkLNZzmTlkHGV3X064dKEqL0QlvD31Ncz4BUUOzrjxU1XAZ1N3HTdDnQwF2k6Mz8RfdkkcA==;20:Q/4NkzxxxEIU7xQ3csCdPbWXfRjqvMxOBT+V0AGkSoxS2/Kct4MIIAXHRobrJIbBgKd89G5lLn42RgkAQE1M4ux+Ra+f7CTEZsJ+O7t85av3klDOD0sr8W3NM+1Dx89IbWILrb4oiPVFARkjpccLoJuaA5rd3nuAL5L9zoYuZSI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 14:30:22.1707 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2055 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 888 Lines: 29 On 03/30/2017 04:37 PM, Pavel Machek wrote: > >> 3) This might produce false positives. E.g. module may defer vfree() in workqueue, so the >> actual vfree() call happens after module unloaded. > > Umm. Really? > I should have been more specific. I meant vfree() called by module from the interrupt context. In that case the actual __vunmap() will be deferred via schedule_work() thus it might happen after the module unloaded. See 32fcfd40715e ("make vfree() safe to call from interrupt contexts") > I agree that module may alloc memory and pass it to someone else. Ok > so far. > Right. In the case with vfree() from interrupt we actually pass the memory to the core code to free it later. > But if module code executes after module is unloaded -- that is use > after free -- right? Sure, module code can't execute after module unloaded, it doesn't exist anymore.