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

Re: [Xen-devel] [PATCH for-4.10] string: fix memmove when size is 0



Hi Roger,

On 10/18/2017 11:44 AM, Roger Pau Monné wrote:
On Tue, Oct 17, 2017 at 07:00:25AM -0600, Jan Beulich wrote:
On 17.10.17 at 14:52, <roger.pau@xxxxxxxxxx> wrote:
On Tue, Oct 17, 2017 at 01:41:35PM +0100, Andrew Cooper wrote:
There are many passed values which could trigger this warning.  Does

diff --git a/xen/arch/x86/string.c b/xen/arch/x86/string.c
index cd85a38..4f55856 100644
--- a/xen/arch/x86/string.c
+++ b/xen/arch/x86/string.c
@@ -47,7 +47,7 @@ void *(memmove)(void *dest, const void *src, size_t n)
          "   rep movsb   ; "
          "   cld           "
          : "=&c" (d0), "=&S" (d1), "=&D" (d2)
-        : "0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)dest)
+        : "0" (n), "1" ((uintptr_t)src + n - 1), "2" ((uintptr_t)dest + n - 1)
          : "memory");
return dest;

work any better?

That does indeed work, but I'm not sure if it would mask legitimate
pointer overflows by casting them into integers.

It certainly would, as the tool can't possibly know that the asm()
itself then effectively casts the integers back to pointers (i.e. it
has no basis to try to "look through" the cast and continue analysis).

I assume there are no further steps for me, just wait for Julien's
release Ack.

Release-acked-by: Julien Grall <julien.grall@xxxxxxxxxx>

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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