Re: [PATCH] debug: Fix WARN_ON_ONCE() for modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 22, 2017 at 04:31:17PM +0800, changbin.du@xxxxxxxxx wrote:
> From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> 
> commit 325cdacd03c12629aa5f9ee2ace49b1f3dc184a8 upstream.
> 
> Mike Galbraith reported a situation where a WARN_ON_ONCE() call in DRM
> code turned into an oops.  As it turns out, WARN_ON_ONCE() seems to be
> completely broken when called from a module.
> 
> The bug was introduced with the following commit:
> 
>   19d436268dde ("debug: Add _ONCE() logic to report_bug()")
> 
> That commit changed WARN_ON_ONCE() to move its 'once' logic into the bug
> trap handler.  It requires a writable bug table so that the BUGFLAG_DONE
> bit can be written to the flags to indicate the first warning has
> occurred.
> 
> The bug table was made writable for vmlinux, which relies on
> vmlinux.lds.S and vmlinux.lds.h for laying out the sections.  However,
> it wasn't made writable for modules, which rely on the ELF section
> header flags.
> 
> Reported-by: Mike Galbraith <efault@xxxxxx>
> Tested-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Fixes: 19d436268dde ("debug: Add _ONCE() logic to report_bug()")
> Link: http://lkml.kernel.org/r/a53b04235a65478dd9afc51f5b329fdc65c84364.1500095401.git.jpoimboe@xxxxxxxxxx
> Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx> # v4.11.x
> Cc: <stable@xxxxxxxxxxxxxxx> # v4.12.x

This is only needed for 4.12.  4.11 doesn't have 19d436268dde ("debug:
Add _ONCE() logic to report_bug()").

-- 
Josh



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]