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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200921020007.35803-6-chenjun102@huawei.com>
Date:   Mon, 21 Sep 2020 02:00:07 +0000
From:   Chen Jun <chenjun102@...wei.com>
To:     <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
CC:     <catalin.marinas@....com>, <akpm@...ux-foundation.org>,
        <rui.xiang@...wei.com>, <weiyongjun1@...wei.com>
Subject: [PATCH -next 5/5] mm/kmemleak-test: Add a test case for alloc_percpu

After insmod kmemleak-test.ko, a leaking for alloc_percpu will be
reported as below:

kmemleak: alloc_percpu(sizeof(*elem)) = 00007dfdd26a2c40
			:
			:
unreferenced object 0x7dfdd26a2c40 (size 8):
  comm "insmod", pid 183, jiffies 4294905864 (age 40.520s)
  hex dump (first 8 bytes):
    00 00 00 00 00 00 00 00                          ........
  backtrace:
    [<(____ptrval____)>] pcpu_alloc+0x3ec/0x8c8
    [<(____ptrval____)>] __alloc_percpu+0x18/0x28
    [<(____ptrval____)>] 0xffff800008df525c
    [<(____ptrval____)>] do_one_initcall+0x60/0x1d8
    [<(____ptrval____)>] do_init_module+0x58/0x1d0
    [<(____ptrval____)>] load_module+0x1d8c/0x23d0
    [<(____ptrval____)>] __do_sys_finit_module+0xdc/0xf8
    [<(____ptrval____)>] __arm64_sys_finit_module+0x20/0x30
    [<(____ptrval____)>] el0_svc_common.constprop.3+0x68/0x170
    [<(____ptrval____)>] do_el0_svc+0x24/0x90
    [<(____ptrval____)>] el0_sync_handler+0x13c/0x1a8
    [<(____ptrval____)>] el0_sync+0x158/0x180

Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
Signed-off-by: Chen Jun <chenjun102@...wei.com>
---
 mm/kmemleak-test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/kmemleak-test.c b/mm/kmemleak-test.c
index 75fe1b8c3226..8f3e4a60166b 100644
--- a/mm/kmemleak-test.c
+++ b/mm/kmemleak-test.c
@@ -79,6 +79,9 @@ static int __init kmemleak_test_init(void)
 			per_cpu(kmemleak_test_pointer, i));
 	}
 
+	pr_info("alloc_percpu(sizeof(*elem)) = %px\n",
+		alloc_percpu(sizeof(*elem)));
+
 	return 0;
 }
 module_init(kmemleak_test_init);
-- 
2.25.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ