From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:7967 "EHLO omzsmtpe02.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153AbdFDIMp (ORCPT ); Sun, 4 Jun 2017 04:12:45 -0400 From: "Levin, Alexander (Sasha Levin)" Cc: "Luis R. Rodriguez" , "Eric W . Biederman" , Kees Cook , Nikolay Borisov , Serge Hallyn , Jan Kara , Andrew Morton , Linus Torvalds , "Levin, Alexander (Sasha Levin)" To: "stable@vger.kernel.org" Subject: [PATCH for v4.9 LTS 022/111] kernel/ucount.c: mark user_header with kmemleak_ignore() Date: Sun, 4 Jun 2017 08:11:59 +0000 Message-ID: <20170604081123.19462-22-alexander.levin@verizon.com> References: <20170604081123.19462-1-alexander.levin@verizon.com> In-Reply-To: <20170604081123.19462-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: "Luis R. Rodriguez" [ Upstream commit ed5bd7dc88edf4a4a9c67130742b1b59aa017a5f ] The user_header gets caught by kmemleak with the following splat as missing a free: unreferenced object 0xffff99667a733d80 (size 96): comm "swapper/0", pid 1, jiffies 4294892317 (age 62191.468s) hex dump (first 32 bytes): a0 b6 92 b4 ff ff ff ff 00 00 00 00 01 00 00 00 ................ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: kmemleak_alloc+0x4a/0xa0 __kmalloc+0x144/0x260 __register_sysctl_table+0x54/0x5e0 register_sysctl+0x1b/0x20 user_namespace_sysctl_init+0x17/0x34 do_one_initcall+0x52/0x1a0 kernel_init_freeable+0x173/0x200 kernel_init+0xe/0x100 ret_from_fork+0x2c/0x40 The BUG_ON()s are intended to crash so no need to clean up after ourselves on error there. This is also a kernel/ subsys_init() we don't need a respective exit call here as this is never modular, so just white list it. Link: http://lkml.kernel.org/r/20170203211404.31458-1-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez Cc: Eric W. Biederman Cc: Kees Cook Cc: Nikolay Borisov Cc: Serge Hallyn Cc: Jan Kara Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/ucount.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/ucount.c b/kernel/ucount.c index f4ac18509ecf..c761cdba2a2d 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -231,11 +231,10 @@ static __init int user_namespace_sysctl_init(void) * properly. */ user_header =3D register_sysctl("user", empty); + kmemleak_ignore(user_header); BUG_ON(!user_header); BUG_ON(!setup_userns_sysctls(&init_user_ns)); #endif return 0; } subsys_initcall(user_namespace_sysctl_init); - - --=20 2.11.0