oracle / dtrace-utils

DTrace-utils contains the DTrace port to Linux
Other
152 stars 20 forks source link

Possible Valgrind issue in `dt_write` #90

Open thesamesam opened 2 months ago

thesamesam commented 2 months ago
$ 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==
nickalcock commented 2 months ago

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...

ezannoni commented 1 month ago

Sam, do you have a way to reproduce this?

thesamesam commented 1 month ago

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