lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Nov 2016 22:39:48 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Jakub Kicinski <kubakici@...pl>,
        "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
        Johannes Berg <johannes@...solutions.net>,
        Maciej Żenczykowski <zenczykowski@...il.com>
Subject: [PATCH] userns: suppress kmemleak message

We do not ever intend to unregister "user" sysctl table, unfortunately
it leads kmemleak to believe that we are leaking memory:

unreferenced object 0xffff8807383bfd48 (size 96):
  comm "swapper/0", pid 1, jiffies 4294894636 (age 278.320s)
  hex dump (first 32 bytes):
    a0 b4 b0 ba 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:
    [<ffffffffb7de59e8>] kmemleak_alloc+0x28/0x50
    [<ffffffffb676e2f6>] __kmalloc+0x206/0x5a0
    [<ffffffffb69be2d3>] __register_sysctl_table+0xb3/0x1130
    [<ffffffffb69bf36b>] register_sysctl+0x1b/0x20
    [<ffffffffba840de1>] user_namespace_sysctl_init+0x17/0x4c
    [<ffffffffb60022b7>] do_one_initcall+0xb7/0x2a0
    [<ffffffffba7eb102>] kernel_init_freeable+0x597/0x636
    [<ffffffffb7de0433>] kernel_init+0x13/0x140
    [<ffffffffb7dfb36a>] ret_from_fork+0x2a/0x40t show
    [<ffffffffffffffff>] 0xffffffffffffffff

Let's annotate the pointer as kmemleak_not_leak() to suppress the
kmemleak false positive.

Reported-by: Jakub Kicinski <kubakici@...pl>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
---

This was only compiled; Jakub, could you give it a spin?

 kernel/ucount.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/ucount.c b/kernel/ucount.c
index 9d20d5d..07d69b2 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -5,6 +5,7 @@
  *  License.
  */
 
+#include <linux/kmemleak.h>
 #include <linux/stat.h>
 #include <linux/sysctl.h>
 #include <linux/slab.h>
@@ -226,6 +227,7 @@ static __init int user_namespace_sysctl_init(void)
 	 */
 	user_header = register_sysctl("user", empty);
 	BUG_ON(!user_header);
+	kmemleak_not_leak(user_header);
 	BUG_ON(!setup_userns_sysctls(&init_user_ns));
 #endif
 	return 0;
-- 
2.8.0.rc3.226.g39d4020


-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ