git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Ingo Molnar <mingo@elte.hu>
Cc: Junio C Hamano <gitster@pobox.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Git Mailing List <git@vger.kernel.org>,
	Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: Something weird is happening...
Date: Thu, 29 Jan 2009 23:20:01 +0100	[thread overview]
Message-ID: <49822B91.6070303@lsrfire.ath.cx> (raw)
In-Reply-To: <20090129120539.GA26975@elte.hu>

Ingo Molnar schrieb:
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
>> a simple 'git fsck' still reports a ton of dangling and missing objects. 
>> (see it below)
>>
>> amongst them is the object above:
>>
>>   missing blob af0e01d4c663a101f48614e40d006ed6272d5c36
>>
>> but this does not seem to cause problems with git version 1.6.0.6 that 
>> i'm using now.
> 
> hm - maybe it's unrelated, but yesterday, a few hours before the incident 
> i did a higher-order Octopus merge with 1.6.1, that segfaulted.
> 
> I didnt think much of it - git often crashes with our crazy -tip tree when 
> i get above the magic 20 branches limit. The crash left a .git/index.lock 
> file around which i removed - and then forgot about the incident. I wanted 
> to report those crashes before but procrastinated it.
> 
> I used git/maint snapshots because new versions of Git are much better at 
> doing Octopus merges.
> 
> I've written a reproducer for git-1.6.1.1-1.fc11.i386. See the crash log 
> below.
> 
> To reproduce, pick up the -tip tree as a remote:
> 
>    http://people.redhat.com/mingo/tip.git/README
> 
> (you can run the README file as a script)
> 
> Then do this:
> 
>    git checkout -b tmp.crash v2.6.29-rc3
> 
>    git merge  tip/x86/asm        tip/x86/cleanups     tip/x86/cpudetect    \
>               tip/x86/debug      tip/x86/doc          tip/x86/header-fixes \
>               tip/x86/mm         tip/x86/paravirt     tip/x86/pat          \
>               tip/x86/setup-v2   tip/x86/subarch      tip/x86/uaccess      \
>               tip/x86/urgent     tip/core/percpu
> 
> and you should see the segfault.
> 
> interestingly i did not reproduce with the sha1's hardcoded:
> 
>   git checkout -b tmp.crash 18e352e4a73465349711a9324767e1b2453383e2
> 
>  git merge 2d4d57db692ea790e185656516e6ebe8791f1788 a448720ca3248e8a7a426336885549d6e923fd8e b38b0665905538e76e26f2a4c686179abb1f69f6 d5e397cb49b53381e4c99a064ca733c665646de8 e56d0cfe7790fd3218ae4f6aae1335547fea8763 dbca1df48e89d8aa59254fdc10ef16c16e73d94e fb746d0e1365b7472ccc4c3d5b0672b34a092d0b 6522869c34664dd5f05a0a327e93915b1281c90d d639bab8da86d330493487e8c0fea8ca31f53427 042cbaf88ab48e11afb725541e3c2cbf5b483680 5662a2f8e7313f78d6b17ab383f3e4f04971c335 3b4b75700a245d0d48fc52a4d2f67d3155812aba bf3647c44bc76c43c4b2ebb4c37a559e899ac70e 4369f1fb7cd4cf777312f43e1cb9aa5504fc4125
> 
> 	Ingo
> 
> -------------------->
> earth4:~/tip> git merge x86/asm x86/cleanups x86/cpudetect x86/debug 
> x86/doc x86/header-fixes x86/mm x86/paravirt x86/pat x86/setup-v2 
> x86/subarch x86/uaccess x86/urgent core/percpu
> Trying simple merge with 2d4d57db692ea790e185656516e6ebe8791f1788
> Trying simple merge with a448720ca3248e8a7a426336885549d6e923fd8e
> Simple merge did not work, trying automatic merge.
> Auto-merging arch/x86/include/asm/io.h
> Auto-merging arch/x86/include/asm/spinlock.h
> Auto-merging arch/x86/kernel/mpparse.c
> Auto-merging arch/x86/kernel/setup_percpu.c
> Auto-merging arch/x86/mm/init_32.c
> Trying simple merge with b38b0665905538e76e26f2a4c686179abb1f69f6
> Simple merge did not work, trying automatic merge.
> Auto-merging arch/x86/kernel/cpu/common.c
> Auto-merging arch/x86/kernel/cpu/intel.c
> Auto-merging arch/x86/mm/pat.c
> Trying simple merge with d5e397cb49b53381e4c99a064ca733c665646de8
> Trying simple merge with e56d0cfe7790fd3218ae4f6aae1335547fea8763
> Trying simple merge with dbca1df48e89d8aa59254fdc10ef16c16e73d94e
> Trying simple merge with fb746d0e1365b7472ccc4c3d5b0672b34a092d0b
> Trying simple merge with 6522869c34664dd5f05a0a327e93915b1281c90d
> Simple merge did not work, trying automatic merge.
> Auto-merging arch/x86/include/asm/paravirt.h
> Trying simple merge with d639bab8da86d330493487e8c0fea8ca31f53427
> Simple merge did not work, trying automatic merge.
> Auto-merging arch/x86/include/asm/io.h
> Auto-merging arch/x86/mm/ioremap.c
> Trying simple merge with 042cbaf88ab48e11afb725541e3c2cbf5b483680
> Trying simple merge with 5662a2f8e7313f78d6b17ab383f3e4f04971c335
> Trying simple merge with 3b4b75700a245d0d48fc52a4d2f67d3155812aba
> Simple merge did not work, trying automatic merge.
> Auto-merging arch/x86/kernel/signal.c
> Trying simple merge with bf3647c44bc76c43c4b2ebb4c37a559e899ac70e
> Simple merge did not work, trying automatic merge.
> Auto-merging arch/x86/kernel/cpu/intel.c
> Trying simple merge with 4369f1fb7cd4cf777312f43e1cb9aa5504fc4125
> /usr/libexec/git-core/git-merge-octopus: line 52: 26758 Segmentation fault      
> git read-tree -u -m --aggressive $common $MRT $SHA1
> Merge with strategy octopus failed.
> earth4:~/tip> 

Current master (a34a9dbbc) with the following patch should not
segfault anymore (it doesn't here), but I don't know where the
magic number six is coming from. :-/

diff --git a/unpack-trees.c b/unpack-trees.c
index 16bc2ca..4b02fbf 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -8,6 +8,8 @@
 #include "progress.h"
 #include "refs.h"
 
+#define STAGES (5 + 1)
+
 /*
  * Error messages expected by scripts out of plumbing commands such as
  * read-tree.  Non-scripted Porcelain is not required to use these messages
@@ -143,7 +145,7 @@ static inline int call_unpack_fn(struct cache_entry **src, struct unpack_trees_o
 
 static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o)
 {
-	struct cache_entry *src[5] = { ce, };
+	struct cache_entry *src[STAGES] = { ce, };
 
 	o->pos++;
 	if (ce_stage(ce)) {
@@ -240,7 +242,7 @@ static struct cache_entry *create_ce_entry(const struct traverse_info *info, con
 	return ce;
 }
 
-static int unpack_nondirectories(int n, unsigned long mask, unsigned long dirmask, struct cache_entry *src[5],
+static int unpack_nondirectories(int n, unsigned long mask, unsigned long dirmask, struct cache_entry *src[STAGES],
 	const struct name_entry *names, const struct traverse_info *info)
 {
 	int i;
@@ -291,7 +293,7 @@ static int unpack_nondirectories(int n, unsigned long mask, unsigned long dirmas
 
 static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info)
 {
-	struct cache_entry *src[5] = { NULL, };
+	struct cache_entry *src[STAGES] = { NULL, };
 	struct unpack_trees_options *o = info->data;
 	const struct name_entry *p = names;
 
@@ -728,7 +730,7 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)
 {
 	struct cache_entry *index;
 	struct cache_entry *head;
-	struct cache_entry *remote = stages[o->head_idx + 1];
+	struct cache_entry *remote;
 	int count;
 	int head_match = 0;
 	int remote_match = 0;
@@ -755,6 +757,9 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)
 		head = NULL;
 	}
 
+	if (o->head_idx + 1 >= STAGES)
+		die("Too many stages (internal error)");
+	remote = stages[o->head_idx + 1];
 	if (remote == o->df_conflict_entry) {
 		df_conflict_remote = 1;
 		remote = NULL;

  reply	other threads:[~2009-01-29 22:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29  6:24 Something weird is happening H. Peter Anvin
2009-01-29  6:56 ` Junio C Hamano
     [not found]   ` <20090129113846.GA10645@elte.hu>
2009-01-29 12:05     ` Ingo Molnar
2009-01-29 22:20       ` René Scharfe [this message]
2009-01-29 23:01         ` Daniel Barkalow
2009-01-31 14:39       ` [PATCH] merge: fix out-of-bounds memory access René Scharfe
2009-01-29 13:45   ` Something weird is happening Sverre Rabbelier
2009-02-01  1:31     ` Junio C Hamano
2009-01-29 10:50 ` Ingo Molnar
2009-01-29 10:52   ` Ingo Molnar
2009-01-29 21:45 ` Junio C Hamano
2009-01-29 22:10   ` H. Peter Anvin
2009-01-29 22:35     ` Ingo Molnar
     [not found]       ` <20090129224357.GA18471@elte.hu>
2009-01-29 22:47         ` H. Peter Anvin
2009-01-29 22:57           ` Junio C Hamano
2009-01-29 23:21             ` Linus Torvalds
2009-01-30  9:12               ` [PATCH 1/2] fsck: HEAD is part of refs Junio C Hamano
2009-01-30  9:27                 ` Johannes Sixt
2009-02-01  0:53                   ` Junio C Hamano
2009-01-30 16:47                 ` Johannes Schindelin
2009-01-31 21:45                 ` Nanako Shiraishi
2009-02-01  0:57                   ` Junio C Hamano
2009-01-30  9:13               ` [PATCH 2/2] fsck: check loose objects from alternate object stores by default Junio C Hamano
2009-01-29 22:34   ` Something weird is happening Ingo Molnar
2009-01-29 22:36     ` H. Peter Anvin

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=49822B91.6070303@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hpa@zytor.com \
    --cc=mingo@elte.hu \
    /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).