WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH] Xen: fix various checks of unsigned integers < 0

To: Tim Deegan <Tim.Deegan@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: RE: [Xen-devel] [PATCH] Xen: fix various checks of unsigned integers < 0
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: Fri, 29 Oct 2010 08:38:53 -0700 (PDT)
Cc:
Delivery-date: Fri, 29 Oct 2010 08:40:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101029140219.GD11016@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20101029140219.GD11016@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> diff -r 3cc0fac4a49e -r 52ce5ef855cf
> xen/arch/x86/x86_emulate/x86_emulate.c
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c  Fri Oct 29 14:57:50
> 2010 +0100
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c  Fri Oct 29 14:57:54
> 2010 +0100
> @@ -2102,7 +2102,7 @@ x86_emulate(
>              _regs.edx = (uint32_t)(((int32_t)_regs.eax < 0) ? -1 : 0);
>              break;
>          case 8:
> -            _regs.edx = (_regs.eax < 0) ? -1 : 0;
> +            _regs.edx = ((int64_t)_regs.eax < 0) ? -1 : 0;
>              break;
>          }
>          break;

(/me goes and looks up the cwd instruction...)

Wow, I wonder how many times this code has executed
and returned the wrong (incorrectly sign-extended) value?
Talk about a possible silent-but-deadly bug that would
be impossible to track down!

Nice catch!  Future Xen support people thank you!

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>