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

Re: [PATCH v2 6/8] x86: rename copy_{from,to}_user() to copy_{from,to}_guest_pv()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 23 Feb 2021 12:04:00 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=ResH4lssBS4NZCOdLD0/JgmxVqGf48AtG3FpQUPa89Y=; b=UqOnM5o70TZ/xgIZwTss+ohuGntJJEtICWoC+G6YCheb3QmzUeF9iIJQJeyOoj2cYHiBInTUuHIyw5/RZ/Vr/XRSxSZ80Av5/bRkR0bPMKMsUSLOkyP+wOMunikNnOXfEGWT1S1ctVatnyOGS4VG3KfP7m9m+PR1hVYzLotl57o+Hm6941BnyR0kA8NWpPM1qWDsycVU1z34EllLcj3q62YvLtXQIdax714cZVvzai3euvHC2HhVvwneD6XWJY37HQpY2V1wZPNNM3eewY+MV1FcEGPSg1RE1KEy9o1VRHqm9QZs0zjUtzjTMrKUfVPlrHMBvR3wXHpMlUVqcOkhQw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DR0ZWBCzPAPYtFigMEceYjnwRR5mXYMOMtA5DjDOqSGbw7XDqSGiOkPD/zj5S2SrZhzTS1H6Qxt/kUvE2QYj0OicL65diOKO5MJIQSCiyDe6vTCme5a50czImJQFC5NEp48WyarWLGDs6A0kk+fLbPeiqXKXlTam17FsJGcp251AvDpSkV6XIrjYTiXpAlgSwL2UreC5CBB0Q5/I2p+Yi+yzhhooIe28Pg737L8/XfjJMfP8VVCiojed3ctGV/jgrLDsigDEV/7qnzRXP+1KE2RLX76K8CnL8BpCHzxZLnM9MnvLNdxFguiQzVzWiS3eYeU33ODSbelr2MApm6fNCA==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Tue, 23 Feb 2021 11:04:18 +0000
  • Ironport-sdr: 9/if3uqo7pnGBFBsCsjltZqpF6kyA+WybhEyp8BACLOpVsPJZXt55ZrFEkLrYhkSV/D1A8YBWS kwxuU1RbE28s+ht0sIBoMG9XlXvH77MPgRB+ecGo1nOFJ48qvU/WIGsZqC1bpXpYWlvLVeVsbu b+Alk1EynbbSHlWp8hpQvgtnuYqstrOhCl/IJoZde2vCO1C6QI754V9t7VFNQQwLOirLHxmwnF eWvFI62XukDmHDXpzbeRar6a3uiWb5MkjMHfdnUQofokRDkerg106mbSkHXa55ZsGZjNxXVk+j edA=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Feb 17, 2021 at 09:22:32AM +0100, Jan Beulich wrote:
> Bring them (back) in line with __copy_{from,to}_guest_pv(). Since it
> falls in the same group, also convert clear_user(). Instead of adjusting
> __raw_clear_guest(), drop it - it's unused and would require a non-
> checking __clear_guest_pv() which we don't have.
> 
> Add previously missing __user at some call sites and in the function
> declarations.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> 
> --- a/xen/arch/x86/pv/emul-inv-op.c
> +++ b/xen/arch/x86/pv/emul-inv-op.c
> @@ -33,7 +33,7 @@ static int emulate_forced_invalid_op(str
>      eip = regs->rip;
>  
>      /* Check for forced emulation signature: ud2 ; .ascii "xen". */
> -    if ( (rc = copy_from_user(sig, (char *)eip, sizeof(sig))) != 0 )
> +    if ( (rc = copy_from_guest_pv(sig, (char __user *)eip, sizeof(sig))) != 
> 0 )
>      {
>          pv_inject_page_fault(0, eip + sizeof(sig) - rc);
>          return EXCRET_fault_fixed;
> @@ -43,7 +43,8 @@ static int emulate_forced_invalid_op(str
>      eip += sizeof(sig);
>  
>      /* We only emulate CPUID. */
> -    if ( ( rc = copy_from_user(instr, (char *)eip, sizeof(instr))) != 0 )
> +    if ( (rc = copy_from_guest_pv(instr, (char __user *)eip,
> +                                  sizeof(instr))) != 0 )
>      {
>          pv_inject_page_fault(0, eip + sizeof(instr) - rc);
>          return EXCRET_fault_fixed;
> --- a/xen/arch/x86/pv/iret.c
> +++ b/xen/arch/x86/pv/iret.c
> @@ -54,8 +54,8 @@ unsigned long do_iret(void)
>      struct iret_context iret_saved;
>      struct vcpu *v = current;
>  
> -    if ( unlikely(copy_from_user(&iret_saved, (void *)regs->rsp,
> -                                 sizeof(iret_saved))) )
> +    if ( unlikely(copy_from_guest_pv(&iret_saved, (void __user *)regs->rsp,
> +                                     sizeof(iret_saved))) )
>      {
>          gprintk(XENLOG_ERR,
>                  "Fault while reading IRET context from guest stack\n");
> --- a/xen/arch/x86/pv/ro-page-fault.c
> +++ b/xen/arch/x86/pv/ro-page-fault.c
> @@ -90,7 +90,8 @@ static int ptwr_emulated_update(unsigned
>  
>          /* Align address; read full word. */
>          addr &= ~(sizeof(full) - 1);
> -        if ( (rc = copy_from_user(&full, (void *)addr, sizeof(full))) != 0 )
> +        if ( (rc = copy_from_guest_pv(&full, (void __user *)addr,
> +                                      sizeof(full))) != 0 )
>          {
>              x86_emul_pagefault(0, /* Read fault. */
>                                 addr + sizeof(full) - rc,
> --- a/xen/arch/x86/usercopy.c
> +++ b/xen/arch/x86/usercopy.c
> @@ -109,19 +109,17 @@ unsigned int copy_from_guest_ll(void *to
>  #if GUARD(1) + 0
>  
>  /**
> - * copy_to_user: - Copy a block of data into user space.
> - * @to:   Destination address, in user space.
> - * @from: Source address, in kernel space.
> + * copy_to_guest_pv: - Copy a block of data into guest space.

I would expand to 'PV guest' here and below, FAOD.

Thanks, Roger.



 


Rackspace

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