All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parisc: Fix code/instruction patching on PA1.x machines
@ 2021-10-31 21:14 Helge Deller
  2021-11-03 20:12 ` John David Anglin
  0 siblings, 1 reply; 11+ messages in thread
From: Helge Deller @ 2021-10-31 21:14 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin; +Cc: Sven Schnelle

On PA1.x machines it's not sufficient to just flush the data and
instruction caches when we have written new instruction codes into the
parallel mapped memory segment, but we really need to invalidate (purge)
the cache too. Otherwise the processor will still execute the old
instructions which are still in the data/instruction cache.

Signed-off-by: Helge Deller <deller@gmx.de>
Fixes: 4e87ace902cf ("parisc: add support for patching multiple words")
Cc: stable@vger.kernel.org # v5.3+

diff --git a/arch/parisc/kernel/patch.c b/arch/parisc/kernel/patch.c
index 80a0ab372802..8cbb7e1d5a2b 100644
--- a/arch/parisc/kernel/patch.c
+++ b/arch/parisc/kernel/patch.c
@@ -81,7 +81,7 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len)
 			 * We're crossing a page boundary, so
 			 * need to remap
 			 */
-			flush_kernel_vmap_range((void *)fixmap,
+			invalidate_kernel_vmap_range((void *)fixmap,
 						(p-fixmap) * sizeof(*p));
 			if (mapped)
 				patch_unmap(FIX_TEXT_POKE0, &flags);
@@ -90,9 +90,10 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len)
 		}
 	}

-	flush_kernel_vmap_range((void *)fixmap, (p-fixmap) * sizeof(*p));
+	invalidate_kernel_vmap_range((void *)fixmap, (p-fixmap) * sizeof(*p));
 	if (mapped)
 		patch_unmap(FIX_TEXT_POKE0, &flags);
+	invalidate_kernel_vmap_range((void *)start, end - start);
 	flush_icache_range(start, end);
 }


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-06 20:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-31 21:14 [PATCH] parisc: Fix code/instruction patching on PA1.x machines Helge Deller
2021-11-03 20:12 ` John David Anglin
2021-11-03 21:08   ` Helge Deller
2021-11-04 17:57     ` John David Anglin
2021-11-04 18:06       ` John David Anglin
2021-11-04 20:48       ` Helge Deller
2021-11-04 21:16         ` John David Anglin
2021-11-04 21:27           ` Helge Deller
2021-11-04 21:35             ` John David Anglin
2021-11-04 21:19         ` John David Anglin
2021-11-06 20:42         ` Sven Schnelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.