oracle / oracle/dtrace

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

Open
#88 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
189
Forks
23
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at libdtrace/dt_btf.c:643 and follow the dt_btf_add_to_ctf callers shown in the UBSAN stack trace, especially lines 510, 750, and 802. Reproduce with the reported UBSAN_OPTIONS and sanitizer-enabled make command, then verify that the triggering test-generation build completes without the non-positive variable-length-array diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.