elfhack spews projectile vomit, apparently due to libxul.so > 2GiB
Categories
(Thunderbird :: Build Config, defect)
Tracking
(Not tracked)
People
(Reporter: daniel.santos, Unassigned)
Details
BTW, nice markdown support, I LIKE it!!! =D
>>> Install thunderbird-60.6.1 into /tmp/portage/mail-client/thunderbird-60.6.1/image/ category mail-client
0:01.15 /usr/bin/gmake -C . -j16 -s -w install
0:01.18 gmake: Entering directory '/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird'
0:01.22 gmake[1]: Entering directory '/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird/comm/mail/installer'
0:08.01 terminate called after throwing an instance of 'std::__ios_failure'
0:08.01 what(): basic_ios::clear: iostream error
0:08.90 Traceback (most recent call last):
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/toolkit/mozapps/installer/packager.py", line 343, in <module>
0:08.90 main()
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/toolkit/mozapps/installer/packager.py", line 337, in main
0:08.90 copier.copy(args.destination)
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/python/mozbuild/mozpack/copier.py", line 431, in copy
0:08.90 copy_results.append((destfile, f.copy(destfile, skip_if_older)))
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/python/mozbuild/mozpack/files.py", line 296, in copy
0:08.90 elfhack(dest)
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/python/mozbuild/mozpack/executables.py", line 124, in elfhack
0:08.90 errors.fatal('Error executing ' + ' '.join(cmd))
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/python/mozbuild/mozpack/errors.py", line 103, in fatal
0:08.90 self._handle(self.FATAL, msg)
0:08.90 File "/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/python/mozbuild/mozpack/errors.py", line 98, in _handle
0:08.91 raise ErrorMessage(msg)
0:08.91 mozpack.errors.ErrorMessage: Error: Error executing /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird/build/unix/elfhack/elfhack ../../../dist/thunderbird/libxul.so
0:08.98 gmake[1]: *** [/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/toolkit/mozapps/installer/packager.mk:22: stage-package] Error 1
0:08.98 gmake[1]: Leaving directory '/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird/comm/mail/installer'
0:08.98 gmake: *** [/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/comm/mail/build.mk:16: install] Error 2
0:08.98 gmake: Leaving directory '/tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird'
* ERROR: mail-client/thunderbird-60.6.1::gentoo failed (install phase):
* (no error message)
*
* Call stack:
* ebuild.sh, line 124: Called src_install
* environment, line 5152: Called die
* The specific snippet of code:
* MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 DESTDIR="${D}" ./mach install || die;
Possibly due to: `build/unix/elfhack/elfxx.h:284:
ElfSection *getSectionAt(unsigned int offset);
Perhaps something else later treats this as signed? Either way, I'm guessing that if I build with -g3 I can knock this thing over the 4GiB mark.
See also https://bugs.gentoo.org/686760 https://bugs.gentoo.org/686644
Reporter | ||
Comment 1•6 years ago
|
||
Overall, this program needs MUCH better error handling -- at least a try/catch in main and a stack trace of where the exception is thrown and printing a stack trace from where the exception was thrown. gdb isn't having such a great time with the Elf template class and blows up when trying to step into the Elf ctor, making the exact cause difficult for me to determine.
# gdb --args elfhack /tmp/libxul.copy.so
GNU gdb (Gentoo 8.3 vanilla) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from elfhack...
(gdb) break do_file
Breakpoint 1 at 0x15574: file /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/build/unix/elfhack/elfhack.cpp, line 1197.
(gdb) run
Starting program: /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird/build/unix/elfhack/elfhack /tmp/libxul.copy.so
Breakpoint 1, do_file (name=0x7fffffffe0ed "/tmp/libxul.copy.so", backup=false, force=false)
at /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/build/unix/elfhack/elfhack.cpp:1197
1197 void do_file(const char *name, bool backup = false, bool force = false) {
(gdb) next
1198 std::ifstream file(name, std::ios::in | std::ios::binary);
(gdb)
1199 Elf elf(file);
(gdb) display /2i $rip
1: x/2i $rip
=> 0x5555555695ad <do_file(char const*, bool, bool)+92>: lea -0x220(%rbp),%rdx
0x5555555695b4 <do_file(char const*, bool, bool)+99>: lea -0x490(%rbp),%rax
(gdb) stepi
0x00005555555695b4 1199 Elf elf(file);
1: x/2i $rip
=> 0x5555555695b4 <do_file(char const*, bool, bool)+99>: lea -0x490(%rbp),%rax
0x5555555695bb <do_file(char const*, bool, bool)+106>: mov %rdx,%rsi
(gdb)
0x00005555555695bb 1199 Elf elf(file);
1: x/2i $rip
=> 0x5555555695bb <do_file(char const*, bool, bool)+106>: mov %rdx,%rsi
0x5555555695be <do_file(char const*, bool, bool)+109>: mov %rax,%rdi
(gdb)
0x00005555555695be 1199 Elf elf(file);
1: x/2i $rip
=> 0x5555555695be <do_file(char const*, bool, bool)+109>: mov %rax,%rdi
0x5555555695c1 <do_file(char const*, bool, bool)+112>: callq 0x5555555568a2 <Elf::Elf(std::basic_ifstream<char, std::char_traits<char> >&)>
(gdb)
0x00005555555695c1 1199 Elf elf(file);
1: x/2i $rip
=> 0x5555555695c1 <do_file(char const*, bool, bool)+112>: callq 0x5555555568a2 <Elf::Elf(std::basic_ifstream<char, std::char_traits<char> >&)>
0x5555555695c6 <do_file(char const*, bool, bool)+117>: lea -0x490(%rbp),%rax
(gdb)
Segmentation fault
or
# gdb --args elfhack /tmp/libxul.copy.so
...
(gdb) break do_file
Breakpoint 1 at 0x15574: file /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/build/unix/elfhack/elfhack.cpp, line 1197.
(gdb) run
Starting program: /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/tbird/build/unix/elfhack/elfhack /tmp/libxul.copy.so
Breakpoint 1, do_file (name=0x7fffffffe0ed "/tmp/libxul.copy.so", backup=false, force=false)
at /tmp/portage/mail-client/thunderbird-60.6.1/work/thunderbird-60.6.1/build/unix/elfhack/elfhack.cpp:1197
1197 void do_file(const char *name, bool backup = false, bool force = false) {
(gdb) ptype elf
type = class Elf {
private:
Elf_Ehdr *ehdr;
ElfLocation eh_entry;
ElfStrtab_Section *eh_shstrndx;
ElfSection **sections;
std::vector<ElfSegment*> segments;
ElfSection *shdr_section;
ElfSection *phdr_section;
Elf_Shdr **tmp_shdr;
Segmentation fault
But if you're going to do ELF surgery, please make sure you're using the right data types for offsets in ELF64!
Comment 2•6 years ago
|
||
How is this related to TB? AFAIK we only support builds on the platforms we use to build ourselves.
Reporter | ||
Comment 3•6 years ago
|
||
(In reply to Jorg K (GMT+2) from comment #2)
How is this related to TB? AFAIK we only support builds on the platforms we use to build ourselves.
Hello. Thunderbird is supported on AMD64 / Linux isn't it? Is somebody else responsible for the elfhack program?
Comment 4•6 years ago
|
||
(Updating bug Arch to x86_64 to match your Gentoo bug)
Elfhack is Firefox code; looks like a duplicate of an existing bug 1495733.
Reporter | ||
Comment 5•6 years ago
|
||
(In reply to Rob Lemley [:rjl] from comment #4)
(Updating bug Arch to x86_64 to match your Gentoo bug)
Elfhack is Firefox code; looks like a duplicate of an existing bug 1495733.
*** This bug has been marked as a duplicate of bug 1495733 ***
Very good. Hopefully this bug report under thunderbird will prevent another duplicate, as I had only searched under thunderbird.
Description
•