Re: Are read-only static labels incompatible with kernel modules?

From: Peter Zijlstra
Date: Tue Dec 08 2020 - 07:52:44 EST


On Mon, Dec 07, 2020 at 09:37:54PM +0100, Andrey Konovalov wrote:
> Hi,
>
> I'm getting a crash when trying to load a module into a kernel that
> uses __ro_after_init static labels, see the crash below. The label is
> defined and initialized in the main kernel binary, and is used in the
> module. Is this not supported?

Clearly not, but also, the whole RO thing never went past the
maintainers (it also seems to be missing a MAINTAINERs entry).

> static_key_set_linked kernel/jump_label.c:368
> jump_label_add_module+0x1ec/0x2dc kernel/jump_label.c:658
> jump_label_module_notify+0x40/0xa4 kernel/jump_label.c:736

This, it needs to modify the key, which is RO, to add a list of sites
from the module.

It could probably be fixed..