Re: [PATCH] taint on lockdep warning with new TAINT_LOCKDEP

From: Ingo Molnar
Date: Wed Feb 18 2015 - 17:53:57 EST



* Slava Pestov <sp@xxxxxxxxx> wrote:

> This helps when writing automated tests, since they can fail the
> test if the kernel was tainted instead of manually scraping dmesg
> for interesting strings.
>
> Signed-off-by: Slava Pestov <sp@xxxxxxxxxxxxx>
> ---
> include/linux/kernel.h | 1 +
> kernel/locking/lockdep.c | 31 +++++++++++++++++++++++++++++++
> kernel/panic.c | 2 ++
> 3 files changed, 34 insertions(+)
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 5449d2f..c46e24e 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -471,6 +471,7 @@ extern enum system_states {
> #define TAINT_OOT_MODULE 12
> #define TAINT_UNSIGNED_MODULE 13
> #define TAINT_SOFTLOCKUP 14
> +#define TAINT_LOCKDEP 15
>
> extern const char hex_asc[];
> #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 88d0d44..4916a32 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -382,6 +382,8 @@ static unsigned long stack_trace[MAX_STACK_TRACE_ENTRIES];
>
> static void print_lockdep_off(const char *bug_msg)
> {
> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);
>
> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

> + add_taint(TAINT_LOCKDEP, LOCKDEP_NOW_UNRELIABLE);

If only we had a function that turns lockdep off in a
single place, instead of having to crap all over lockdep.c?
;-)

Thanks,

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