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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BC62DE7.20603@cisco.com>
Date:	Wed, 14 Apr 2010 17:04:39 -0400
From:	David VomLehn <dvomlehn@...co.com>
To:	David Howells <dhowells@...hat.com>
CC:	Russell King <rmk@....linux.org.uk>, linux-arch@...r.kernel.org,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/23] Make register values available to panic notifiers

David Howells wrote:
> Russell King <rmk@....linux.org.uk> wrote:
>
>   
>> Can you explain why you want this?
>>
>> I'm wondering about the value of saving the registers; normally when a panic
>> occurs, it's because of a well defined reason, and not because something
>> went wrong in some CPU register; to put it another way, a panic() is a
>> more controlled exception than a BUG() or a bad pointer dereference.
>>     
>
> +1.
>
> I found in FS-Cache and CacheFiles that often the things I most wanted to know
> when I had something of the form:
>
> 	if (A == B)
> 		BUG();
>
> was a and b, so I made the following macro:
>
> 	#define ASSERTCMP(X, OP, Y)					\
> 	do {								\
> 		if (unlikely(!((X) OP (Y)))) {				\
> 			printk(KERN_ERR "\n");				\
> 			printk(KERN_ERR "AFS: Assertion failed\n");	\
> 			printk(KERN_ERR "%lu " #OP " %lu is false\n",	\
> 			       (unsigned long)(X), (unsigned long)(Y));	\
> 			printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
> 			       (unsigned long)(X), (unsigned long)(Y));	\
> 			BUG();						\
> 		}							\
> 	} while(0)
>
> which I could then call like this:
>
> 	ASSERTCMP(A, ==, B);
>
> and if the assertion failed, it prints A and B explicitly.  This is much
> easier than trying to pick the values out of a register dump, especially as
> the compiler may be free to clobber A or B immediately after testing them.
>   
This is great if you'r in a development environment, and can focus on a 
single, well
characterized case. Unfortunately, I'm staring at hundreds of thousands 
of systems
in the field, all which which have a large number of panic() statements 
for which this
approach has not been taken. So, I have no alternative but to pick the 
value out of
a register dump.
> David
>   

--
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