lkml.org 
[lkml]   [2021]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] static_call: Fix static_call_update() sanity check
On Thu, Mar 18, 2021 at 12:31:59PM +0100, Peter Zijlstra wrote:
> if (!kernel_text_address((unsigned long)site_addr)) {
> - WARN_ONCE(1, "can't patch static call site at %pS",
> + /*
> + * This skips patching __exit, which is part of
> + * init_section_contains() but is not part of
> + * kernel_text_address().
> + *
> + * Skipping __exit is fine since it will never
> + * be executed.
> + */
> + WARN_ONCE(!static_call_is_init(site),
> + "can't patch static call site at %pS",
> site_addr);
> continue;
> }

It might be good to clarify the situation for __exit in modules in the
comment and/or changelog, as they both seem to be implicitly talking
only about __exit in vmlinux.

For CONFIG_MODULE_UNLOAD, the code ends up in the normal text area, so
static_call_is_init() is false and kernel_text_address() is true.

For !CONFIG_MODULE_UNLOAD, the code gets discarded during module load,
so static_call_is_init() and kernel_text_address() are both false. I
guess that will trigger a warning?

--
Josh

\
 
 \ /
  Last update: 2021-03-18 17:15    [W:0.103 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site