Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBSAN: libdtrace/dt_btf.c:643:12: runtime error: variable length array bound evaluates to non-positive value 0 #88

Open
thesamesam opened this issue Aug 25, 2024 · 1 comment

Comments

@thesamesam
Copy link

thesamesam commented Aug 25, 2024

Noticed when looking into something else acting up, decided to try build w/ UBSAN:

$ export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1"
$ make CFLAGS="-O2 -fsanitize=undefined -ggdb3" LDFLAGS="-fsanitize=undefined" verbose=yes -j1
[...]
$ make
/home/sam/git/dtrace-utils-bad/build/run-dtrace -h -o test/triggers//usdt-tst-argmap-prov.h -x nolibs -s test/triggers/usdt-tst-argmap-prov.d
libdtrace/dt_btf.c:643:12: runtime error: variable length array bound evaluates to non-positive value 0
    #0 0x7f846ef263cb in dt_btf_add_to_ctf libdtrace/dt_btf.c:643
    #1 0x7f846ef4a619 in dt_btf_add_to_ctf libdtrace/dt_btf.c:510
    #2 0x7f846ef4c368 in dt_btf_to_ctf libdtrace/dt_btf.c:750
    #3 0x7f846ef4c8e4 in dt_btf_module_ctf libdtrace/dt_btf.c:802
    #4 0x7f846effdb11 in dt_kern_module_ctf_from_btf libdtrace/dt_module.c:848
    #5 0x7f846f00449f in dt_kern_module_find_ctf libdtrace/dt_module.c:959
    #6 0x7f846f00449f in dt_module_load libdtrace/dt_module.c:403
    #7 0x7f846f008012 in dt_module_getctf libdtrace/dt_module.c:546
    #8 0x7f846f00b692 in dtrace_lookup_by_type libdtrace/dt_module.c:1866
    #9 0x7f846f0180fd in dt_type_lookup libdtrace/dt_parser.c:217
    #10 0x7f846efdc62c in id_or_type libdtrace/dt_lex.l:890
    #11 0x7f846efbf64c in yyparse libdtrace/dt_grammar.c:1585
    #12 0x7f846ef54a8c in dt_compile libdtrace/dt_cc.c:683
    #13 0x7f846ef59b4b in dt_program_compile libdtrace/dt_cc.c:1436
    #14 0x7f846ef59b4b in dtrace_program_fcompile libdtrace/dt_cc.c:1458
    #15 0x563d66c53c8f in compile_file cmd/dtrace.c:478
    #16 0x563d66c4d3ad in main cmd/dtrace.c:1351
    #17 0x7f846e43d834  (/usr/lib64/libc.so.6+0x26834)
    #18 0x7f846e43d8e7 in __libc_start_main (/usr/lib64/libc.so.6+0x268e7)
    #19 0x563d66c505c4 in _start (/home/sam/git/dtrace-utils-bad/build/dtrace+0xc5c4)
@thesamesam thesamesam changed the title libdtrace/dt_btf.c:643:12: runtime error: variable length array bound evaluates to non-positive value 0 UBSAN: libdtrace/dt_btf.c:643:12: runtime error: variable length array bound evaluates to non-positive value 0 Aug 25, 2024
@thesamesam
Copy link
Author

The same command throws with export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=0":

libdtrace/dt_subr.c:119:3: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x7f2b33d2c2da in dtrace_xstr2desc libdtrace/dt_subr.c:119
    #1 0x7f2b33e5ebe9 in dt_probe_lookup2 libdtrace/dt_probe.c:203
    #2 0x7f2b33e281a3 in dt_cook_provider libdtrace/dt_parser.c:4742
    #3 0x7f2b33e21829 in dt_node_cook libdtrace/dt_parser.c:4813
    #4 0x7f2b33d55afc in dt_compile libdtrace/dt_cc.c:739
    #5 0x7f2b33d59b4b in dt_program_compile libdtrace/dt_cc.c:1436
    #6 0x7f2b33d59b4b in dtrace_program_fcompile libdtrace/dt_cc.c:1458
    #7 0x5622e7c22c8f in compile_file cmd/dtrace.c:478
    #8 0x5622e7c1c3ad in main cmd/dtrace.c:1351
    #9 0x7f2b3323d834  (/usr/lib64/libc.so.6+0x26834)
    #10 0x7f2b3323d8e7 in __libc_start_main (/usr/lib64/libc.so.6+0x268e7)
    #11 0x5622e7c1f5c4 in _start (/home/sam/git/dtrace-utils-bad/build/dtrace+0xc5c4)

libdtrace/dt_subr.c:120:3: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x7f2b33d2c243 in dtrace_xstr2desc libdtrace/dt_subr.c:120
    #1 0x7f2b33e5ebe9 in dt_probe_lookup2 libdtrace/dt_probe.c:203
    #2 0x7f2b33e281a3 in dt_cook_provider libdtrace/dt_parser.c:4742
    #3 0x7f2b33e21829 in dt_node_cook libdtrace/dt_parser.c:4813
    #4 0x7f2b33d55afc in dt_compile libdtrace/dt_cc.c:739
    #5 0x7f2b33d59b4b in dt_program_compile libdtrace/dt_cc.c:1436
    #6 0x7f2b33d59b4b in dtrace_program_fcompile libdtrace/dt_cc.c:1458
    #7 0x5622e7c22c8f in compile_file cmd/dtrace.c:478
    #8 0x5622e7c1c3ad in main cmd/dtrace.c:1351
    #9 0x7f2b3323d834  (/usr/lib64/libc.so.6+0x26834)
    #10 0x7f2b3323d8e7 in __libc_start_main (/usr/lib64/libc.so.6+0x268e7)
    #11 0x5622e7c1f5c4 in _start (/home/sam/git/dtrace-utils-bad/build/dtrace+0xc5c4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant