All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jessica Yu <jeyu@kernel.org>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v2] module: check for exit sections in layout_sections() instead of module_init_section()
Date: Mon, 17 May 2021 09:56:37 +0200	[thread overview]
Message-ID: <YKIhtYArH24372TZ@p200300cbcf361a0029e37a38368d6727.dip0.t-ipconnect.de> (raw)
In-Reply-To: <20210514170930.GE12395@shell.armlinux.org.uk>

+++ Russell King (Oracle) [14/05/21 18:09 +0100]:
>On Fri, May 14, 2021 at 06:09:04PM +0200, Jessica Yu wrote:
>> Previously, when CONFIG_MODULE_UNLOAD=n, the module loader just does not
>> attempt to load exit sections since it never expects that any code in those
>> sections will ever execute. However, dynamic code patching (alternatives,
>> jump_label and static_call) can have sites in __exit code, even if __exit is
>> never executed. Therefore __exit must be present at runtime, at least for as
>> long as __init code is.
>>
>> Commit 33121347fb1c ("module: treat exit sections the same as init
>> sections when !CONFIG_MODULE_UNLOAD") solves the requirements of
>> jump_labels and static_calls by putting the exit sections in the init
>> region of the module so that they are at least present at init, and
>> discarded afterwards. It does this by including a check for exit
>> sections in module_init_section(), so that it also returns true for exit
>> sections, and the module loader will automatically sort them in the init
>> region of the module.
>>
>> However, the solution there was not completely arch-independent. ARM is
>> a special case where it supplies its own module_{init, exit}_section()
>> functions. Instead of pushing the exit section checks into
>> module_init_section(), just implement the exit section check in
>> layout_sections(), so that we don't have to touch arch-dependent code.
>>
>> Fixes: 33121347fb1c ("module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD")
>> Signed-off-by: Jessica Yu <jeyu@kernel.org>
>
>Looks good!
>
>Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>
>Thanks!

Queued, thanks for the review Russell!

Jessica

      reply	other threads:[~2021-05-17  7:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 16:09 [PATCH v2] module: check for exit sections in layout_sections() instead of module_init_section() Jessica Yu
2021-05-14 17:09 ` Russell King (Oracle)
2021-05-17  7:56   ` Jessica Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKIhtYArH24372TZ@p200300cbcf361a0029e37a38368d6727.dip0.t-ipconnect.de \
    --to=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.