x86/static_call: Serialize __static_call_fixup() properly
authorThomas Gleixner <tglx@linutronix.de>
Tue, 12 Jul 2022 12:01:06 +0000 (14:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jul 2022 10:54:11 +0000 (12:54 +0200)
commit86ccf19a91beed4c1d1a2c9dc9c7af1f991a7fea
tree06fc002b8e3a391802f3d5b916e605e3c28317be
parent73ad137d1146eabd8c82496a47477006dce3b91d
x86/static_call: Serialize __static_call_fixup() properly

commit c27c753ea6fd1237f4f96abf8b623d7bab505513 upstream.

__static_call_fixup() invokes __static_call_transform() without holding
text_mutex, which causes lockdep to complain in text_poke_bp().

Adding the proper locking cures that, but as this is either used during
early boot or during module finalizing, it's not required to use
text_poke_bp(). Add an argument to __static_call_transform() which tells
it to use text_poke_early() for it.

Fixes: ee88d363d156 ("x86,static_call: Use alternative RET encoding")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/static_call.c