Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gperftools: fix build on ARM #91818

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@simonchatts
Copy link
Contributor

simonchatts commented Jun 30, 2020

Motivation for this change

The default use of libunwind by tcmalloc segfaults on ARM. For example, starting mongodb immediately crashes (I'll include the backtrace below, for future searches).

This fix removes the use of libunwind on ARM. I've verified this fixes mongodb on aarch64. Other descriptions of the issue say this exact problem also hits aarch32, so the diff covers both architecture variants.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Backtrace

Without this fix, this is my backtrace when mongodb crashes on start, on aarch64:

#0  0x0000007faaedf934 in access_mem () from /nix/store/800ilx46h9s56yr24z73y4ppjlgninxb-libunwind-1.4.0/lib/libunwind.so.8
#1  0x0000007faaee022c in _ULaarch64_is_signal_frame () from /nix/store/800ilx46h9s56yr24z73y4ppjlgninxb-libunwind-1.4.0/lib/libunwind.so.8
#2  0x0000007faaee0834 in _ULaarch64_step () from /nix/store/800ilx46h9s56yr24z73y4ppjlgninxb-libunwind-1.4.0/lib/libunwind.so.8
#3  0x0000007fab8f82e8 in GetStackTrace_libunwind(void**, int, int) [clone .part.0] ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#4  0x0000007fab8f86c0 in GetStackTrace(void**, int, int) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#5  0x0000007fab8e8fd8 in tcmalloc::PageHeap::GrowHeap(unsigned long) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#6  0x0000007fab8e9264 in tcmalloc::PageHeap::New(unsigned long) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#7  0x0000007fab8e7450 in tcmalloc::CentralFreeList::Populate() ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#8  0x0000007fab8e7670 in tcmalloc::CentralFreeList::FetchFromOneSpansSafe(int, void**, void**) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#9  0x0000007fab8e7724 in tcmalloc::CentralFreeList::RemoveRange(void**, void**, int) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#10 0x0000007fab8eac20 in tcmalloc::ThreadCache::FetchFromCentralCache(unsigned int, int, void* (*)(unsigned long)) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#11 0x0000007fab8fb5b8 in tcmalloc::allocate_full_malloc_oom(unsigned long) ()
   from /nix/store/z0k99bd8s25qryw29h5kkmljyqdz7lya-gperftools-2.7/lib/libtcmalloc.so.4
#12 0x0000007fab3d9be4 in ?? () from /nix/store/lhm57ki56ndzwnz6qsg9iii5ljzc3350-gcc-9.3.0-lib/lib/libstdc++.so.6
#13 0x0000007fabd47abc in call_init.part () from /nix/store/ajn7yh1fm35f8lv3pfmbf7d1f3c1vwkw-glibc-2.30/lib/ld-linux-aarch64.so.1
#14 0x0000007fabd47bc0 in _dl_init () from /nix/store/ajn7yh1fm35f8lv3pfmbf7d1f3c1vwkw-glibc-2.30/lib/ld-linux-aarch64.so.1
#15 0x0000007fabd3b104 in _dl_start_user () from /nix/store/ajn7yh1fm35f8lv3pfmbf7d1f3c1vwkw-glibc-2.30/lib/ld-linux-aarch64.so.1
@vcunat
vcunat approved these changes Jun 30, 2020
Copy link
Member

vcunat left a comment

Sounds OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.