{"thread":{"id":"9127","subject":"segfault in diff-delta.c on mac os x (commit 8433669)","startedAt":"2007-07-21T15:15:00Z","lastAt":"2007-07-22T12:59:10Z","messageCount":4,"participants":["Steffen Prohaska","Brian Gernhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"48041","messageId":"C10CCDA5-6D65-445E-92F3-2D3E4DCA4F8B@zib.de","threadId":"9127","inReplyTo":null,"subject":"segfault in diff-delta.c on mac os x (commit 8433669)","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-07-21T15:15:00Z","receivedAt":"2007-07-21T15:15:00Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"843366961cf14aad6490fbeb30f7b98f37f8833a may cause segfaults on\nMac OS X. See backtrace below. I only observed the segfault with\n-O2 builds.\n\nI was not yet able to understand the reason causing the segfault.\nThe situation is kind of strange. The for loop in line 302 shouldn't\nallow entry == 0 to ever happen. But maybe some more intricate\ncorruption is taking place.\n\nUnfortunately I'm no longer able to reproduce the exact call stack\nbecause I wasn't aware of the details of when pruning takes place;\nand the repository changed in such a way that the segfault no\nlonger happens.\n\nHowever, I experienced suspicious behaviour on other repositories\nduring packing as well. I can probably create similar call stacks\nif needed.\n\nFor now, I reverted 843366961cf14aad6490fbeb30f7b98f37f8833a for me.\n\n\tSteffen\n\n\ngcc --version\ni686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build  \n5250)\nCopyright (C) 2005 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions.  There  \nis NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR  \nPURPOSE.\n\n\nCounting objects: 7530\nDone counting 56361 objects.\nDeltifying 56361 objects...\n   69% (38890/56361) done\n\nProgram received signal EXC_BAD_ACCESS, Could not access memory.\nReason: KERN_PROTECTION_FAILURE at address: 0x00000000\n0x00048526 in create_delta (index=0x35d5000, trg_buf=0x35a0000,  \ntrg_size=214109, delta_size=0xbfffe83c, max_size=104893) at diff- \ndelta.c:303\n303                                     const unsigned char *ref =  \nentry->ptr;\n(gdb) bt\n#0  0x00048526 in create_delta (index=0x35d5000, trg_buf=0x35a0000,  \ntrg_size=214109, delta_size=0xbfffe83c, max_size=104893) at diff- \ndelta.c:303\n#1  0x0002beb7 in prepare_pack (window=10, depth=50) at builtin-pack- \nobjects.c:1293\n#2  0x0002cd6e in cmd_pack_objects (argc=16, argv=0xbfffef78,  \nprefix=0x0) at builtin-pack-objects.c:1709\n#3  0x000020c9 in handle_internal_command (argc=16, argv=0xbfffef78,  \nenvp=0x84) at git.c:324\n#4  0x00002669 in main (argc=16, argv=0xbfffef78, envp=0xbfffefbc) at  \ngit.c:393\n(gdb) l\n298                             struct index_entry *entry;\n299                             val ^= U[data[-RABIN_WINDOW]];\n300                             val = ((val << 8) | *data) ^ T[val >>  \nRABIN_SHIFT];\n301                             i = val & index->hash_mask;\n302                             for (entry = index->hash[i]; entry;  \nentry = entry->next) {\n303                                     const unsigned char *ref =  \nentry->ptr;\n304                                     const unsigned char *src = data;\n305                                     unsigned int ref_size =  \nref_top - ref;\n306                                     if (entry->val != val)\n307                                             continue;\n(gdb) p entry\n$1 = (struct index_entry *) 0x0\n"},{"id":"48086","messageId":"233B9D70-9D91-4527-9801-7E2463ABDDAA@silverinsanity.com","threadId":"9127","inReplyTo":"C10CCDA5-6D65-445E-92F3-2D3E4DCA4F8B@zib.de","subject":"Re: segfault in diff-delta.c on mac os x (commit 8433669)","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-07-22T03:35:41Z","receivedAt":"2007-07-22T03:35:41Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Jul 21, 2007, at 11:15 AM, Steffen Prohaska wrote:\n\n> 843366961cf14aad6490fbeb30f7b98f37f8833a may cause segfaults on\n> Mac OS X. See backtrace below. I only observed the segfault with\n> -O2 builds.\n\nI have been using git on my OS X box for quite a while, and that  \ncommit appears to be nearly two months old.  I have yet to see any  \npacking errors in any of my repositories.  (This is with -O2, which  \nappears to be the default.)\n\nMy gcc reports itself as build 5367 instead of 5250.  Perhaps there  \nis a compiler error in an older copy of the DevTools?\n\nAlso, did this segfault occur with any publicly available repo or is  \nit your own work?\n\n~~ Brian\n"},{"id":"48108","messageId":"6A487E9A-27E5-4212-A7C9-EBB6528791FE@zib.de","threadId":"9127","inReplyTo":"233B9D70-9D91-4527-9801-7E2463ABDDAA@silverinsanity.com","subject":"Re: segfault in diff-delta.c on mac os x (commit 8433669)","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-07-22T08:49:10Z","receivedAt":"2007-07-22T08:49:10Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Jul 22, 2007, at 5:35 AM, Brian Gernhardt wrote:\n\n>\n> On Jul 21, 2007, at 11:15 AM, Steffen Prohaska wrote:\n>\n>> 843366961cf14aad6490fbeb30f7b98f37f8833a may cause segfaults on\n>> Mac OS X. See backtrace below. I only observed the segfault with\n>> -O2 builds.\n>\n> I have been using git on my OS X box for quite a while, and that  \n> commit appears to be nearly two months old.  I have yet to see any  \n> packing errors in any of my repositories.  (This is with -O2, which  \n> appears to be the default.)\n>\n> My gcc reports itself as build 5367 instead of 5250.  Perhaps there  \n> is a compiler error in an older copy of the DevTools?\n\nThis seems to be the case. I upgraded the compiler and\ntried again. The segfault didn't happen again. Note, this\nwas not exactly the same situation as before because the\ngit repository used for testing changed a bit since the\nfirst segfault.\n\nI'll do some more repacking over the day and will report\nmy observations.\n\n\n> Also, did this segfault occur with any publicly available repo or  \n> is it your own work?\n\nIt occurred on repacking a clone of\ngit://git.kernel.org/pub/scm/git/git.git.\n\n\n\tSteffen\n"},{"id":"48137","messageId":"B19AC964-3398-46AF-934B-BB2F06688F7B@zib.de","threadId":"9127","inReplyTo":"6A487E9A-27E5-4212-A7C9-EBB6528791FE@zib.de","subject":"Re: segfault in diff-delta.c on mac os x (commit 8433669)","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-07-22T12:59:10Z","receivedAt":"2007-07-22T12:59:10Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Jul 22, 2007, at 10:49 AM, Steffen Prohaska wrote:\n\n>\n> On Jul 22, 2007, at 5:35 AM, Brian Gernhardt wrote:\n>\n>>\n>> On Jul 21, 2007, at 11:15 AM, Steffen Prohaska wrote:\n>>\n>>> 843366961cf14aad6490fbeb30f7b98f37f8833a may cause segfaults on\n>>> Mac OS X. See backtrace below. I only observed the segfault with\n>>> -O2 builds.\n>>\n>> I have been using git on my OS X box for quite a while, and that  \n>> commit appears to be nearly two months old.  I have yet to see any  \n>> packing errors in any of my repositories.  (This is with -O2,  \n>> which appears to be the default.)\n>>\n>> My gcc reports itself as build 5367 instead of 5250.  Perhaps  \n>> there is a compiler error in an older copy of the DevTools?\n>\n> This seems to be the case. I upgraded the compiler and\n> tried again. The segfault didn't happen again. Note, this\n> was not exactly the same situation as before because the\n> git repository used for testing changed a bit since the\n> first segfault.\n>\n> I'll do some more repacking over the day and will report\n> my observations.\n\nI did a lot more testing and am pretty convinced now that\nthe problem is not present with the newer compiler. Using\nbuild 5367 of gcc seems to creating a working git executable\nwhile build 5250 creates a broken one.\n\n\tSteffen\n"}]}