Thread (6 messages) 6 messages, 4 authors, 2023-02-16

Re: Bug: Write fault blocked by KUAP! (kernel 6.2-rc6, Talos II)

From: Erhard F. <hidden>
Date: 2023-02-16 15:21:39

On Thu, 9 Feb 2023 07:21:55 +0000
Christophe Leroy [off-list ref] wrote:
quoted hunk ↗ jump to hunk
An easy fix would probably be to also check the suffix as a prefixed 
instruction with 0 as suffix is not valid :
diff --git a/arch/powerpc/include/asm/inst.h 
b/arch/powerpc/include/asm/inst.h
index 684d3f453282..87084a52598b 100644
--- a/arch/powerpc/include/asm/inst.h
+++ b/arch/powerpc/include/asm/inst.h
@@ -86,7 +86,7 @@ static inline ppc_inst_t ppc_inst_read(const u32 *ptr)

  static inline bool ppc_inst_prefixed(ppc_inst_t x)
  {
-	return IS_ENABLED(CONFIG_PPC64) && ppc_inst_primary_opcode(x) == 
OP_PREFIX;
+	return IS_ENABLED(CONFIG_PPC64) && ppc_inst_primary_opcode(x) == 
OP_PREFIX && ppc_inst_suffix(x);
  }

  static inline ppc_inst_t ppc_inst_swab(ppc_inst_t x)
Your patch works fine for me! Applied on top of v6.2-rc7 and in the resulting kernel the Write fault is gone. Thanks!

Regards,
Erhard
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help