live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Kosina <jikos@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Petr Mladek <pmladek@suse.com>, Miroslav Benes <mbenes@suse.cz>,
	Jessica Yu <jeyu@kernel.org>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	Johannes Erdfelt <johannes@erdfelt.com>,
	Ingo Molnar <mingo@kernel.org>,
	mhiramat@kernel.org, torvalds@linux-foundation.org
Subject: [PATCH] ftrace/x86: anotate text_mutex split between ftrace_arch_code_modify_post_process() and ftrace_arch_code_modify_prepare()
Date: Sat, 29 Jun 2019 23:22:33 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.YFH.7.76.1906292321170.27227@cbobk.fhfr.pm> (raw)
In-Reply-To: <20190629171931.770f05a5@gandalf.local.home>

From: Jiri Kosina <jkosina@suse.cz>

ftrace_arch_code_modify_prepare() is acquiring text_mutex, while the
corresponding release is happening in ftrace_arch_code_modify_post_process().

This has already been documented in the code, but let's also make the fact
that this is intentional clear to the semantic analysis tools such as sparse.

Fixes: 39611265edc1a ("ftrace/x86: Add a comment to why we take text_mutex in ftrace_arch_code_modify_prepare()")
Fixes: d5b844a2cf507 ("ftrace/x86: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()")
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 arch/x86/kernel/ftrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index d7e93b2783fd..76228525acd0 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -35,6 +35,7 @@
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 int ftrace_arch_code_modify_prepare(void)
+    __acquires(&text_mutex)
 {
 	/*
 	 * Need to grab text_mutex to prevent a race from module loading
@@ -48,6 +49,7 @@ int ftrace_arch_code_modify_prepare(void)
 }
 
 int ftrace_arch_code_modify_post_process(void)
+    __releases(&text_mutex)
 {
 	set_all_modules_text_ro();
 	set_kernel_text_ro();
	
-- 
Jiri Kosina
SUSE Labs


  reply	other threads:[~2019-06-29 21:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27  8:13 [PATCH] ftrace: Remove possible deadlock between register_kprobe() and ftrace_run_update_code() Petr Mladek
2019-06-27 22:17 ` Thomas Gleixner
2019-06-27 22:47 ` Josh Poimboeuf
2019-06-27 23:04   ` Steven Rostedt
2019-06-27 23:09     ` Thomas Gleixner
2019-06-27 23:12       ` Steven Rostedt
2019-06-27 23:19       ` Josh Poimboeuf
2019-06-27 23:25         ` Thomas Gleixner
2019-06-27 23:25         ` Steven Rostedt
2019-06-28  1:13         ` Steven Rostedt
2019-06-28  1:17           ` Josh Poimboeuf
2019-06-28 17:33         ` Jiri Kosina
2019-06-28 17:37           ` Steven Rostedt
2019-06-29 20:56             ` Jiri Kosina
2019-06-29 21:19               ` Steven Rostedt
2019-06-29 21:22                 ` Jiri Kosina [this message]
2019-06-28  7:32 ` Miroslav Benes
2019-06-28 10:52   ` Petr Mladek
2019-06-28 13:54     ` Steven Rostedt
2019-06-28 15:46       ` Steven Rostedt
2019-06-28 15:51         ` Josh Poimboeuf

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=nycvar.YFH.7.76.1906292321170.27227@cbobk.fhfr.pm \
    --to=jikos@kernel.org \
    --cc=jeyu@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=johannes@erdfelt.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).