qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH 2/3] int128.h: Avoid undefined be


From: Avi Kivity
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 2/3] int128.h: Avoid undefined behaviours involving signed arithmetic
Date: Mon, 07 Apr 2014 18:22:38 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/07/2014 06:17 PM, Peter Maydell wrote:
On 7 April 2014 15:56, Avi Kivity <address@hidden> wrote:
On 04/06/2014 01:18 PM, Peter Maydell wrote:
The alternative would be to say that Int128 should have
undefined behaviour on underflow/overflow and the test
code is wrong, but that doesn't seem very useful to me.
Isn't the test broken here?  It is trying to add (or shift) -2^127 and
something else, and the result truly overflows.
Well, the test code is assuming "semantics as per 2s
complement arithmetic" and checking various corner cases.
As I say, we could define that this is invalid and
rewrite the test cases.

It is invalid. The test thinks that -2^127 * 2 == 0, but if a guest could trigger it, it would probably be a security issue.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]