]> git.baikalelectronics.ru Git - kernel.git/commit
kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer()
authorMasami Hiramatsu <mhiramat@kernel.org>
Tue, 28 Jul 2020 07:34:00 +0000 (16:34 +0900)
committerIngo Molnar <mingo@kernel.org>
Tue, 28 Jul 2020 11:19:05 +0000 (13:19 +0200)
commit45a96fb509c696255ee1b29fa759f96e63339968
treed74254e8ac496dc145e75e3c355a4f8df2986ae9
parentde6c8bbbdf5a7a8f8328df9db07295f17e9a15e2
kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer()

Since we already lock both kprobe_mutex and text_mutex in the optimizer,
text will not be changed and the module unloading will be stopped
inside kprobes_module_callback().

The mutex_lock() has originally been introduced to avoid conflict with text modification,
at that point we didn't hold text_mutex.

But after:

  153855eacf26 ("kprobes: Fix potential deadlock in kprobe_optimizer()")

We started holding the text_mutex and don't need the modules mutex anyway.

So remove the module_mutex locking.

[ mingo: Amended the changelog. ]

Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Link: https://lore.kernel.org/r/20200728163400.e00b09c594763349f99ce6cb@kernel.org
kernel/kprobes.c