dtrace-utils icon indicating copy to clipboard operation
dtrace-utils copied to clipboard

Possible Valgrind issue in `dt_write`

Open thesamesam opened this issue 1 year ago • 3 comments

$ test/unittest/dtrace-util/tst.ELFGenerationOut.sh /tmp/runtest.10198/bin/dtrace
--149025-- WARNING: unhandled eBPF command 23
==149025== Syscall param write(buf) points to uninitialised byte(s)
==149025==    at 0x4AF38D0: write (write.c:26)
==149025==    by 0x491460B: dt_write (dt_subr.c:497)
==149025==    by 0x48E2286: dump_elf64 (dt_link.c:725)
==149025==    by 0x48E2286: dtrace_program_link (dt_link.c:1615)
==149025==    by 0x10A0E7: link_prog (dtrace.c:408)
==149025==    by 0x10A0E7: main (dtrace.c:1419)
==149025==  Address 0x9390b34 is 260 bytes inside a block of size 683 alloc'd
==149025==    at 0x485032F: calloc (vg_replace_malloc.c:1675)
==149025==    by 0x4914C34: dt_zalloc (dt_subr.c:685)
==149025==    by 0x48AB05C: dt_buf_create (dt_buf.c:30)
==149025==    by 0x48D4245: dtrace_dof_create (dt_dof.c:824)
==149025==    by 0x48DF919: dtrace_program_link (dt_link.c:1570)
==149025==    by 0x10A0E7: link_prog (dtrace.c:408)
==149025==    by 0x10A0E7: main (dtrace.c:1419)
==149025==

thesamesam avatar Aug 25 '24 13:08 thesamesam

Ew! I wonder how this has never showed up for us (we valgrind dtrace routinely). Anything special in your setup?

This strongly suggests that one of the things that get assigned to elf_file in dump_elf64 (and probably the nearly-dead dump_elf32 as well) is itself uninitialized, since the variable itself is memset to 0 so it must be being de-initialized in part to trigger this. The offset should tell us what...

nickalcock avatar Aug 28 '24 16:08 nickalcock

Sam, do you have a way to reproduce this?

ezannoni avatar Oct 11 '24 16:10 ezannoni

@ezannoni I don't but Kris managed to hit the same error as I did (he mentioned it the other day on IRC).

thesamesam avatar Oct 11 '24 17:10 thesamesam