On 08.03.2022 16:23, Bjoern Doebel wrote:
> @@ -127,15 +161,21 @@ int arch_livepatch_verify_func(const struct 
> livepatch_func *func)
>  void noinline arch_livepatch_apply(struct livepatch_func *func)
>  {
>      uint8_t *old_ptr;
> -    uint8_t insn[sizeof(func->opaque)];
> +    struct x86_livepatch_meta *lp;
> +    uint8_t insn[sizeof(lp->instruction)];
>      unsigned int len;
>  
> +    lp = (struct x86_livepatch_meta *)func->opaque;
> +    lp->patch_offset = 0;
>      old_ptr = func->old_addr;
>      len = livepatch_insn_len(func);
>      if ( !len )
>          return;
>  
> -    memcpy(func->opaque, old_ptr, len);
> +    if ( is_endbr64(old_ptr) )
> +        lp->patch_offset += ENDBR64_LEN;

Don't you need to use was_endbr64() here as well?

Jan


Reply via email to