Re: [PATCH v7 6/8] x86/module: prepare module loading for ROX allocations of text

Nathan Chancellor
2024-11-05T19:04:32Z

On Tue, Nov 05, 2024 at 09:02:26AM +0200, Mike Rapoport wrote:
> There's a silly mistake in cfi_rewrite_endbr() in that commit, the patch
> below should fix it. Can you please test?

Yup, that was it! All my machines boot with this diff applied on top of
next-20241105, so with that fixed, I think we are all good here.

Tested-by: Nathan Chancellor <nathan@kernel.org>

> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 3407efc26528..243843e44e89 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -1241,7 +1241,7 @@ static void cfi_rewrite_endbr(s32 *start, s32 *end, struct module *mod)
> void *addr = (void *)s + *s;
> void *wr_addr = module_writable_address(mod, addr);
>
> - poison_endbr(addr+16, wr_addr, false);
> + poison_endbr(addr + 16, wr_addr + 16, false);
> }
> }

Cheers,
Nathan