Hi, On Tue, 1 Oct 2019 16:15:51 +0100 Stuart Henderson <s...@spacehopper.org> wrote: > On 2019/10/01 11:13, Kurt Mosiejczuk wrote: >> Unfortunately on my test amd64 box, valgrind still just abort traps on >> launch. >> >> eisenhower$ valgrind >> Abort trap >> eisenhower$ valgrind /bin/ls >> Abort trap >> eisenhower$ valgrind python2.7 >> Abort trap >> eisenhower$ valgrind python3.7 >> Abort trap >> eisenhower$ valgrind /bin/true >> Abort trap >> eisenhower$ > > Not sure about the pythons, but most things in base won't work due to pledge
As far as my test (the log attached), valgrind seems to work with "pledge" but not work with "unveil". Is there any fundamental problem of valgrind to work with "pledge"? * * * % cat a.c #include <unistd.h> #include <stdlib.h> #include <err.h> #include <stdio.h> int main(int argc, char *argv[]) { void *ptr; if (unveil(NULL, NULL) == -1) warn("unveil"); /* must not continue but this is a test */ if (pledge("stdio", NULL) == -1) warn("pledge"); /* must not continue but this is a test */ ptr = malloc(8192); if (ptr == NULL) err(1, "malloc"); printf("ok %p\n", ptr); } % % cc -O0 a.c % % valgrind ./a.out ==13326== Memcheck, a memory error detector ==13326== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==13326== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==13326== Command: ./a.out ==13326== ==13326== Invalid write of size 1 ==13326== at 0x4106F2C: ??? ==13326== by 0x4103968: ??? ==13326== by 0x4102F8E: ??? ==13326== by 0x4103C35: ??? ==13326== Address 0x4005750 is not stack'd, malloc'd or (recently) free'd (snip) ==13326== Use of uninitialised value of size 8 ==13326== at 0x4AA33DA: write (sys/w_write.c:26) ==13326== by 0x4A3D99F: __sflush (stdio/fflush.c:80) ==13326== by 0x4AC03ED: __sbprintf (stdio/vfprintf.c:141) ==13326== by 0x4AC03ED: __vfprintf (stdio/vfprintf.c:468) ==13326== by 0x4AC0241: vfprintf (stdio/vfprintf.c:263) ==13326== by 0x4ACF417: fprintf (stdio/fprintf.c:44) ==13326== by 0x4A8AF31: vwarn (gen/vwarn.c:44) ==13326== by 0x4A4CE9E: warn (gen/warn.c:40) ==13326== by 0x109389: main (in ./a.out) ==13326== a.out: ==13326== Use of uninitialised value of size 8 ==13326== at 0x4AA33EE: write (sys/w_write.c:28) ==13326== by 0x4A3D99F: __sflush (stdio/fflush.c:80) ==13326== by 0x4AC03ED: __sbprintf (stdio/vfprintf.c:141) ==13326== by 0x4AC03ED: __vfprintf (stdio/vfprintf.c:468) ==13326== by 0x4AC0241: vfprintf (stdio/vfprintf.c:263) ==13326== by 0x4ACF417: fprintf (stdio/fprintf.c:44) ==13326== by 0x4A8AF31: vwarn (gen/vwarn.c:44) ==13326== by 0x4A4CE9E: warn (gen/warn.c:40) ==13326== by 0x109389: main (in ./a.out) ==13326== unveil: Undefined error: 0 ok 0x4af7040 ==13326== Use of uninitialised value of size 8 ==13326== at 0x4A7C48C: _thread_finalize (stdlib/atexit.c:131) ==13326== by 0x4A7C48C: __cxa_finalize (stdlib/atexit.c:153) ==13326== by 0x4A60630: exit (stdlib/exit.c:54) ==13326== by 0x109141: ___start (in ./a.out) ==13326== ==13326== ==13326== FILE DESCRIPTORS: 3 open at exit. ==13326== Open file descriptor 2: ==13326== <inherited from parent> ==13326== ==13326== Open file descriptor 1: ==13326== <inherited from parent> ==13326== ==13326== Open file descriptor 0: ==13326== <inherited from parent> ==13326== ==13326== ==13326== HEAP SUMMARY: ==13326== in use at exit: 73,728 bytes in 2 blocks ==13326== total heap usage: 2 allocs, 0 frees, 73,728 bytes allocated ==13326== ==13326== LEAK SUMMARY: ==13326== definitely lost: 8,192 bytes in 1 blocks ==13326== indirectly lost: 0 bytes in 0 blocks ==13326== possibly lost: 0 bytes in 0 blocks ==13326== still reachable: 65,536 bytes in 1 blocks ==13326== suppressed: 0 bytes in 0 blocks ==13326== Rerun with --leak-check=full to see details of leaked memory ==13326== ==13326== For counts of detected and suppressed errors, rerun with: -v ==13326== Use --track-origins=yes to see where uninitialised values come from ==13326== ERROR SUMMARY: 3328 errors from 555 contexts (suppressed: 0 from 0) %