From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755543Ab1F0XUU (ORCPT ); Mon, 27 Jun 2011 19:20:20 -0400 Received: from mail.candelatech.com ([208.74.158.172]:43775 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755485Ab1F0XRS (ORCPT ); Mon, 27 Jun 2011 19:17:18 -0400 From: greearb@candelatech.com To: linux-kernel@vger.kernel.org Cc: Ben Greear Subject: [PATCH 0/2] SLUB memory debugging improvements. Date: Mon, 27 Jun 2011 16:17:09 -0700 Message-Id: <1309216631-31493-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Greear The idea is to grab a useful sized stack trace for creation/deletion points instead of just a single method. A second patch adds a command to check if memory should be in use. This is in an attempt to track down some use-after-free bugs I'm seeing in nfs/rpc. However, I did not exactly hit the bug I was expecting, but got this output instead. I'm not sure if my debug patches are not working right, or if this warning is just another symptom of the problem: ============================================================================= BUG kmalloc-64: Wrong object count. Counter is 2 but counted were 1 ----------------------------------------------------------------------------- INFO: Slab 0xffffea0001e19fd0 objects=20 used=20 fp=0x (null) flags=0x20000000004080 Pid: 2349, comm: kworker/1:2 Not tainted 3.0.0-rc4+ #4 Call Trace: [] slab_err+0x8a/0x98 [] ? register_lock_class+0x1e/0x336 [] ? mark_lock+0x2d/0x22d [] on_freelist+0x179/0x1ad [] ? __rpc_execute+0x1ce/0x24b [sunrpc] [] verify_mem_not_deleted+0x5f/0xb3 [] ? rpc_execute+0x42/0x42 [sunrpc] [] rpcb_getport_done+0x23/0x126 [sunrpc] [] rpc_exit_task+0x3f/0x6d [sunrpc] [] __rpc_execute+0x78/0x24b [sunrpc] [] ? rpc_execute+0x42/0x42 [sunrpc] [] rpc_async_schedule+0x10/0x12 [sunrpc] [] process_one_work+0x230/0x41d [] ? process_one_work+0x17b/0x41d [] worker_thread+0x133/0x217 [] ? manage_workers+0x191/0x191 [] kthread+0x7d/0x85 [] kernel_thread_helper+0x4/0x10 [] ? retint_restore_args+0x13/0x13 [] ? __init_kthread_worker+0x56/0x56 [] ? gs_change+0x13/0x13 FIX kmalloc-64: Object count adjusted. ============================================================================= BUG kmalloc-64: Wrong object count. Counter is 1 but counted were 20 ----------------------------------------------------------------------------- INFO: Slab 0xffffea0001e19fd0 objects=20 used=1 fp=0x (null) flags=0x20000000004081 Pid: 2349, comm: kworker/1:2 Not tainted 3.0.0-rc4+ #4 Call Trace: [] slab_err+0x8a/0x98 [] ? mark_lock+0x2d/0x22d [] ? _raw_spin_unlock_irqrestore+0x42/0x79 [] ? get_parent_ip+0x11/0x41 [] on_freelist+0x179/0x1ad [] ? rpcb_map_release+0x3f/0x44 [sunrpc] [] ? rpc_execute+0x42/0x42 [sunrpc] [] free_debug_processing+0x5c/0x18e [] ? rpc_execute+0x42/0x42 [sunrpc] [] __slab_free+0x57/0x150 [] ? rpcb_map_release+0x3f/0x44 [sunrpc] [] ? rpcb_map_release+0x3f/0x44 [sunrpc] [] kfree+0x107/0x13a [] rpcb_map_release+0x3f/0x44 [sunrpc] [] rpc_release_calldata+0x12/0x14 [sunrpc] [] rpc_free_task+0x59/0x61 [sunrpc] [] rpc_final_put_task+0x82/0x8a [sunrpc] [] __rpc_execute+0x23c/0x24b [sunrpc] [] ? rpc_execute+0x42/0x42 [sunrpc] [] rpc_async_schedule+0x10/0x12 [sunrpc] [] process_one_work+0x230/0x41d [] ? process_one_work+0x17b/0x41d [] worker_thread+0x133/0x217 [] ? manage_workers+0x191/0x191 [] kthread+0x7d/0x85 [] kernel_thread_helper+0x4/0x10 [] ? retint_restore_args+0x13/0x13 [] ? __init_kthread_worker+0x56/0x56 [] ? gs_change+0x13/0x13 FIX kmalloc-64: Object count adjusted. Ben Greear (2): slub: Enable backtrace for create/delete points. slub: Add method to verify memory is not deleted. include/linux/slab.h | 9 ++++++ mm/slub.c | 73 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 7 deletions(-) -- 1.7.3.4