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:	Wed, 12 Oct 2011 18:23:09 +0100
From:	David Howells <dhowells@...hat.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	dhowells@...hat.com, linux-arch@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 1/7] Add assertion support with annotated oopsing

Ingo Molnar <mingo@...e.hu> wrote:

> Looks useful, but i'd suggest to make this a variant of the standard 
> BUG_ON()/WARN_ON() checks we already have, not an explicit assert().
> 
> BUG_ON_VERBOSE() or such.

I personally prefer the positive check (ASSERT() saying that this expression
must be true) as opposed to the negative check (BUG_ON() saying that this must
be false).  I find it easier to think about the logic (I expect value X to be
like this, value Y to be like that, etc.).

That said, I could make the base bit BUG_VERBOSE(FMT, ...) and wrap ASSERT*()
around that.

However, I'd _much_ rather make it so that I can post the "cut here" message
early - but, IIRC, Linus hated that idea.

> I find assert()'s inversion confusing when mixed with WARN_ON()/BUG_ON().

Why did we do it this way originally, rather than using assert, I wonder?
Especially since the concept of assert already exists in userspace.

> Likewise, the message of:
> 
>        	ASSERTION FAILED at fs/dcache.c:863!
> 
> is rather confusing to me (i never know how the condition printed is 
> to be interpreted) - why not use the usual 'BUG: ...' message 
> convention?

I don't see why it should be confusing.  Something bad happened at file:line.

I could make it print "BUG" instead.  That's a minor matter.  The ASSERT
macros in patch 2 could then generate a report that looks like this:

	------------[ cut here ]------------
	kernel BUG at fs/fscache/main.c:109!
	Assertion failed: 2 > c is false
	invalid opcode: 0000 [#1] SMP

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