[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] xen/x86: Livepatch: support patching CET-enhanced functions


  • To: Bjoern Doebel <doebel@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Mar 2022 15:03:55 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2LhL91v+erslwG97KFfViS8SOcILS0gvy4/Lv/4rkzE=; b=ghc1+dZge3+Ga0z+k1OdD/qSfGerPAbbR0kOFcp27mDhTLf87Xd0fmq7Q1gVgnZgzqKHjVjCT91N+EhrNMeRgBF6cdz4TSxubN+NL2KP/la/MO+mRuNeathd1dPaVg0bGHiGMmMk7ckAPETAsaLaDznVNW14pP4gf+4fMMmgRkfTmrAVEGYlATKSxd8+4PBlM98Op4ptqKO9L5hQXHsrYylkI4vp2di1Q7/eTWjuGqhi6DRB/sHad9YkQvGmwZwjY4A/30WfZDkuyBRbrbBdp3knT5NEhFeU51PMoDaUuj+DZc6c/ACsqlkgmZzu9WnbFXVmDe8w3H+k6+ZGz/QSPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hvx/tVx/NcM2ps2eUcbNOIuGZpKA7yD0nsoIsP15dMlvn2IOMQtiLa9I+rQjXxu0XRU6B7Fp2r2CIRyXarEEdbSONdC/BS1tNpIMXN41Gd9on5OO1V0Mn1qg+KIoxMOJooLTp5+3O7brfW7rJqVlq3XupZ+Tv5BsG1r87y2naezNbH1roaDjjteUsQxfBgRskyYUkB3ILVl7BByjih/1Rq7tzEjvFC1hRgQOlDKUrRgk5+bXdZdQqwuwAB7UJ2HcZJm7loyW5Ju+39B/uEbf3SqO1cDVWDjteUiE+NDMLAurUBzypo+PU1TlrWsgbx7wx/R1IJt0lehregSPMDEw4A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Michael Kurth <mku@xxxxxxxxx>, Martin Pohlack <mpohlack@xxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 07 Mar 2022 14:04:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.03.2022 12:53, Bjoern Doebel wrote:
> @@ -104,18 +122,36 @@ void noinline arch_livepatch_revive(void)
>  
>  int arch_livepatch_verify_func(const struct livepatch_func *func)
>  {
> +    BUILD_BUG_ON(sizeof(struct x86_livepatch_meta) != LIVEPATCH_OPAQUE_SIZE);
> +
>      /* If NOPing.. */
>      if ( !func->new_addr )
>      {
> +        struct x86_livepatch_meta *lp;
> +
> +        lp = (struct x86_livepatch_meta *)func->opaque;
>          /* Only do up to maximum amount we can put in the ->opaque. */
> -        if ( func->new_size > sizeof(func->opaque) )
> +        if ( func->new_size > sizeof(lp->instruction) )
>              return -EOPNOTSUPP;
>  
>          if ( func->old_size < func->new_size )
>              return -EINVAL;
>      }

I continue to be concerned of the new local variable causing compiler
warnings. With the adjustment made compared to v1, the specific
warning would have changed, and we're now liable to see set-but-never-
used ones.

Taking of versions - please tag your patches accordingly, and please
have, in each patch, a short summary of what has changed from the last
version.

> @@ -159,7 +202,11 @@ void noinline arch_livepatch_apply(struct livepatch_func 
> *func)
>   */
>  void noinline arch_livepatch_revert(const struct livepatch_func *func)
>  {
> -    memcpy(func->old_addr, func->opaque, livepatch_insn_len(func));
> +    struct x86_livepatch_meta *lp;

As before - const please (wherever possible).

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.