Skip to content

Commit 6c800d7

Browse files
committed
Revert "parisc: Fix patch code locking and flushing"
This reverts commit a9fe7fa. Leads to segfaults on 32bit kernel. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 7962c08 commit 6c800d7

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

arch/parisc/kernel/patch.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags,
4040

4141
*need_unmap = 1;
4242
set_fixmap(fixmap, page_to_phys(page));
43-
raw_spin_lock_irqsave(&patch_lock, *flags);
43+
if (flags)
44+
raw_spin_lock_irqsave(&patch_lock, *flags);
45+
else
46+
__acquire(&patch_lock);
4447

4548
return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK));
4649
}
@@ -49,7 +52,10 @@ static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
4952
{
5053
clear_fixmap(fixmap);
5154

52-
raw_spin_unlock_irqrestore(&patch_lock, *flags);
55+
if (flags)
56+
raw_spin_unlock_irqrestore(&patch_lock, *flags);
57+
else
58+
__release(&patch_lock);
5359
}
5460

5561
void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len)
@@ -61,9 +67,8 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len)
6167
int mapped;
6268

6369
/* Make sure we don't have any aliases in cache */
64-
flush_kernel_dcache_range_asm(start, end);
65-
flush_kernel_icache_range_asm(start, end);
66-
flush_tlb_kernel_range(start, end);
70+
flush_kernel_vmap_range(addr, len);
71+
flush_icache_range(start, end);
6772

6873
p = fixmap = patch_map(addr, FIX_TEXT_POKE0, &flags, &mapped);
6974

@@ -76,21 +81,19 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len)
7681
* We're crossing a page boundary, so
7782
* need to remap
7883
*/
79-
flush_kernel_dcache_range_asm((unsigned long)fixmap,
80-
(unsigned long)p);
81-
flush_tlb_kernel_range((unsigned long)fixmap,
82-
(unsigned long)p);
84+
flush_kernel_vmap_range((void *)fixmap,
85+
(p-fixmap) * sizeof(*p));
8386
if (mapped)
8487
patch_unmap(FIX_TEXT_POKE0, &flags);
8588
p = fixmap = patch_map(addr, FIX_TEXT_POKE0, &flags,
8689
&mapped);
8790
}
8891
}
8992

90-
flush_kernel_dcache_range_asm((unsigned long)fixmap, (unsigned long)p);
91-
flush_tlb_kernel_range((unsigned long)fixmap, (unsigned long)p);
93+
flush_kernel_vmap_range((void *)fixmap, (p-fixmap) * sizeof(*p));
9294
if (mapped)
9395
patch_unmap(FIX_TEXT_POKE0, &flags);
96+
flush_icache_range(start, end);
9497
}
9598

9699
void __kprobes __patch_text(void *addr, u32 insn)

0 commit comments

Comments
 (0)