From: "Jan Beulich" Subject: Re: x86 string/memory inline functions Date: Wed, 24 May 2006 13:48:16 +0200 Message-ID: <44746420.76E4.0078.0@novell.com> References: <44743B9A.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part00253D10.1__=" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part00253D10.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline >> 2) Why were the memory clobbers removed without at least replacing >> them with appropriate input constraints? > >Maybe I was having a bad day. :-) In case you still want to leave them in - here's a patch to add the missing constraints. Jan --=__Part00253D10.1__= Content-Type: text/plain; name="xen-x86-string-constraints.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-x86-string-constraints.patch" --- 2006-05-16/xen/include/asm-x86/string.h.0 2006-04-06 17:50:27.000000000 +0200 +++ 2006-05-16/xen/include/asm-x86/string.h 2006-05-24 11:12:15.000000000 +0200 @@ -90,7 +90,7 @@ static inline int strcmp(const char *cs, " or $1,%%al \n" "3: \n" : "=a" (__res), "=&S" (d0), "=&D" (d1) - : "1" (cs), "2" (ct) ); + : "1" (cs), "2" (ct), "m" (*cs), "m" (*ct) ); return __res; } @@ -113,7 +113,7 @@ static inline int strncmp(const char *cs " or $1,%%al \n" "4: \n" : "=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) - : "1" (cs), "2" (ct), "3" (count) ); + : "1" (cs), "2" (ct), "3" (count), "m" (*cs), "m" (*ct) ); return __res; } @@ -132,7 +132,8 @@ static inline char *strchr(const char *s " mov $1,%1 \n" "2: mov %1,%0 \n" " dec %0 \n" - : "=a" (__res), "=&S" (d0) : "1" (s), "0" (c) ); + : "=a" (__res), "=&S" (d0) + : "1" (s), "0" (c), "m" (*s) ); return __res; } @@ -145,7 +146,8 @@ static inline size_t strlen(const char * " repne ; scasb \n" " notl %0 \n" " decl %0 \n" - : "=c" (__res), "=&D" (d0) : "1" (s), "a" (0), "0" (0xffffffffUL) ); + : "=c" (__res), "=&D" (d0) + : "1" (s), "a" (0), "0" (0xffffffffUL), "m" (*s) ); return __res; } @@ -270,7 +272,8 @@ static inline void *memchr(const void *c " je 1f \n" " mov $1,%0 \n" "1: dec %0 \n" - : "=D" (__res), "=&c" (d0) : "a" (c), "0" (cs), "1" (count) ); + : "=D" (__res), "=&c" (d0) + : "a" (c), "0" (cs), "1" (count), "m" (*(const unsigned char *)cs) ); return __res; } --=__Part00253D10.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part00253D10.1__=--