From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Mike McCormack <mike@codeweavers.com>
Subject: Re: [PATCH] Add git-imap-send.
Date: Thu, 9 Mar 2006 10:21:50 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603091017530.18022@g5.osdl.org> (raw)
In-Reply-To: <7vmzfz5w2k.fsf@assigned-by-dhcp.cox.net>
On Thu, 9 Mar 2006, Junio C Hamano wrote:
>
> Linus Torvalds <torvalds@osdl.org> writes:
>
> > it's entirely possible that it will load bytes from "string" _past_ the
> > end of the string because of an unrolled inner loop that does things
> > multiple bytes at a time. They won't be used in the eventual result, but
> > just the fact that they are loaded from memory can mean that your program
> > takes a SIGSEGV, for example, becaue it turns out "string" was just a
> > single NUL byte at the end of a page, and there's nothing after it.
>
> Funny. I've seen this exact bug in memcmp and strcmp in earlier
> SunOS (pre Solaris) libc when I was working on something like
> Valgrind in my previous life.
Well, Valgrind actually can complain for no good reason.
System libraries often take advantage of knowing how the CPU and the
system memory layout works. For example, just from knowing that pages are
always aligned to a certain (largish) boundary, you can know that it's
perfectly safe to do certain optimizations and prefetch past the end of an
object, as long as it's in the same page (and the easiest way to verify
that is to just do it when something is aligned).
So Valgrind will sometimes complain about perfectly bug-free code, just
because the bug-free code accesses outside the "strictly allowable"
region because it knows it can.
Valgrind can be taught about system libraries like that, but especially if
it's an early port to a new architecture or OS, valgrind will often
complain unnecessarily.
Linus
next prev parent reply other threads:[~2006-03-09 18:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 13:09 [PATCH] Add git-imap-send Mike McCormack
2006-03-09 10:35 ` Junio C Hamano
2006-03-09 11:30 ` Johannes Schindelin
2006-03-09 11:39 ` Andreas Ericsson
2006-03-09 11:44 ` Johannes Schindelin
2006-03-09 13:26 ` Mark Wooding
2006-03-09 13:47 ` Johannes Schindelin
2006-03-10 0:38 ` Mark Wooding
2006-03-09 16:41 ` Linus Torvalds
2006-03-09 18:09 ` Junio C Hamano
2006-03-09 18:21 ` Linus Torvalds [this message]
2006-03-09 18:49 ` Junio C Hamano
2006-03-10 4:58 ` Mike McCormack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0603091017530.18022@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=mike@codeweavers.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).