Re: [GIT PULL] Modules updates for v5.13

From: Jessica Yu
Date: Mon May 03 2021 - 06:13:42 EST


+++ Linus Torvalds [30/04/21 12:37 -0700]:
On Wed, Apr 28, 2021 at 5:58 AM Jessica Yu <jeyu@xxxxxxxxxx> wrote:

Therefore, load the __exit sections even when
CONFIG_MODULE_UNLOAD=n, and discard them after init.

Hi Linus,

So I've pulled this, but I have two questions based on reading the patch..

(a) Where's that "discard them after init" logic?

So the idea is for the exit sections to additionally identify as init
sections via module_init_section() when CONFIG_MODULE_UNLOAD=n, so
that the existing logic in layout_sections() picks this up and puts
the exit sections into the init area of the module (mod->init_layout.base).

Then, since we've placed the exit sections in the init region of the
module, they will automatically get freed at the end of
do_init_module() with the rest of the init sections. Peter has also
mentioned that jump_label and static_call want the exit sections to
also identify as init via within_module_init(), so this change should
satisfy their requirement as well. I should have explained this more
in the changelog and apologize that it wasn't clear.

(b) ARM has its own module_init/exit_section() functions, and now
seems to have different logic than everybody else as a result..

No, you are right, I had forgotten that ARM is a special case :-( I
will add a similar hunk for ARM and submit that for the next -rc so
that all arches are on the same page here.


Jessica