[illumos-Developer] webrev #953 amd64 mdb chews arguments to ::run?

Garrett D'Amore garrett at damore.org
Mon May 16 07:09:43 PDT 2011


This concern was the topic of an earlier discussion.  str* use 64-bit optimized instructions, and the results are bad when they overlap on 64-bit.  There was a big debate about this at one point (on the OpenSolaris developer list.)  Alex's changes to fix the calling are good. :-)

  -- Garrett D'Amore

On May 16, 2011, at 6:48 AM, Dan McDonald <danmcd at nexenta.com> wrote:

> On Mon, May 16, 2011 at 12:38:21PM +0400, Alexander Eremin wrote:
>> This fix  replaces strncpy/strcpy,  which in 64bit mode affected for
>> overlap, with memmove.
> 
> Odd that this would only manifest on 64-bit, but...
> 
>> webrev:  http://cr.opensolaris.org/~alhazred/i953/
> 
> ... this certainly addresses the fix in the short-term.
> 
> I just RTFM and noticed:
> 
>  strcpy(), strncpy(), strlcpy()
>     The strcpy() function copies string s2 to s1, including  the
>     terminating  null character, stopping after the null charac-
>     ter has been copied. The strncpy() function copies exactly n
>     bytes,  truncating  s2  or  adding  null characters to s1 if
>     necessary. The result will not  be  null-terminated  if  the
>     length  of  s2  is  n or more. Each function returns s1.  If
>     copying  takes  place  between  objects  that  overlap,  the
>     behavior of strcpy(), strncpy(), and strlcpy() is undefined.
> 
> Which addresses my concerns about whether or not we should be looking at the
> str*() functions themselves.  Phew!
> 
> Ship it!
> 
> Thanks,
> Dan
> 
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer



More information about the Developer mailing list