[Pkg-javascript-devel] Bug#922075: Bug#922075: npm: segfault during extract on i386

Ondrej Zary ondrej at zary.sk
Mon Sep 20 11:38:42 BST 2021


> Ok now try to run the whole thing against valgrind...
Seems that valgrind does not work with asan:

$ LD_PRELOAD=/usr/lib/i386-linux-gnu/libasan.so.5.0.0 valgrind yarnpkg install
==752== Memcheck, a memory error detector
==752== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==752== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==752== Command: /usr/bin/yarnpkg install
==752==
==752==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
==752==
==752== HEAP SUMMARY:
==752==     in use at exit: 0 bytes in 0 blocks
==752==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==752==
==752== All heap blocks were freed -- no leaks are possible
==752==
==752== For counts of detected and suppressed errors, rerun with: -v
==752== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

valgrind with clean libuv1 (no asan):
runuser -u gitlab -- sh -c 'valgrind --trace-children=yes yarnpkg install'
==3163== Memcheck, a memory error detector
==3163== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3163== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==3163== Command: /usr/bin/yarnpkg install
==3163==
==3163== Memcheck, a memory error detector
==3163== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3163== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==3163== Command: /usr/bin/node /usr/bin/yarnpkg install
==3163==
yarn install v1.13.0
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[---------------------------------------------------------------------------------------------------------------------------------------------------] 0/520==3163== Invalid read of size 4
==3163==    at 0x4556B5B: node::fs::FSReqWrap::~FSReqWrap() (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x4547A42: node::fs::FSReqAfterScope::~FSReqAfterScope() (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x45484FD: node::fs::AfterInteger(uv_fs_s*) (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x556170F: uv__work_done (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x55657FD: ??? (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x5575527: uv__io_poll (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x55661C5: uv_run (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x4515C75: node::Start(v8::Isolate*, node::IsolateData*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x4513C96: node::Start(int, char**) (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x8049157: main (in /usr/bin/node)
==3163==  Address 0x1085 is not stack'd, malloc'd or (recently) free'd
==3163==
==3163==
==3163== Process terminating with default action of signal 11 (SIGSEGV)
==3163==  Access not within mapped region at address 0x1085
==3163==    at 0x4556B5B: node::fs::FSReqWrap::~FSReqWrap() (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x4547A42: node::fs::FSReqAfterScope::~FSReqAfterScope() (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x45484FD: node::fs::AfterInteger(uv_fs_s*) (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x556170F: uv__work_done (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x55657FD: ??? (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x5575527: uv__io_poll (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x55661C5: uv_run (in /usr/lib/i386-linux-gnu/libuv.so.1.0.0)
==3163==    by 0x4515C75: node::Start(v8::Isolate*, node::IsolateData*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x4513C96: node::Start(int, char**) (in /usr/lib/i386-linux-gnu/libnode.so.64)
==3163==    by 0x8049157: main (in /usr/bin/node)
==3163==  If you believe this happened as a result of a stack
==3163==  overflow in your program's main thread (unlikely but
==3163==  possible), you can try to increase the size of the
==3163==  main thread stack using the --main-stacksize= flag.
==3163==  The main thread stack size used in this run was 8388608.
==3163== Invalid read of size 1
==3163==    at 0x786A6A4: check_free (dlerror.c:189)
==3163==    by 0x786ABD8: free_key_mem (dlerror.c:221)
==3163==    by 0x786ABD8: __dlerror_main_freeres (dlerror.c:239)
==3163==    by 0x7CA4667: __libc_freeres (in /usr/lib/i386-linux-gnu/libc-2.28.so)
==3163==    by 0x402D1DE: _vgnU_freeres (in /usr/lib/i386-linux-gnu/valgrind/vgpreload_core-x86-linux.so)
==3163==  Address 0xedbde is not stack'd, malloc'd or (recently) free'd
==3163==
==3163==
==3163== Process terminating with default action of signal 11 (SIGSEGV)
==3163==  Access not within mapped region at address 0xEDBDE
==3163==    at 0x786A6A4: check_free (dlerror.c:189)
==3163==    by 0x786ABD8: free_key_mem (dlerror.c:221)
==3163==    by 0x786ABD8: __dlerror_main_freeres (dlerror.c:239)
==3163==    by 0x7CA4667: __libc_freeres (in /usr/lib/i386-linux-gnu/libc-2.28.so)
==3163==    by 0x402D1DE: _vgnU_freeres (in /usr/lib/i386-linux-gnu/valgrind/vgpreload_core-x86-linux.so)
==3163==  If you believe this happened as a result of a stack
==3163==  overflow in your program's main thread (unlikely but
==3163==  possible), you can try to increase the size of the
==3163==  main thread stack using the --main-stacksize= flag.
==3163==  The main thread stack size used in this run was 8388608.
==3163==
==3163== HEAP SUMMARY:
==3163==     in use at exit: 1,908,342 bytes in 19,155 blocks
==3163==   total heap usage: 743,018 allocs, 723,863 frees, 572,337,823 bytes allocated
==3163==
==3163== LEAK SUMMARY:
==3163==    definitely lost: 78 bytes in 1 blocks
==3163==    indirectly lost: 0 bytes in 0 blocks
==3163==      possibly lost: 81,312 bytes in 14 blocks
==3163==    still reachable: 1,826,952 bytes in 19,140 blocks
==3163==                       of which reachable via heuristic:
==3163==                         newarray           : 50,384 bytes in 37 blocks
==3163==                         multipleinheritance: 32 bytes in 1 blocks
==3163==         suppressed: 0 bytes in 0 blocks
==3163== Rerun with --leak-check=full to see details of leaked memory
==3163==
==3163== For counts of detected and suppressed errors, rerun with: -v
==3163== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Segmentation fault


-- 
Ondrej Zary



More information about the Pkg-javascript-devel mailing list