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

Bug#839264: mklibs-copy: segfaults under fakeroot on various archs: armel armhf i386 mips mipsel



Package: mklibs-copy
Version: 0.1.41
Severity: serious
Tags: patch pending
Justification: breaks d-i build

Hi,

We've been seeing a bunch of d-i FTBFS since early september, due to
mklibs-readelf segfaults, on various archs. Looking at d-i build logs,
what changed then (example for i386, see timestamps 20160904-00:46
[success] vs. 20160905-00:41 [failure]) isn't obvious… (but we don't
store host package list, unfortunately)

In a stretch i386 chroot, I've tried downgrading fakeroot to a previous
version, with no effect, and also libc* to 2.24-1 (which is the only
thing that popped up in the diff), with no effect either.

Anyway, looking at the segfault, it is triggered by trying to look at
the dynamic section:
| (gdb) bt full
| #0  0x0805e818 in std::vector<Elf::dynamic*, std::allocator<Elf::dynamic*> >::begin (this=0x6c2f7572) at /usr/include/c++/6/bits/stl_vector.h:558
| No locals.
| #1  0x0805de2e in process_dynamics (file=0x8075a10, tag=15) at ../../../src/mklibs-readelf/main.cpp:62
|         it = <error reading variable it (Cannot access memory at address 0x3336e00)>
|         section = 0x6c2f756e
| #2  0x0805e47f in process (cmd=COMMAND_PRINT_RPATH, filename=0xffffd6b1 "./tmp/cdrom_gtk/tree/sbin/blkid") at ../../../src/mklibs-readelf/main.cpp:149
|         file = 0x8075a10
| #3  0x0805e6cd in main (argc=3, argv=0xffffd544) at ../../../src/mklibs-readelf/main.cpp:242
|         i = 2
|         c = -1
|         cmd = COMMAND_PRINT_RPATH
| (gdb) 

but that doesn't happen without fakeroot: section is 0x0 instead of
pointing to an address gdb can't access.

I've checked how the sections are initialized in file_data's constructor
(src/mklibs-readelf/elf.cpp), it seems the section_type_DYNAMIC::id case
in the switch is never hit. (With or without fakeroot, according to a
debugging statement I've never seen printed.)

Seeing how there's an explicit init for those:
| section_GNU_VERDEF = NULL;
| section_GNU_VERNEED = NULL;
| section_GNU_VERSYM = NULL;

I decided to try my luck and to init the two others explicitly, and it
seems to fix the issue: section_DYNAMIC and section_DYNSYM.

I'll commit this shortly, once I've checked the resulting image seems to
actually work.


KiBi.


Reply to: