Opened 3 years ago

Closed 2 years ago

#20683 closed task (fixed)

Integrate selfrando into the alpha Linux 64bit builds

Reported by: gk Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-security, GeorgKoppen201704, TorBrowserTeam201705R
Cc: yawning Actual Points:
Parent ID: Points:
Reviewer: Sponsor: Sponsor4

Description

We are currently shipping selfrando in our hardened builds. We should include it into our regular alphas to give it a wider test audience.

Child Tickets

Change History (26)

comment:1 Changed 3 years ago by gk

Keywords: GeorgKoppen201611 added

comment:2 Changed 3 years ago by yawning

Cc: yawning added

comment:3 Changed 3 years ago by gk

Summary: Integrate selfrando into the alpha Linux buildsIntegrate selfrando into the alpha Linux 64bit builds

comment:4 Changed 3 years ago by gk

Trying to compile selfrando for 32bit system crashes with

g++ -o sconsRelease/x86/gcc/LinuxSymproc/ObjectFileParser.o -c -std=c++11 -include /home/debian/build/elfutils-0.160/libelf/elf.h -I /home/debian/install/elfutils/include -fno-reorder-functions -O2 -fno-omit-frame-pointer -g -Wl,-z,noexecstack -m32 -DRANDOLIB_ARCH=x86 -DRANDOLIB_ARCH_SIZE=32 -DRANDOLIB_IS_X86=1 -IsconsRelease/x86/gcc/LinuxSymproc -ILinuxSymproc LinuxSymproc/ObjectFileParser.cpp
LinuxSymproc/ObjectFileParser.cpp: In member function 'void ExecFileParser::add_txtrp_section(const std::vector<ObjectFileParser::Section>&, const ObjectFileParser::NonExecutableRelocations&)':
LinuxSymproc/ObjectFileParser.cpp:383:78: error: no matching function for call to 'max(long unsigned int&, ELFIO::Elf64_Addr)'
         p = std::max(p, segm->get_virtual_address() + segm->get_memory_size());
                                                                              ^
In file included from /home/debian/install/gcc/include/c++/5.1.0/algorithm:61:0,
                 from LinuxSymproc/ObjectFileParser.cpp:9:
/home/debian/install/gcc/include/c++/5.1.0/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/home/debian/install/gcc/include/c++/5.1.0/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
LinuxSymproc/ObjectFileParser.cpp:383:78: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'ELFIO::Elf64_Addr {aka long long unsigned int}')
         p = std::max(p, segm->get_virtual_address() + segm->get_memory_size());

After talking to the selfrando devs it turns out the 32bit mode never really got finished properly. Thus we integrate it only for 64bit bundles for now. I've filed #20848 for the 32bit part.

comment:5 Changed 3 years ago by gk

Keywords: GeorgKoppen201612 added; GeorgKoppen201611 removed

Moving my tickets

comment:6 Changed 3 years ago by gk

Keywords: TorBrowserTeam201612 added; TorBrowserTeam201611 removed

Moving tickets to December.

comment:7 Changed 3 years ago by gk

Hm it seems 64bit builds outside of our hardened context break as well:

+ exec c++ -o webapprt-stub -Wall -Wempty-body -Woverloaded-virtual -Wsign-compare -Wwrite-strings -Wno-invalid-offsetof -Wcast-align -frandom-seed=tor -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pipe -DNDEBUG -DTRIMMED -g -freorder-blocks -Os -fomit-frame-pointer /home/debian/build/tor-browser/obj-x86_64-unknown-linux-gnu/webapprt/gtk/tmpZ7SNKK.list -lpthread -Wl,-z,noexecstack -Wl,-z,text -Wl,--build-id -rdynamic -Wl,-rpath-link,/home/debian/build/tor-browser/obj-x86_64-unknown-linux-gnu/dist/bin -Wl,-rpath-link,NONE/lib ../../xpcom/glue/standalone/libxpcomglue.a -ldl -lrt -lgtk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lfreetype -lfontconfig -lgdk-x11-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -B /home/debian/build/selfrando/Tools/TorBrowser/tc-wrapper
+ /home/debian/install/binutils/bin/ld.gold --section-start .interp=0x400800 -dn /home/debian/install/selfrando/randoentry.o /home/debian/install/selfrando/sr_begin.o /home/debian/install/selfrando/libselfrando.a /home/debian/install/selfrando/sr_end.o -dy -plugin /home/debian/install/gcc/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/liblto_plugin.so -plugin-opt=/home/debian/install/gcc/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccwYIH0z.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o webapprt-stub /usr/lib/x86_64-linux-gnu/Scrt1.o /usr/lib/x86_64-linux-gnu/crti.o /home/debian/install/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/crtbeginS.o -L/home/debian/build/selfrando/Tools/TorBrowser/tc-wrapper -L/home/debian/install/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.1.0 -L/home/debian/install/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/home/debian/install/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../.. /home/debian/build/tor-browser/obj-x86_64-unknown-linux-gnu/webapprt/gtk/tmpZ7SNKK.list -lpthread -z noexecstack -z text --build-id -rpath-link /home/debian/build/tor-browser/obj-x86_64-unknown-linux-gnu/dist/bin -rpath-link NONE/lib ../../xpcom/glue/standalone/libxpcomglue.a -ldl -lrt -lgtk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lfreetype -lfontconfig -lgdk-x11-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/debian/install/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/crtendS.o /usr/lib/x86_64-linux-gnu/crtn.o --build-id=none -Map webapprt-stub.map ./padding.j0MrJ45JzmDsL3m.o
+ /home/debian/install/selfrando/SymProc webapprt-stub webapprt-stub.map -ffunction-sections
Unknown type 20 (file '/home/debian/build/tor-browser/obj-x86_64-unknown-linux-gnu/webapprt/gtk/../../memory/mozjemalloc/jemalloc.o', section: .rela.text.choose_arena, offset: 4, relo index: 0/19)
collect2: error: ld returned 13 exit status
make[5]: *** [webapprt-stub] Error 1

comment:8 Changed 3 years ago by gk

Keywords: TorBrowserTeam201701 added; TorBrowserTeam201612 removed

Moving our tickets to January 2017

comment:9 Changed 3 years ago by gk

Keywords: GeorgKoppen201701 added; GeorgKoppen201612 removed

comment:10 Changed 3 years ago by gk

Keywords: TorBrowserTeam201702 added; TorBrowserTeam201701 removed

Moving our tickets to Feb 2017.

comment:11 Changed 3 years ago by gk

Sponsor: Sponsor4

This is Sponsor4 work

comment:12 Changed 3 years ago by gk

Keywords: GeorgKoppen201702 added; GeorgKoppen201701 removed

Moving my tickets as well

comment:13 Changed 3 years ago by gk

Keywords: TorBrowserTeam201703R added; TorBrowserTeam201702 removed
Status: newneeds_review

bug_20683_v4 (https://gitweb.torproject.org/user/gk/tor-browser-bundle.git/commit/?h=bug_20683_v4&id=74bc959b60d4ebb04179a87a113fbb5254d9d3fa) in my public repo has a patch for review. It uses TrapLinker now under the hood which fixes the NSS AES incompatibility as well and improves stability in general. The relevant selfrando and elfutils commits/tags are in the nightly versions file. I'll update the alpha one with proper tags once we had the code baking in our nightlies for a while and nothing exploded.

Note: This patch makes use of our own gcc/binutils for the remaining components in the gitian-utils descriptor (a thing I wanted to have for quite a while now).

comment:14 Changed 3 years ago by gk

Keywords: GeorgKoppen201703 added; GeorgKoppen201702 removed

Moving my tickets.

comment:15 Changed 3 years ago by gk

Keywords: TorBrowserTeam201704R added; TorBrowserTeam201703R removed

Moving review tickets to April.

comment:16 Changed 3 years ago by gk

Keywords: GeorgKoppen201704 TorBrowserTeam201704 added; GeorgKoppen201703 TorBrowserTeam201704R removed
Status: needs_reviewneeds_revision

comment:17 Changed 3 years ago by gk

Keywords: TorBrowserTeam201704R added; TorBrowserTeam201704 removed
Status: needs_revisionneeds_review

comment:18 in reply to:  17 Changed 3 years ago by boklm

Replying to gk:

Rebased and with a small fixup: bug_20683_v5 (https://gitweb.torproject.org/user/gk/tor-browser-bundle.git/commit/?h=bug_20683_v5&id=353c304ac5c9d7fee61f6f47ae0f5967eb40f005).

It looks like the gitian/gpg/ELFUTILS.gpg file is missing in this commit (but was present in v4). Except for this, the changes look good.

comment:19 Changed 3 years ago by gk

Resolution: fixed
Status: needs_reviewclosed

Oops, thanks for catching this. Fixed with commit 0ea68f848f54aaeceeeed22dc1496d3723cbe128 which landed on master.

comment:20 Changed 3 years ago by gk

Keywords: TorBrowserTeam201704 added; TorBrowserTeam201704R removed
Resolution: fixed
Status: closedreopened

Selfrando does not cope with ESR52 it seems (I know, surprise, surprise). Linking libxul fails with:

+ exec g++ -std=gnu++11 -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wc++14-compat -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -fno-lifetime-dse -frandom-seed=tor -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -pipe -g -freorder-blocks -Os -fomit-frame-pointer -fPIC -shared -Wl,-z,defs -Wl,-h,libxul.so -o libxul.so /home/debian/build/tor-browser/obj-x86_64-pc-linux-gnu/toolkit/library/tmps717Jq.list -lpthread -Wl,-z,noexecstack -Wl,-z,text -Wl,--build-id -Wl,-version-script,symverscript -Wl,-rpath-link,/home/debian/build/tor-browser/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/usr/local/lib ../../security/nss/lib/crmf/libcrmf.a ../../js/src/libjs_static.a ../../security/sandbox/linux/libmozsandbox.so ../../security/nss/lib/nss/libnss3.so ../../security/nss/lib/smime/libsmime3.so ../../security/nss/lib/ssl/libssl3.so ../../security/nss/lib/util/libnssutil3.so ../../config/external/sqlite/libmozsqlite3.so ../../config/external/nspr/pr/libnspr4.so ../../config/external/nspr/libc/libplc4.so ../../config/external/nspr/ds/libplds4.so ../../config/external/lgpllibs/liblgpllibs.so -ldl -lm -ldl -lrt -lfreetype -lfontconfig -lXrender -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -lgtk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk-x11-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lX11-xcb -lxcb-shm -lxcb -lX11 -lXext -lXt -lgthread-2.0 -B../../../../selfrando/Tools/TorBrowser/tc-wrapper
ar: creating /tmp/traparchive-jbmfaJgQ
ar: creating /tmp/traparchive-foOLxsbh
ar: creating /tmp/traparchive-ORMlPgga
ar: creating /tmp/traparchive-pjmQhMcd
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-beqolrlN: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-bmvslhPr: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-KbQLRpaQ: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-doScfxce: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeStringeqERKS0_$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-uijklyoz: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-Klflqxns: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-ormLgKLz: requires dynamic R_X86_64_PC32 reloc against '_ZN6icu_5813UnicodeString6appendERKS0_$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-uvkxduhn: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-jPrLKSxa: requires dynamic R_X86_64_PC32 reloc against '_ZN6icu_5813UnicodeString5setToEi$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-ajgryPzd: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-PiQOPOqv: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-mjmkpsfh: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-heevkOjx: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-RdPzOpwx: requires dynamic R_X86_64_PC32 reloc against '_ZN6icu_5813UnicodeStringaSEOS0_$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-yeotOvOn: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-poiLngPi: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-QMKJvcdh: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-gQmcMoux: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeStringeqERKS0_$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-wMQxNkli: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC
/home/debian/install/binutils/bin/ld.gold.real: error: /tmp/trapobj-ahRQnahK: requires dynamic R_X86_64_PC32 reloc against '_ZNK6icu_5813UnicodeString6lengthEv$orig' which may overflow at runtime; recompile with -fPIC

etc.

comment:21 Changed 3 years ago by cypherpunks

comment:22 Changed 2 years ago by gk

Keywords: TorBrowserTeam201704R added; TorBrowserTeam201704 removed
Status: reopenedneeds_review

bug_20683_v9 (https://gitweb.torproject.org/user/gk/tor-browser-bundle.git/commit/?h=bug_20683_v9&id=e799bdfe114bc2103699014a0fe65b7a9542d2ba) is up for review. It fixes the compilation issue in comment:20 with a binutils patch and bumps the selfrando commit to fix a crash encountered while testing.

comment:23 Changed 2 years ago by gk

Keywords: TorBrowserTeam201705R added; TorBrowserTeam201704R removed

Moving review tickets to May.

comment:24 in reply to:  22 Changed 2 years ago by boklm

Replying to gk:

bug_20683_v9 (https://gitweb.torproject.org/user/gk/tor-browser-bundle.git/commit/?h=bug_20683_v9&id=e799bdfe114bc2103699014a0fe65b7a9542d2ba) is up for review. It fixes the compilation issue in comment:20 with a binutils patch and bumps the selfrando commit to fix a crash encountered while testing.

This patch looks good to me.

I also opened #22194 to apply the same changes into tor-browser-build.git.

comment:25 Changed 2 years ago by gk

Thanks. I cherry-picked the commit to master (commit 332c5b6c16f1b0915f537a4ad5af48295f80c733) and waiting for a proper tag from the selfrando folks for the alpha before closing this ticket.

comment:26 Changed 2 years ago by gk

Resolution: fixed
Status: needs_reviewclosed

Okay, I added support for the signed tag (commit 8fe0e322b950efa2456502428bee66dde8b4948a) and bumped the elfutils version for our alphas as well (commit 3e752843dfa39beec844822c9f6c3dd1f80355ea). I think we are done here.

Note: See TracTickets for help on using tickets.