mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jessica Yu <jeyu@kernel.org>
Cc: x86@kernel.org, rostedt@goodmis.org, jpoimboe@redhat.com,
	jbaron@akamai.com, ardb@kernel.org, sumit.garg@linaro.org,
	oliver.sang@intel.com, jarkko@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD
Date: Tue, 23 Mar 2021 15:52:37 +0100	[thread overview]
Message-ID: <YFoAtV58k+1zgH50@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210323142756.11443-1-jeyu@kernel.org>

On Tue, Mar 23, 2021 at 03:27:56PM +0100, Jessica Yu wrote:
> 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.
> 
> Additionally, for jump_label and static_call, the __exit sites must also
> identify as within_module_init(), such that the infrastructure is aware
> to never touch them after module init -- alternatives are only ran once
> at init and hence don't have this particular constraint.
> 
> By making __exit identify as __init for !MODULE_UNLOAD, the above is
> satisfied.
> 
> So the section ordering should look like the following when
> !CONFIG_MODULE_UNLOAD, with the .exit sections moved to the init region of
> the module.
> 
> Core section allocation order:
>  	.text
>  	.rodata
>  	__ksymtab_gpl
>  	__ksymtab_strings
>  	.note.* sections
>  	.bss
>  	.data
>  	.gnu.linkonce.this_module
>  Init section allocation order:
>  	.init.text
>  	.exit.text
>  	.symtab
>  	.strtab
> 
> [jeyu: thanks to Peter Zijlstra for most of the changelog]
> 
> Link: https://lore.kernel.org/lkml/YFiuphGw0RKehWsQ@gunter/
> Signed-off-by: Jessica Yu <jeyu@kernel.org>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
> 
> Do you want to take this patch with the other static_call patches? Or
> should I take this through modules-next?

Take it through modules-next, I haven't seen an actual report on this
and it's been broken forever afaict. I only found it by accident while
chasing this other problem.

      reply	other threads:[~2021-03-23 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 14:27 Jessica Yu
2021-03-23 14:52 ` Peter Zijlstra [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=YFoAtV58k+1zgH50@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ardb@kernel.org \
    --cc=jarkko@kernel.org \
    --cc=jbaron@akamai.com \
    --cc=jeyu@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=sumit.garg@linaro.org \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®