# Re: \[PATCH v2 6/9\] arm64: cfi: Use CONFIG\_ARM64\_FUNCTION\_PREFIX\_NOPS for the type hash offset

- From: Alexei Starovoitov \<hidden\>
- Date: 2026-09-24 23:40:04 
- List: live-patching
- Page: https://ratatoskr.run/live-patching/2026/09/17639736
- Thread: https://ratatoskr.run/live-patching/2026/09/17639554/t.md

```text
On Thu, Sep 24, 2026 at 10:35 PM Jose Fernandez (Anthropic) [ref] wrote:
>  static inline void emit_kcfi(u32 hash, struct jit_ctx *ctx)
>  {
> -	if (IS_ENABLED(CONFIG_CFI))
> -		emit_u32_data(hash, ctx);
> +	if (!IS_ENABLED(CONFIG_CFI))
> +		return;
> +
> +	emit_u32_data(hash, ctx);
> +	for (int i = 0; i < CONFIG_ARM64_FUNCTION_PREFIX_NOPS; i++)
> +		emit(A64_NOP, ctx);
>  }

For the series:
Acked-by: Alexei Starovoitov <ast@kernel.org>

unrelated minor issue:
ctx.offset[] is counted from ro_image, but bpf_prog_fill_jited_linfo()
adds it to prog->bpf_func which is ro_image + cfi_get_offset().
So with CFI jited_line_info is already off by one insn.
After this patch it will be off by 4 or 6.
s390 does
	jit.addrs[i] -= cfi_get_offset();
before the call.
Would be great to send a follow up eventually.

```
