Messages in this thread | | | Date | Fri, 14 Jun 2019 17:04:08 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH 1/3] module: Fix livepatch/ftrace module text permissions race |
| |
On Thu, 13 Jun 2019 20:07:22 -0500 Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> It's possible for livepatch and ftrace to be toggling a module's text > permissions at the same time, resulting in the following panic: >
[..]
> The above panic occurs when loading two modules at the same time with > ftrace enabled, where at least one of the modules is a livepatch module: > > CPU0 CPU1 > klp_enable_patch() > klp_init_object_loaded() > module_disable_ro() > ftrace_module_enable() > ftrace_arch_code_modify_post_process() > set_all_modules_text_ro() > klp_write_object_relocations() > apply_relocate_add() > *patches read-only code* - BOOM > > A similar race exists when toggling ftrace while loading a livepatch > module. > > Fix it by ensuring that the livepatch and ftrace code patching > operations -- and their respective permissions changes -- are protected > by the text_mutex. > > Reported-by: Johannes Erdfelt <johannes@erdfelt.com> > Fixes: 444d13ff10fb ("modules: add ro_after_init support") > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> > Acked-by: Jessica Yu <jeyu@kernel.org> > Reviewed-by: Petr Mladek <pmladek@suse.com> > Reviewed-by: Miroslav Benes <mbenes@suse.cz>
This patch looks uncontroversial. I'm going to pull this one in and start testing it. And if it works, I'll push to Linus.
-- Steve
| |