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

Re: [PATCH] x86/mem_sharing: silence ubsan warning


  • To: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 4 Jan 2021 12:31:34 +0000
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 04 Jan 2021 12:31:51 +0000
  • Ironport-sdr: W/7/T8D/ViDAgJDn2cObo/NQykH8Gh5Y19ano2ocnYNjydAsIUgdfhzWR82uovqa5DX+Ym2huR o6kVRM5zvEOjOHOWwod5unIXwlIpB00rhmxSRwqareHQpKtU9SBy0PHF2zRMB5au5fjPDck6UD 0oyn2VPuWzvLryjm6dWw6anp2ARN264hzLjg0euYQStUT7gR4N937HdnNOnzGCWI+2zPMqCe+W rpHm/MjyJzWwh8P/lPNm9d90XUZcgosvuGHdcPxjHLV2/xa+LKgVvcCYVpHbCPMPdttIB+Mpkx MKc=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03/01/2021 18:47, Tamas K Lengyel wrote:
> Running Xen compiled with UBSAN produces a warning for mismatched size. It's
> benign but this patch silences the warning.
>
> Signed-off-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
> ---
>  xen/arch/x86/mm/mem_sharing.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
> index c428fd16ce..6920077dbf 100644
> --- a/xen/arch/x86/mm/mem_sharing.c
> +++ b/xen/arch/x86/mm/mem_sharing.c
> @@ -1638,7 +1638,10 @@ static int fork_hap_allocation(struct domain *cd, 
> struct domain *d)
>      rc = hap_set_allocation(cd, mb << (20 - PAGE_SHIFT), &preempted);
>      paging_unlock(cd);
>  
> -    return preempted ? -ERESTART : rc;
> +    if ( preempted )
> +        rc = -ERESTART;
> +
> +    return rc;

I can't repro this at all, even with some simplified examples.

-ERESTART is int (it is an enum constant in C files), as is rc, so I
can't spot a legitimate UBSAN complaint here.

Which compiler, and/or do you have the exact complaint available?

~Andrew



 


Rackspace

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