Remove thread_local_options; pass options explicitly#1092
Conversation
Replace thread_local_options reads in array_domain.cpp with explicit parameters: big_endian threaded through load, store, havoc, split_cell, and split_number_var; total_stack_size derived from the ArrayDomain's own BitsetDomain size via a new total_stack_size() accessor. Add BitsetDomain::size() accessor. Update all EbpfTransformer call sites to pass context.options.big_endian. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Elazar Gershuni <elazarg@gmail.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 54 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughRemoves thread-local global state ( Changes
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/test/ebpf_yaml.cpp`:
- Around line 526-541: The comparison between memory_bytes.size() (size_t) and
options.total_stack_size() (int) is a signed/unsigned mismatch; change the guard
to first validate options.total_stack_size() is non-negative, then use a size_t
cast for comparisons and for stack_contents_invariant calls (e.g., use
static_cast<size_t>(options.total_stack_size()) when comparing
memory_bytes.size() and when calling stack_contents_invariant), and if
total_stack_size() is negative return an error early; refer to
memory_bytes.size(), options.total_stack_size(), stack_contents_invariant(), and
pre_invariant to locate the changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: e130a5af-07bc-4572-bb63-32cfc40c1d95
📒 Files selected for processing (18)
src/config.hppsrc/crab/array_domain.cppsrc/crab/array_domain.hppsrc/crab/bitset_domain.hppsrc/crab/ebpf_transformer.cppsrc/fwd_analyzer.cppsrc/ir/cfg_builder.cppsrc/ir/program.hppsrc/main.cppsrc/printing.cppsrc/result.hppsrc/test/ebpf_yaml.cppsrc/test/test_elf_loader.cppsrc/test/test_marshal.cppsrc/test/test_print.cppsrc/test/test_verify.hppsrc/test/test_verify_multithreading.cppsrc/verifier.hpp
💤 Files with no reviewable changes (5)
- src/config.hpp
- src/ir/cfg_builder.cpp
- src/verifier.hpp
- src/fwd_analyzer.cpp
- src/test/test_elf_loader.cpp
Remove the thread_local_options variable, its extern declaration, and all reads. Options now flow explicitly through all paths: - analyze(prog, options) and verify(prog, options) are the entry points - printing functions take print_line_info parameter - cfg_builder no longer sets the thread-local - Test macros and harnesses use local options variables - YAML conformance tests pass options through stack_contents_invariant The analyze(prog)/verify(prog) shims without options are removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Elazar Gershuni <elazarg@gmail.com>
dd4197d to
02f532b
Compare
Summary
big_endianandtotal_stack_sizethrough ArrayDomain methods (load,store,havoc,split_cell,split_number_var) instead of readingthread_local_options. Derivetotal_stack_sizefrom ArrayDomain's ownBitsetDomain::size()analyze(prog, options)andverify(prog, options)overloads; remove the no-options shims that readthread_local_optionsprint_line_infoexplicitly through all print functions (print_program,print_invariants,print_error,print_invariants_filtered,print_failure_slices)thread_local_optionsvariable, extern declaration, and all test harness assignmentsthread_local_optionsusage with local variables or default{}Continues #1091. Together with that PR, this eliminates all semantic thread-local state from the verifier. The only remaining thread-locals are domain-internal caches (
thread_local_array_map,SplitDBM::scratch_) that are per-analysis scratch space, not semantic inputs.Closes #1077.
Test plan
print_failure_slicesnot forwardingprint_line_info— fixed)🤖 Generated with Claude Code