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] [day] [month] [year] [list]
Date:	Tue, 11 Nov 2008 10:09:15 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <srostedt@...hat.com>
Subject: Re: [PATCH 2/2] ring-buffer: replace most bug ons with warn on and
	disable buffer


* Steven Rostedt <rostedt@...dmis.org> wrote:

> +#define RB_WARN_ON_RET_INT(buffer, cond)			\
> +	do {							\
> +		if (unlikely(cond)) {				\
> +			atomic_inc(&buffer->record_disabled);	\
> +			WARN_ON(1);				\
>  			return -1;				\
>  		}						\

btw., the _RET() methods are rather ugly as they include an implicit 
code flow change (a 'return' statement).

Please change it to a more readable form that preserves the code flow, 
something like:

  if (RB_WARN_ON(buffer, cond))
	return -1;

See kernel/lockdep.c about how to do this cleanly: introduce a 
_single_ global "oh, we are broken" flag which is increased once and 
never decreased again.

In the case of lockdep that's the debug_locks flag. It's used in 
various code-flow-preserving forms of debug checks:

...
        if (DEBUG_LOCKS_WARN_ON(depth >= 20))
                return;
...
                if (!debug_locks_off_graph_unlock())
                        return NULL;
...
        if (!debug_locks_off_graph_unlock())
                return 0;
...
        if (!__raw_spin_is_locked(&lockdep_lock))
                return DEBUG_LOCKS_WARN_ON(1);

etc.

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