Thread (6 messages) flat view 6 messages, 2 authors, 2021-11-26
STALE1746d

[PATCH 2/3] powerpc/code-patching: warn on code patching failure

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2021-11-26 03:24:18
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

Callers are supposed to handle this, but it is possible that they
don't or they do but don't make much noise about it. A failure is
probably an indication of a bigger problem somewhere so it is good
to warn once about it.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/lib/code-patching.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 57e160963ab7..70247fc58b6e 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -161,6 +161,7 @@ static int do_patch_instruction(u32 *addr, struct ppc_inst instr)
 
 	text_poke_addr = (unsigned long)__this_cpu_read(text_poke_area)->addr;
 	if (map_patch_area(addr, text_poke_addr)) {
+		WARN_ON_ONCE(1);
 		err = -1;
 		goto out;
 	}
@@ -192,8 +193,10 @@ static bool skip_addr_verif = false;
 int patch_instruction(u32 *addr, struct ppc_inst instr)
 {
 	/* Make sure we aren't patching a freed init section */
-	if (!skip_addr_verif && !kernel_text_address((unsigned long)addr))
+	if (!skip_addr_verif && !kernel_text_address((unsigned long)addr)) {
+		WARN_ON_ONCE(1);
 		return 0;
+	}
 
 	return do_patch_instruction(addr, instr);
 }
-- 
2.23.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help