Commit 9222f606 authored by Jiri Kosina's avatar Jiri Kosina Committed by Thomas Gleixner
Browse files

x86/alternatives: Lockdep-enforce text_mutex in text_poke*()

text_poke() and text_poke_bp() must be called with text_mutex held.

Put proper lockdep anotation in place instead of just mentioning the
requirement in a comment.

Reported-by: default avatarPeter Zijlstra <>
Signed-off-by: default avatarJiri Kosina <>
Signed-off-by: default avatarThomas Gleixner <>
Acked-by: default avatarPeter Zijlstra (Intel) <>
Acked-by: default avatarMasami Hiramatsu <>
Cc: Andy Lutomirski <>
parent f12d11c5
......@@ -684,8 +684,6 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
* It means the size must be writable atomically and the address must be aligned
* in a way that permits an atomic write. It also makes sure we fit on a single
* page.
* Note: Must be called under text_mutex.
void *text_poke(void *addr, const void *opcode, size_t len)
......@@ -700,6 +698,8 @@ void *text_poke(void *addr, const void *opcode, size_t len)
if (!core_kernel_text((unsigned long)addr)) {
pages[0] = vmalloc_to_page(addr);
pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
......@@ -782,8 +782,6 @@ int poke_int3_handler(struct pt_regs *regs)
* - replace the first byte (int3) by the first byte of
* replacing opcode
* - sync cores
* Note: must be called under text_mutex.
void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler)
......@@ -792,6 +790,9 @@ void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler)
bp_int3_handler = handler;
bp_int3_addr = (u8 *)addr + sizeof(int3);
bp_patching_in_progress = true;
* Corresponding read barrier in int3 notifier for making sure the
* in_progress and handler are correctly ordered wrt. patching.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment