From: "Geoffrey Irving" <irving@naml.us>
To: "Junio C Hamano" <gitster@pobox.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] cherry: cache patch-ids to avoid repeating work
Date: Thu, 10 Jul 2008 07:09:14 -0700 [thread overview]
Message-ID: <7f9d599f0807100709u778f0ab1y28776d7efb831b61@mail.gmail.com> (raw)
In-Reply-To: <7f9d599f0807092034n438f0976pf44d4c9305871087@mail.gmail.com>
On Wed, Jul 9, 2008 at 8:34 PM, Geoffrey Irving <irving@naml.us> wrote:
> Add cached-sha-map.[ch] implementing a persistent hash map from sha1 to
> sha1. The map is read with mmap, and completely rewritten if any entries
> change. It would be good to add incremental update to handle the usual case
> where only a few entries change.
>
> This structure is used by patch-ids.c to cache the mapping from commit to
> patch-id into $GIT_DIR/patch-id-cache. In the one case I've tested so far,
> this speeds up the second invocation of git-cherry by two orders of
> magnitude. The caching can be disabled by setting cherry.cachepatchids to
> false.
>
> Original code cannibalized from Johannes Schindelin's notes-index structure.
>
> Signed-off-by: Geoffrey Irving <irving@naml.us>
> ---
>
> Note: there are at least two "holes" in this code. First, it is impossible
> to verify the validity of the entries (this is impossible to fix). Second,
> it is possible to write a malicious patch-id-cache file that causes git-cherry
> to go into an infinite loop. Fixing the loop requires either traversing every
> entry on load (bad) or adding a second loop termination condition to
> find_helper. Since looping forever is better than returning incorrect
> results, I figured fixing the weaker hole would just result in a false sense
> of security.
Oops: avoiding the infinite loop only requires reading expected O(1)
entries on load, so I can fix that if you like. It would only be all
of them if it actually did detect the infinite loop.
Geoffrey
next prev parent reply other threads:[~2008-07-10 14:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-09 3:53 [PATCH 1/3] cherry: cache patch-ids to avoid repeating work Geoffrey Irving
2008-07-09 5:14 ` Junio C Hamano
2008-07-09 5:26 ` Geoffrey Irving
2008-07-09 6:24 ` Junio C Hamano
2008-07-09 12:18 ` Johannes Schindelin
2008-07-10 3:34 ` [PATCH] " Geoffrey Irving
2008-07-10 14:09 ` Geoffrey Irving [this message]
2008-07-10 14:28 ` Johannes Schindelin
2008-07-10 14:33 ` Geoffrey Irving
2008-07-10 15:56 ` Johannes Schindelin
2008-07-11 6:54 ` Junio C Hamano
2008-07-11 14:58 ` Geoffrey Irving
2008-07-11 15:36 ` Johannes Schindelin
2008-07-11 15:41 ` Geoffrey Irving
2008-07-11 15:48 ` Johannes Schindelin
[not found] ` <7vej60jln6.fsf@gitster.siamese.dyndns.org>
2008-07-13 3:14 ` Geoffrey Irving
2008-07-15 16:57 ` Geoffrey Irving
2008-07-15 21:52 ` Johannes Schindelin
2008-07-15 22:14 ` Junio C Hamano
2008-07-16 6:57 ` Karl Hasselström
2008-07-16 7:22 ` Johan Herland
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=7f9d599f0807100709u778f0ab1y28776d7efb831b61@mail.gmail.com \
--to=irving@naml.us \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).