From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RDNS_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 22094 invoked from network); 29 Mar 2020 00:31:07 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from unknown (HELO mother.openwall.net) (195.42.179.200) by inbox.vuxu.org with ESMTP; 29 Mar 2020 00:31:07 -0000 Received: (qmail 15444 invoked by uid 550); 29 Mar 2020 00:31:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 23959 invoked from network); 28 Mar 2020 23:40:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=DjgjvniRjwWuEptRg4XLDDanq4eFWyHLAnXx5DmVK70=; b=LpPLJlFKxsonpOh0cx4RT7rvLA9pJ2on8ZhlQPlD1ae3Q+/ffDyHZQ8V/Gm+dUVDan djf0lQ1Q7dHWLAERbXV37ffaaNtLmCSg5fkUKJgyKEilE/ub0ZjhYbRqoKXGw8d20Q3T mCMN8aSnW++kDeBgL5i3gxlXCiAdSn29XUtDTr/+H2zvUzdIbJpIqIXCbXGqO2hzagJg wh1KUqWpZhgylQUf1acsyqa0BE3TBj+aFxrYhthpr4IAiVlVjpffJRxfwUlk1yG1Alvz gSNcrcWRcfbAL7TZiPgiBy1QKca3hRDTFUFxFUNBp7wjKhJFeat4UHM+Kp213nSPs1ay Edbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DjgjvniRjwWuEptRg4XLDDanq4eFWyHLAnXx5DmVK70=; b=aWl4nYb1g18SQWQ8fWcPUtQRbFrNjElTgfM8NDNwsyUkWxeB26sOswq1yry8pIcWmg 9oIdGq6oHdilYhamSyeWV/SVGCGI8LnMZYA/pGvbt5AGKkIqN2DgcCV5b7c70bOBUuyM a19UHETpwGmJctD3i8Ahmtmq0OzcwQVwiaz8oXa6E4gGja3bcvfX5jBxKQ2LAwtMyqN+ Fz1G0EtCx4yHZhGYPAR+h+1nr+4GUIj+3Rs+jjMSBQ/GK5nU75XAo+aTHVj1SNsOe/PZ ThMYMl7trUpSp/zgT9fZaKTC3fXAlU1Yo7Gs0bqV3DIuz8cFU4/H8eB1mfWwMkD8lSYU zqzQ== X-Gm-Message-State: AGi0Pua+NZ8NqO6LDDbkYP9pnTPMRsWsLC5z6mFmdqmwmw8shCAo7OOf I6xYfkLLIv+dlbJfDRli5/LTtiCdWBRFB5lhbIgv4aCb X-Google-Smtp-Source: APiQypLTGDcHrN+cenOAztk+ptj3FLdieWtqC5ukc0hSDdE5QqiiuWLEWymZCI+5i8QH2zQPdt+uhHKOoUIavbi4S94= X-Received: by 2002:a2e:905a:: with SMTP id n26mr3428876ljg.58.1585438789496; Sat, 28 Mar 2020 16:39:49 -0700 (PDT) MIME-Version: 1.0 From: Andrew McKinlay Date: Sat, 28 Mar 2020 16:39:38 -0700 Message-ID: To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Subject: [musl] Valgrind errors when running simple program Running ``` int main(void) { } ``` through Valgrind produces errors: ``` ubuntu@primary:~/env_stuff$ valgrind --leak-check=full --show-leak-kinds=all -v ./a.out ==3492== Memcheck, a memory error detector ==3492== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==3492== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==3492== Command: ./a.out ==3492== --3492-- Valgrind options: --3492-- --leak-check=full --3492-- --show-leak-kinds=all --3492-- -v --3492-- Contents of /proc/version: --3492-- Linux version 4.15.0-91-generic (buildd@lgw01-amd64-013) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 --3492-- --3492-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-sse3-avx-avx2-bmi --3492-- Page sizes: currently 4096, max supported 4096 --3492-- Valgrind library directory: /usr/lib/valgrind --3492-- Reading syms from /home/ubuntu/env_stuff/a.out --3492-- Reading syms from /lib/x86_64-linux-musl/libc.so --3492-- object doesn't have a symbol table --3492-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux --3492-- Considering /usr/lib/valgrind/memcheck-amd64-linux .. --3492-- .. CRC mismatch (computed 41ddb025 wanted 9972f546) --3492-- object doesn't have a symbol table --3492-- object doesn't have a dynamic symbol table --3492-- Scheduler: using generic scheduler lock implementation. --3492-- Reading suppressions file: /usr/lib/valgrind/default.supp ==3492== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-3492-by-ubuntu-on-??? ==3492== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-3492-by-ubuntu-on-??? ==3492== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-3492-by-ubuntu-on-??? ==3492== ==3492== TO CONTROL THIS PROCESS USING vgdb (which you probably ==3492== don't want to do, unless you know exactly what you're doing, ==3492== or are doing some strange experiment): ==3492== /usr/lib/valgrind/../../bin/vgdb --pid=3492 ...command... ==3492== ==3492== TO DEBUG THIS PROCESS USING GDB: start GDB like this ==3492== /path/to/gdb ./a.out ==3492== and then give GDB the following command ==3492== target remote | /usr/lib/valgrind/../../bin/vgdb --pid=3492 ==3492== --pid is optional if only one valgrind process is running ==3492== --3492-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so --3492-- Considering /usr/lib/valgrind/vgpreload_core-amd64-linux.so .. --3492-- .. CRC mismatch (computed 50df1b30 wanted 4800a4cf) --3492-- object doesn't have a symbol table --3492-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so --3492-- Considering /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so .. --3492-- .. CRC mismatch (computed f893b962 wanted 95ee359e) --3492-- object doesn't have a symbol table --3492-- REDIR: 0x402a660 (NONE:free) redirected to 0x4cb3cd0 (free) ==3492== Invalid free() / delete / delete[] / realloc() ==3492== at 0x4CB3D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==3492== by 0x40717F3: ??? (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x1FFF000FAB: ??? ==3492== by 0x1FFF00022F: ??? ==3492== by 0x1FFEFFFE9F: ??? ==3492== by 0x4072D1E: ??? (in /lib/x86_64-linux-musl/libc.so) ==3492== Address 0x4ebe160 is in a rw- mapped file /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so segment ==3492== --3492-- REDIR: 0x4029f10 (NONE:calloc) redirected to 0x4cb4a70 (calloc) Error relocating /usr/lib/valgrind/vgpreload_core-amd64-linux.so: __libc_freeres: symbol not found ==3492== Jump to the invalid address stated on the next line ==3492== at 0x556: ??? ==3492== by 0x406F8B8: _exit (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x1FFF0006FE: ??? ==3492== Address 0x556 is not stack'd, malloc'd or (recently) free'd ==3492== ==3492== ==3492== Process terminating with default action of signal 11 (SIGSEGV) ==3492== Bad permissions for mapped region at address 0x556 ==3492== at 0x556: ??? ==3492== by 0x406F8B8: _exit (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x1FFF0006FE: ??? ==3492== ==3492== HEAP SUMMARY: ==3492== in use at exit: 404 bytes in 1 blocks ==3492== total heap usage: 1 allocs, 1 frees, 404 bytes allocated ==3492== ==3492== Searching for pointers to 1 not-freed blocks ==3492== Checked 32,584 bytes ==3492== ==3492== 404 bytes in 1 blocks are still reachable in loss record 1 of 1 ==3492== at 0x4CB4B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==3492== by 0x40729D9: ??? (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x4073933: __dls3 (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x1FFF0006FE: ??? ==3492== ==3492== LEAK SUMMARY: ==3492== definitely lost: 0 bytes in 0 blocks ==3492== indirectly lost: 0 bytes in 0 blocks ==3492== possibly lost: 0 bytes in 0 blocks ==3492== still reachable: 404 bytes in 1 blocks ==3492== suppressed: 0 bytes in 0 blocks ==3492== ==3492== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) ==3492== ==3492== 1 errors in context 1 of 2: ==3492== Jump to the invalid address stated on the next line ==3492== at 0x556: ??? ==3492== by 0x406F8B8: _exit (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x1FFF0006FE: ??? ==3492== Address 0x556 is not stack'd, malloc'd or (recently) free'd ==3492== ==3492== ==3492== 1 errors in context 2 of 2: ==3492== Invalid free() / delete / delete[] / realloc() ==3492== at 0x4CB3D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==3492== by 0x40717F3: ??? (in /lib/x86_64-linux-musl/libc.so) ==3492== by 0x1FFF000FAB: ??? ==3492== by 0x1FFF00022F: ??? ==3492== by 0x1FFEFFFE9F: ??? ==3492== by 0x4072D1E: ??? (in /lib/x86_64-linux-musl/libc.so) ==3492== Address 0x4ebe160 is in a rw- mapped file /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so segment ==3492== ==3492== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) ``` I am attempting to set up Valgrind to find bugs in musl's environment functions, but I can't even get a basic program to validate. Any ideas for what I need to do next? Versions: ``` ubuntu@primary:~/env_stuff$ /lib/x86_64-linux-musl/libc.so musl libc (x86_64) Version 1.1.19 Dynamic Program Loader Usage: /lib/x86_64-linux-musl/libc.so [options] [--] pathname [args] ubuntu@primary:~/env_stuff$ musl-gcc --version cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ubuntu@primary:~/env_stuff$ valgrind --version valgrind-3.13.0 ```