aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/alternative.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 014f214da581..b9d5e7c9ef43 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -684,8 +684,6 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
684 * It means the size must be writable atomically and the address must be aligned 684 * It means the size must be writable atomically and the address must be aligned
685 * in a way that permits an atomic write. It also makes sure we fit on a single 685 * in a way that permits an atomic write. It also makes sure we fit on a single
686 * page. 686 * page.
687 *
688 * Note: Must be called under text_mutex.
689 */ 687 */
690void *text_poke(void *addr, const void *opcode, size_t len) 688void *text_poke(void *addr, const void *opcode, size_t len)
691{ 689{
@@ -700,6 +698,8 @@ void *text_poke(void *addr, const void *opcode, size_t len)
700 */ 698 */
701 BUG_ON(!after_bootmem); 699 BUG_ON(!after_bootmem);
702 700
701 lockdep_assert_held(&text_mutex);
702
703 if (!core_kernel_text((unsigned long)addr)) { 703 if (!core_kernel_text((unsigned long)addr)) {
704 pages[0] = vmalloc_to_page(addr); 704 pages[0] = vmalloc_to_page(addr);
705 pages[1] = vmalloc_to_page(addr + PAGE_SIZE); 705 pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
@@ -782,8 +782,6 @@ int poke_int3_handler(struct pt_regs *regs)
782 * - replace the first byte (int3) by the first byte of 782 * - replace the first byte (int3) by the first byte of
783 * replacing opcode 783 * replacing opcode
784 * - sync cores 784 * - sync cores
785 *
786 * Note: must be called under text_mutex.
787 */ 785 */
788void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler) 786void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler)
789{ 787{
@@ -792,6 +790,9 @@ void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler)
792 bp_int3_handler = handler; 790 bp_int3_handler = handler;
793 bp_int3_addr = (u8 *)addr + sizeof(int3); 791 bp_int3_addr = (u8 *)addr + sizeof(int3);
794 bp_patching_in_progress = true; 792 bp_patching_in_progress = true;
793
794 lockdep_assert_held(&text_mutex);
795
795 /* 796 /*
796 * Corresponding read barrier in int3 notifier for making sure the 797 * Corresponding read barrier in int3 notifier for making sure the
797 * in_progress and handler are correctly ordered wrt. patching. 798 * in_progress and handler are correctly ordered wrt. patching.