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

Erhard F. erhard_f at mailbox.org
Fri Feb 17 02:20:20 AEDT 2023


On Thu, 9 Feb 2023 07:21:55 +0000
Christophe Leroy <christophe.leroy at csgroup.eu> wrote:

> 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


More information about the Linuxppc-dev mailing list