[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190614170408.1b1162dc@gandalf.local.home>
Date: Fri, 14 Jun 2019 17:04:08 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Jessica Yu <jeyu@...nel.org>, Petr Mladek <pmladek@...e.com>,
Jiri Kosina <jikos@...nel.org>,
Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
Johannes Erdfelt <johannes@...felt.com>,
Ingo Molnar <mingo@...nel.org>
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@...hat.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@...felt.com>
> Fixes: 444d13ff10fb ("modules: add ro_after_init support")
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> Acked-by: Jessica Yu <jeyu@...nel.org>
> Reviewed-by: Petr Mladek <pmladek@...e.com>
> Reviewed-by: Miroslav Benes <mbenes@...e.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
Powered by blists - more mailing lists