]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
482821dabb8a6b7034a7b88af16af62c23dca401
[thirdparty/kernel/stable-queue.git] /
1 From 074376ac0e1d1fcd4fafebca86ee6158e7c20680 Mon Sep 17 00:00:00 2001
2 From: Jiri Kosina <jkosina@suse.cz>
3 Date: Sat, 29 Jun 2019 23:22:33 +0200
4 Subject: ftrace/x86: Anotate text_mutex split between ftrace_arch_code_modify_post_process() and ftrace_arch_code_modify_prepare()
5
6 From: Jiri Kosina <jkosina@suse.cz>
7
8 commit 074376ac0e1d1fcd4fafebca86ee6158e7c20680 upstream.
9
10 ftrace_arch_code_modify_prepare() is acquiring text_mutex, while the
11 corresponding release is happening in ftrace_arch_code_modify_post_process().
12
13 This has already been documented in the code, but let's also make the fact
14 that this is intentional clear to the semantic analysis tools such as sparse.
15
16 Link: http://lkml.kernel.org/r/nycvar.YFH.7.76.1906292321170.27227@cbobk.fhfr.pm
17
18 Fixes: 39611265edc1a ("ftrace/x86: Add a comment to why we take text_mutex in ftrace_arch_code_modify_prepare()")
19 Fixes: d5b844a2cf507 ("ftrace/x86: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()")
20 Signed-off-by: Jiri Kosina <jkosina@suse.cz>
21 Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
22 Cc: Guenter Roeck <linux@roeck-us.net>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 arch/x86/kernel/ftrace.c | 2 ++
27 1 file changed, 2 insertions(+)
28
29 --- a/arch/x86/kernel/ftrace.c
30 +++ b/arch/x86/kernel/ftrace.c
31 @@ -36,6 +36,7 @@
32 #ifdef CONFIG_DYNAMIC_FTRACE
33
34 int ftrace_arch_code_modify_prepare(void)
35 + __acquires(&text_mutex)
36 {
37 mutex_lock(&text_mutex);
38 set_kernel_text_rw();
39 @@ -44,6 +45,7 @@ int ftrace_arch_code_modify_prepare(void
40 }
41
42 int ftrace_arch_code_modify_post_process(void)
43 + __releases(&text_mutex)
44 {
45 set_all_modules_text_ro();
46 set_kernel_text_ro();