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]
Date:	Thu, 10 May 2012 11:53:53 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] spinlock_debug: Print kallsyms name for lock

On 04/24/12 14:54, Andrew Morton wrote:
> On Mon, 23 Apr 2012 20:17:03 -0700
> Stephen Boyd <sboyd@...eaurora.org> wrote:
>
>> On 04/23/12 14:54, Andrew Morton wrote:
>>>> --- a/lib/spinlock_debug.c
>>>> +++ b/lib/spinlock_debug.c
>>>> @@ -58,7 +58,7 @@ static void spin_dump(raw_spinlock_t *lock, const char *msg)
>>>>  	printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
>>>>  		msg, raw_smp_processor_id(),
>>>>  		current->comm, task_pid_nr(current));
>>>> -	printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, "
>>>> +	printk(KERN_EMERG " lock: %ps, .magic: %08x, .owner: %s/%d, "
>>>>  			".owner_cpu: %d\n",
>>>>  		lock, lock->magic,
>>>>  		owner ? owner->comm : "<none>",
>>> Maybe.  It will only do useful things for statically-allocated locks
>>> which are rare and which we are unlikely to screw up as easily as locks
>>> which lie in dynamically allocated memory.
>> Agreed. It catches the really stupid stuff and that's about it. I was
>> thinking we could get more information about dynamic allocated locks by
>> adding some code to slab to find the slab that a pointer is allocated
>> in. Does that sound possible?
> Well lockdep knows lots of things about the lock, including numerous
> stack backtraces which can be used to identify the lock.  Making 
> spinlock_debug use lockdep infrastructure seems a good fit.
>

I was thinking about this more. In the case of spinlock bad magic I want
to find out who freed this region of memory last because that code most
likely stomped all over my lock and corrupted the magic. With lockdep I
can't find that. I can only find out that the allocator of a lock did a
lock/unlock after a kfree() and I believe lockdep already checks to make
sure live locks are not being freed.

Enabling slub debugging might help, but I would have to get lucky and
allocate the lock after the previous user corrupted it. So I really want
a way to query slab/slub about who last allocated and free this memory
so I can find them when I detect magic corruption.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ