.. | .. |
---|
16 | 16 | unsigned int insn; |
---|
17 | 17 | }; |
---|
18 | 18 | |
---|
| 19 | +#ifdef CONFIG_MMU |
---|
19 | 20 | static DEFINE_RAW_SPINLOCK(patch_lock); |
---|
20 | 21 | |
---|
21 | 22 | static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) |
---|
22 | | - __acquires(&patch_lock) |
---|
23 | 23 | { |
---|
24 | 24 | unsigned int uintaddr = (uintptr_t) addr; |
---|
25 | 25 | bool module = !core_kernel_text(uintaddr); |
---|
.. | .. |
---|
34 | 34 | |
---|
35 | 35 | if (flags) |
---|
36 | 36 | raw_spin_lock_irqsave(&patch_lock, *flags); |
---|
37 | | - else |
---|
38 | | - __acquire(&patch_lock); |
---|
39 | 37 | |
---|
40 | 38 | set_fixmap(fixmap, page_to_phys(page)); |
---|
41 | 39 | |
---|
.. | .. |
---|
43 | 41 | } |
---|
44 | 42 | |
---|
45 | 43 | static void __kprobes patch_unmap(int fixmap, unsigned long *flags) |
---|
46 | | - __releases(&patch_lock) |
---|
47 | 44 | { |
---|
48 | 45 | clear_fixmap(fixmap); |
---|
49 | 46 | |
---|
50 | 47 | if (flags) |
---|
51 | 48 | raw_spin_unlock_irqrestore(&patch_lock, *flags); |
---|
52 | | - else |
---|
53 | | - __release(&patch_lock); |
---|
54 | 49 | } |
---|
| 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 |
---|
55 | 57 | |
---|
56 | 58 | void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) |
---|
57 | 59 | { |
---|
.. | .. |
---|
64 | 66 | |
---|
65 | 67 | if (remap) |
---|
66 | 68 | waddr = patch_map(addr, FIX_TEXT_POKE0, &flags); |
---|
67 | | - else |
---|
68 | | - __acquire(&patch_lock); |
---|
69 | 69 | |
---|
70 | 70 | if (thumb2 && __opcode_is_thumb16(insn)) { |
---|
71 | 71 | *(u16 *)waddr = __opcode_to_mem_thumb16(insn); |
---|
.. | .. |
---|
102 | 102 | if (waddr != addr) { |
---|
103 | 103 | flush_kernel_vmap_range(waddr, twopage ? size / 2 : size); |
---|
104 | 104 | patch_unmap(FIX_TEXT_POKE0, &flags); |
---|
105 | | - } else |
---|
106 | | - __release(&patch_lock); |
---|
| 105 | + } |
---|
107 | 106 | |
---|
108 | 107 | flush_icache_range((uintptr_t)(addr), |
---|
109 | 108 | (uintptr_t)(addr) + size); |
---|