Re: Bugreport: pack-objects died of signal 11

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 04 2022, Derrick Stolee wrote:

> On 8/4/2022 2:21 PM, Emily Noneman wrote:
>> The stack trace:
>> Thread 2 received signal SIGSEGV, Segmentation fault.
>> git_config_check_init (repo=0x0) at config.c:2538
>> 2538        if (repo->config && repo->config->hash_initialized)
>> (gdb) bt
>> #0  git_config_check_init (repo=0x0) at config.c:2538
>> #1  0x00000001001197a8 in repo_config_get_string (repo=0x0, key=0x1002a3c49 "status.showuntrackedfiles", dest=0x0, dest@entry=0x7ff7bfefc1f0) at config.c:2574
>> #2  0x000000010014a85b in new_untracked_cache_flags (istate=0x0) at dir.c:2781
>> #3  new_untracked_cache (istate=0x0, flags=-1) at dir.c:2797
>> #4  0x00000001001d68f1 in tweak_untracked_cache (istate=0x7ff7bfefc7e0) at read-cache.c:1996
>
> Here is where things are confusing:
>
> * tweak_untracked_cache() takes an 'istate' that is non-NULL here.
>
> * The next spot in the stack is new_untracked_cache() with a NULL 'istate'.
>
> The only way these are connected is by a missing stack frame (probably
> optimized out) calling add_untracked_cache(). Still, it should be
> passing 'istate' throughout this process.
>
> The repo_config_get_string() call must also be coming from
> new_untracked_cache_flags() which is again a missing stack frame,
> but is called from new_untracked_cache(). Strangely, it's using
> a NULL 'repo' here which should have come from 'istate->repo', so
> we should have had a segfault earlier.
>
> Sorry for the drive-by commentary without any solution. This is
> just genuinely puzzling to me.

I think this segfault might be fixed by this patch of mine, which I
wrote for something unrelated back in April (but it was never sent to
the list).

	https://github.com/avar/git/commit/d83bfa866ba

Emily and/or Paul: Are you able to test the patch to see if it would
work, diff here: https://github.com/avar/git/commit/d83bfa866ba.patch

It's exactly on the codepath in this stacktrace,
i.e. add_index_objects_to_pending() in revision.c will do before/after:

	- struct index_state istate = { NULL };
	+ struct index_state istate = { .repo = revs->repo };

Then when we're all the way down in new_untracked_cache_flags() we do:

	struct repository *repo = istate->repo;

Which then calls (indirectly) git_config_check_init(), and we segfault
not because istate is NULL, but because the "repo" it's carrying is
NULL.

But maybe I'm wrong, I haven't been able to reproduce this.

The reason I wrote that patch (as can be seen if you peek at the WIP
branch it's at) is because I ran into a similar dependency between
the_index and the_repo & an istate variable being passed around with
fsmonitor-settings.c.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux