Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756247AbcLOSq4 (ORCPT ); Thu, 15 Dec 2016 13:46:56 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36793 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754094AbcLOSqu (ORCPT ); Thu, 15 Dec 2016 13:46:50 -0500 Date: Thu, 15 Dec 2016 18:46:30 +0000 From: Aaron Tomlin To: "Luis R. Rodriguez" Cc: shuah@kernel.org, jeyu@redhat.com, rusty@rustcorp.com.au, ebiederm@xmission.com, dmitry.torokhov@gmail.com, acme@redhat.com, corbet@lwn.net, martin.wilck@suse.com, mmarek@suse.com, pmladek@suse.com, hare@suse.com, rwright@hpe.com, jeffm@suse.com, DSterba@suse.com, fdmanana@suse.com, neilb@suse.com, linux@roeck-us.net, rgoldwyn@suse.com, subashab@codeaurora.org, xypron.glpk@gmx.de, keescook@chromium.org, mbenes@suse.cz, paulmck@linux.vnet.ibm.com, dan.j.williams@intel.com, jpoimboe@redhat.com, davem@davemloft.net, mingo@redhat.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 02/10] module: fix memory leak on early load_module() failures Message-ID: <20161215184630.mapjqzdox5aqmvsz@atomlin.usersys.redhat.com> References: <20161208184801.1689-1-mcgrof@kernel.org> <20161208194802.2438-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dpuob5ohdiqhyzst" Content-Disposition: inline In-Reply-To: <20161208194802.2438-1-mcgrof@kernel.org> X-PGP-Key: http://pgp.mit.edu/pks/lookup?search=atomlin%40redhat.com X-PGP-Fingerprint: 7906 84EB FA8A 9638 8D1E 6E9B E2DE 9658 19CC 77D6 User-Agent: NeoMutt/20161126 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2743 Lines: 71 --dpuob5ohdiqhyzst Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2016-12-08 11:48 -0800, Luis R. Rodriguez wrote: > While looking for early possible module loading failures I was > able to reproduce a memory leak possible with kmemleak. There > are a few rare ways to trigger a failure: >=20 > o we've run into a failure while processing kernel parameters > (parse_args() returns an error) > o mod_sysfs_setup() fails > o we're a live patch module and copy_module_elf() fails >=20 > Chances of running into this issue is really low. >=20 > kmemleak splat: >=20 > unreferenced object 0xffff9f2c4ada1b00 (size 32): > comm "kworker/u16:4", pid 82, jiffies 4294897636 (age 681.816s) > hex dump (first 32 bytes): > 6d 65 6d 73 74 69 63 6b 30 00 00 00 00 00 00 00 memstick0....... > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > backtrace: > [] kmemleak_alloc+0x4a/0xa0 > [] __kmalloc_track_caller+0x126/0x230 > [] kstrdup+0x31/0x60 > [] kstrdup_const+0x24/0x30 > [] kvasprintf_const+0x7a/0x90 > [] kobject_set_name_vargs+0x21/0x90 > [] dev_set_name+0x47/0x50 > [] memstick_check+0x95/0x33c [memstick] > [] process_one_work+0x1f3/0x4b0 > [] worker_thread+0x48/0x4e0 > [] kthread+0xc9/0xe0 > [] ret_from_fork+0x1f/0x40 > [] 0xffffffffffffffff >=20 > Signed-off-by: Luis R. Rodriguez > --- > kernel/module.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Aaron Tomlin --=20 Aaron Tomlin --dpuob5ohdiqhyzst Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJYUuUGAAoJEOLellgZzHfWygAP/jDRL6EyGYp/KHdb3274QmyX /FK/vTU7Wk9labBzgYjAB+1QC9KdH+C2iDwUVncTZV7hFBQbnArG9s9VCzamBrkK /F5aRnM8hSQQsoKH5lMTyuLKwANtofaPnRol7JHA9LPGk4h4/rvNoQzITGHeEl+a bL0iTaRtyR95Bql68FTnQgId2T7D6VbewINUePsBC96CeIgb5n8Th0caB/onfAdC uuV+ViqScTVeJpbGcBJT5RqD99Psy1mb8dFPvOsnTAWXbT5Tq28KwISgoH0SWjuh afPima6jEShVMbzh5bXh/3LfQ6tqQp4NLN5YOgH8PoYZLMK0EIw5kv7YM0AhJgvF P/xWBPCrhVbPC3ivNur+AvHu+oAu38OI5ZqZ4rfendzMBaoRw8j5/HtuISkcSK8D pl50X8tTYEYk9l9Y1FC8NPux92BpaBP2x3t3iVdwimZy/eU5dqKG9lM4nEzcxf+7 cUOGBwxf+cS2iMAtKP+jgx2e/Shw+2Us3dHK0zlRW5PIh+wUO4I3QeT2e0hLoXP6 0eX3clMwbb7DsyfqrVJ2dlzekfvzGcRJNYEVANVMOkyJbhLWkt0Ep8uErTUafPk2 VI7VaVh3yNiYlOXFtvjN2ap8DGnkcbsZOOSmILYBHbfkpNlUzBc15moE8jQBHkEC ESOaxUFhzOKoztWePFQV =ywFv -----END PGP SIGNATURE----- --dpuob5ohdiqhyzst--