hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/arm/kernel/patch.c
....@@ -16,10 +16,10 @@
1616 unsigned int insn;
1717 };
1818
19
+#ifdef CONFIG_MMU
1920 static DEFINE_RAW_SPINLOCK(patch_lock);
2021
2122 static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
22
- __acquires(&patch_lock)
2323 {
2424 unsigned int uintaddr = (uintptr_t) addr;
2525 bool module = !core_kernel_text(uintaddr);
....@@ -34,8 +34,6 @@
3434
3535 if (flags)
3636 raw_spin_lock_irqsave(&patch_lock, *flags);
37
- else
38
- __acquire(&patch_lock);
3937
4038 set_fixmap(fixmap, page_to_phys(page));
4139
....@@ -43,15 +41,19 @@
4341 }
4442
4543 static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
46
- __releases(&patch_lock)
4744 {
4845 clear_fixmap(fixmap);
4946
5047 if (flags)
5148 raw_spin_unlock_irqrestore(&patch_lock, *flags);
52
- else
53
- __release(&patch_lock);
5449 }
50
+#else
51
+static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
52
+{
53
+ return addr;
54
+}
55
+static void __kprobes patch_unmap(int fixmap, unsigned long *flags) { }
56
+#endif
5557
5658 void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap)
5759 {
....@@ -64,8 +66,6 @@
6466
6567 if (remap)
6668 waddr = patch_map(addr, FIX_TEXT_POKE0, &flags);
67
- else
68
- __acquire(&patch_lock);
6969
7070 if (thumb2 && __opcode_is_thumb16(insn)) {
7171 *(u16 *)waddr = __opcode_to_mem_thumb16(insn);
....@@ -102,8 +102,7 @@
102102 if (waddr != addr) {
103103 flush_kernel_vmap_range(waddr, twopage ? size / 2 : size);
104104 patch_unmap(FIX_TEXT_POKE0, &flags);
105
- } else
106
- __release(&patch_lock);
105
+ }
107106
108107 flush_icache_range((uintptr_t)(addr),
109108 (uintptr_t)(addr) + size);