|
From: <br...@gi...> - 2006-01-19 04:44:56
|
I've seen a few references in the archives to the ultra-optimized glibc strlen function (and various other functions that use the same optimization). This must be quite familiar to all Valgrind users -- I myself am getting tired of dealing with it. But as a reminder: Some functions read a byte-granularity block of memory one word at a time, for speed. That means they tend to overrun the block of memory by a few bytes at the end, and Valgrind/Memcheck screams. My personal strategy is to look at every "Invalid read of size 4" and if it just runs off the end of an odd-sized block, I write a suppression for it. I don't try to determine if there's a real problem; I just presume there isn't. So why can't Valgrind do that for me? I assume it can't or it would have been mentioned in this context. But I'd love to be able to tell Valgrind to ignore invalid reads of size one word that happen in the last word of a block. -- Bryan Henderson Phone 408-621-2000 San Jose, California |
|
From: Paul P. <ppl...@gm...> - 2006-01-19 05:01:46
|
On 19 Jan 2006 04:29:04 +0000, Bryan Henderson <br...@gi...> wr= ote: > My personal strategy is to look at every "Invalid read of size 4" and if > it just runs off the end of an odd-sized block, I write a suppression for > it. I don't try to determine if there's a real problem; I just presume > there isn't. If the bad read comes from libc, your strategy is possibly ok, though you may miss bugs where you pass a "too small" buffer into libc. If it comes from your own code, it is almost certainly a bug in your code (unless you also perform "ultra-optimizations", and you should fix it instead of suppressing. > So why can't Valgrind do that for me? Why not run with --tool=3Dnone ? That way you wouldn't get any reports at all. Cheers, |
|
From: Julian S. <js...@ac...> - 2006-01-19 07:49:32
|
> So why can't Valgrind do that for me? I assume it can't or it would > have been mentioned in this context. But I'd love to be able to tell > Valgrind to ignore invalid reads of size one word that happen in the > last word of a block. It can. You need --partial-loads-ok=yes and you need to use 3.1.0. Note that my (possibly unconstructive) view is that programs which behave like that are basically broken. Yeh, I know it's safe wrt not taking any extra page faults, and it's hardwired into glibc and so essentially unavoidable, but still it's not ANSI/ISO compliant. J |
|
From: <br...@gi...> - 2006-01-19 17:40:27
|
>> My personal strategy is to look at every "Invalid read of size 4" and if >> it just runs off the end of an odd-sized block, I write a suppression for >> it. I don't try to determine if there's a real problem; I just presume >> there isn't. > >If the bad read comes from libc, your strategy is possibly ok, >though you may miss bugs where you pass a "too small" buffer >into libc. > >If it comes from your own code, it is almost certainly a bug in your >code (unless you also perform "ultra-optimizations", and you should fix it >instead of suppressing. I'd say it's most likely correct in any code. Code that does a full word read like this is _probably_ doing the ultra-optimization. Empirically, every single one I've seen (about 6) is in this category. Also, every single one was in code I can't practically change. >> So why can't Valgrind do that for me? > >Why not run with --tool=none ? >That way you wouldn't get any reports at all. Because while both these methods have zero false positives and therefore eliminate the time it takes me to analyze them, my proposal catches lots more real bugs than yours does, as does my manual version of it. -- Bryan Henderson Phone 408-621-2000 San Jose, California |
|
From: Dennis L. <pla...@tz...> - 2006-01-19 21:32:20
|
Am Donnerstag, den 19.01.2006, 17:21 +0000 schrieb Bryan Henderson: > Because while both these methods have zero false positives and > therefore eliminate the time it takes me to analyze them, my proposal > catches lots more real bugs than yours does, as does my manual version > of it. Yeah, all the reports of V about all those things is annoying. The Program runs, and who cares about ISO standard compliant program behaviour if it just runs? V should really only report those things are definetly causing segfaults, thats what it was made for! greeds Dennis |