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, 18 Oct 2017 16:35:14 +1100
From:   Michael Ellerman <mpe@...erman.id.au>
To:     Andi Kleen <andi@...stfloor.org>, akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] Support resetting WARN*_ONCE

Andi Kleen <andi@...stfloor.org> writes:

> From: Andi Kleen <ak@...ux.intel.com>
>
> I like _ONCE warnings because it's guaranteed that they don't
> flood the log.
>
> During testing I find it useful to reset the state of the once warnings,
> so that I can rerun tests and see if they trigger again, or can
> guarantee that a test run always hits the same warnings.
>
> This patch adds a debugfs interface to reset all the _ONCE
> warnings so that they appear again:
>
> echo 1 > /sys/kernel/debug/clear_warn_once
>
> This is implemented by putting all the warning booleans into
> a special section, and clearing it.

That won't work for arches that do the ONCE logic with a flag will it?
ie. arm64, parisc, powerpc, s390, sh, x86.

They use the version of WARN_ON_ONCE at line ~64 of bug.h

#define __WARN_ONCE_TAINT(taint)	__WARN_FLAGS(BUGFLAG_ONCE|BUGFLAG_TAINT(taint))

#define WARN_ON_ONCE(condition) ({				\
	int __ret_warn_on = !!(condition);			\
	if (unlikely(__ret_warn_on))				\
		__WARN_ONCE_TAINT(TAINT_WARN);			\
	unlikely(__ret_warn_on);				\
})


cheers

> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index 87191357d303..68c2f08b7914 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -129,7 +129,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
>  
>  #ifndef WARN_ON_ONCE
>  #define WARN_ON_ONCE(condition)	({				\
> -	static bool __section(.data.unlikely) __warned;		\
> +	static bool __section(.data.once) __warned;		\
>  	int __ret_warn_once = !!(condition);			\
>  								\
>  	if (unlikely(__ret_warn_once && !__warned)) {		\
> @@ -141,7 +141,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
>  #endif
>  
>  #define WARN_ONCE(condition, format...)	({			\
> -	static bool __section(.data.unlikely) __warned;		\
> +	static bool __section(.data.once) __warned;		\
>  	int __ret_warn_once = !!(condition);			\
>  								\
>  	if (unlikely(__ret_warn_once && !__warned)) {		\
> @@ -152,7 +152,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
>  })
>  
>  #define WARN_TAINT_ONCE(condition, taint, format...)	({	\
> -	static bool __section(.data.unlikely) __warned;		\
> +	static bool __section(.data.once) __warned;		\
>  	int __ret_warn_once = !!(condition);			\
>  								\
>  	if (unlikely(__ret_warn_once && !__warned)) {		\

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ