Stable release crashes on import

Miika Turkia miika.turkia at gmail.com
Mon Apr 11 11:10:57 PDT 2016


On Mon, Apr 11, 2016 at 7:30 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> On Apr 10, 2016 21:09, "Miika Turkia" <miika.turkia at gmail.com> wrote:
>>
>> When importing the attached log file, the stable releases crash. I
>> have not been able to figure out what is wrong (apart from apparent
>> memory corruption). This seems to work on development version, but
>> fails on the stable releases. Moreover, when I dump the imported log
>> to a file before the crash, this log file opens up just fine.
>
> So I found a buglet in copy_dive() when I was doing the git save
> optimization, and fixed that there - when copying the first dc (the one that
> is part of the struct dive) we wouldn't do the proper strdup() of the dc
> model name. But when I looked at it, I decided it couldn't matter, because
> we never free the fields of the first dc anyway.
>
> But you do have copy_dive in your stack trace. Hmm..
>
> The fix was to replace the open-coded sample/event copy calls after the
> STRUCTURED_COPY_LIST() thing with a
>
>    copy_dc(&s->dc, &d->dc);
>
> before that STRUCTURED_COPY_LIST(), so that we copy the first dive computer
> and then copy the list of secondary computers after that.
>
> It mattered for my git save optimizations because my first version of that
> also needed to invalidate the dc git cache when it did the copy. That never
> made it to the final version, but the fix for copying the dc did. And you do
> mention that the development version doesn't have this problem..

Seems that you were right about this (even though deciphering the
instructions took a while :D) The attached patch works on my tests
with the problematic input. It is against v4.5-branch.

> Have you tried running things under valgrind? That tends to be very good at
> finding memory corruption bugs.

Unfortunately valgrind does not work with Subsurface nowadays. At
least i crashes on my system when I try to run it. I have only been
able to use it by writing a minimalistic test case for a feature and
running valgrind against that.

miika
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-a-crash-on-Seabear-import.patch
Type: text/x-diff
Size: 1468 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160411/e987c6c1/attachment.patch>


More information about the subsurface mailing list