Emit backtrace if memcpy is misused?

John McCabe-Dansted gmatht at gmail.com
Fri Nov 12 03:06:02 UTC 2010


Apparently there is a change coming in glibc which can trigger silent data
corruption bugs in existing software that misuses memcpy with overlapping
regions.
   http://lwn.net/Articles/414467/#Comments

Perhaps alpha versions of Natty or Natty+1 should test for this (using
LD_PRELOAD or a modified glibc), and emit a backtrace to apport when memcpy
is called with overlapping regions?

This would reduce performance somewhat, but alpha versions are for finding
bugs, not running fast. Even though testing for overlapping regions could
take a large part of the time taken by small memcpy's, apparently less than
1% of time is typically in memcpy, so this shouldn't have a significant
effect on system-wide performance.

Valgrind also emits this warning, but it seems important that this gets
widespread testing, and even in alpha versions running everything under
Valgrind by default is not acceptable.

-- 
John C. McCabe-Dansted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20101112/062634bd/attachment.html>


More information about the Ubuntu-devel-discuss mailing list