Skip to contentSkip to conversation

arm: Omit fixmap calls in text patching code if CONFIG_MMU=n

PATCH In review Geert Uytterhoeven 2 participants 2 messages Oct 26, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: Omit fixmap calls in text patching code if CONFIG_MMU=n

If CONFIG_JUMP_LABEL=y and CONFIG_MMU=n:

    arch/arm/kernel/patch.c: In function 'patch_map':
    arch/arm/kernel/patch.c:39:129: error: 'L_PTE_YOUNG' undeclared (first use in this function)
      set_fixmap(fixmap, page_to_phys(page));
																     ^
    arch/arm/kernel/patch.c:39:129: note: each undeclared identifier is reported only once for each function it appears in
    arch/arm/kernel/patch.c:39:143: error: 'L_PTE_PRESENT' undeclared (first use in this function)
      set_fixmap(fixmap, page_to_phys(page));
																		   ^
    arch/arm/kernel/patch.c:39:159: error: 'L_PTE_XN' undeclared (first use in this function)
      set_fixmap(fixmap, page_to_phys(page));
																				   ^
    arch/arm/kernel/patch.c:39:170: error: 'L_PTE_DIRTY' undeclared (first use in this function)
      set_fixmap(fixmap, page_to_phys(page));
																					      ^
    arch/arm/kernel/patch.c:39:185: error: 'L_PTE_MT_WRITEBACK' undeclared (first use in this function)
      set_fixmap(fixmap, page_to_phys(page));
																							     ^

Protect the calls to set_fixmap() and clear_fixmap() by #ifdef CONFIG_MMU to fix this.

Fixes commit ab0615e2d6fb0747 ("arm: use fixmap for text patching when text is RO")

---
http://kisskb.ellerman.id.au/kisskb/buildresult/12531538/

 arch/arm/kernel/patch.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/patch.c +4 -0
index 69bda1a5707ee826..447b53a68be5bd6f 100644
@@ -36,7 +36,9 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
 	else
 		__acquire(&patch_lock);
 
+#ifdef CONFIG_MMU
 	set_fixmap(fixmap, page_to_phys(page));
+#endif
 
 	return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK));
 }
@@ -44,7 +46,9 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
 static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
 	__releases(&patch_lock)
 {
+#ifdef CONFIG_MMU
 	clear_fixmap(fixmap);
+#endif
 
 	if (flags)
 		spin_unlock_irqrestore(&patch_lock, *flags);
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Geert Uytterhoeven

Protect the calls to set_fixmap() and clear_fixmap() by #ifdef > CONFIG_MMU to fix this.

Fixes commit ab0615e2d6fb0747 ("arm: use fixmap for text patching when text is RO")

Since both DEBUG_SET_MODULE_RONX and DEBUG_RODATA depend on MMU, we'll never get to this code on !MMU so this ifdef build fix should be ok.

Thanks.