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

From: Josh Poimboeuf
Date: Sat Jul 15 2017 - 09:31:22 EST

On Sat, Jul 15, 2017 at 08:29:57AM +0200, Mike Galbraith wrote:
> On Sat, 2017-07-15 at 00:10 -0500, Josh Poimboeuf wrote:
> >
> > The bug table was made writable for vmlinux, which relies on
> > and for laying out the sections. However,
> > it wasn't made writable for modules, which rely on the ELF section
> > header flags.
> It seems vmlinux sort of relies on your fix too. Âobjdump did show
> vmlinux __bug_table as being READONLY, but that (lie) is now gone.

Yeah, those ELF bits are ignored by the kernel. It sets its own
protections during boot, e.g. mark_rodata_ro().