Skip to content

fix(RVC4): run the GPU paths in the ASan/UBSan firmware - #2349

Open
aljazkonec1 wants to merge 1 commit into
developfrom
fix/rvc4-asan-gpu-deepbind
Open

aljazkonec1 wants to merge 1 commit into
developfrom
fix/rvc4-asan-gpu-deepbind

Conversation

@aljazkonec1

@aljazkonec1 aljazkonec1 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fix the RVC4 ASan/UBSan firmware crash on every GPU path (Weekly ASan linux_rvc4_test: 64 of 191 failed, 63 "FW crashed", job on GPU testbed slo6361-4pro).
Root cause: the Adreno OpenCL driver loads libllvm-qcom.so with RTLD_DEEPBIND, and the ASan runtime stops the process on that flag; the ASan build now exports a dlopen that removes the flag and calls the ASan interceptor.
Earlier ASan weeklies passed only because their testbeds had no GPU ("Skipping GPUStereo test: GPU not available", 11-28 job); the vanilla job of the same run passed on a GPU board (job).
Before (CI ASan fwp of 2d0d4c5, OAK4 with Adreno 740): GPU ImageManip and GPUStereo crash with "You are trying to dlopen a libllvm-qcom.so shared library with RTLD_DEEPBIND flag which is incompatible with sanitizer runtime".
After (ASan fwp of this branch, same board): GPU ImageManip 20/20 frames, GPUStereo (port of gpu_stereo_device_test) 10/10, examples gpu_stereo, image_manip_resize, image_manip_remap, camera_undistortion run 40 s with no crash and no sanitizer report.
Only the DEPTHAI_ASAN_UBSAN firmware build changes; the release firmware and the host library are the same.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility for RVC4 builds using AddressSanitizer and UndefinedBehaviorSanitizer when loading shared libraries. Existing sanitizer settings and ThreadSanitizer behavior are unchanged.

The ASan runtime stops the process when a library is loaded with
RTLD_DEEPBIND. The Adreno OpenCL driver loads libllvm-qcom.so this way when
it builds a kernel, so on devices with a GPU the rvc4-asan-ubsan firmware
aborted in each GPU path (ImageManip GPU backend, GPUStereo, camera
undistortion, PointCloud, RGBD).

The ASan build exports a dlopen from the executable that removes the flag
and calls the next dlopen (the ASan interceptor). Other builds do not
change.
@aljazkonec1 aljazkonec1 added testable Trigger PR testing, latest python build, and Core CI/CD No impact The PR has low to no impact on the repo. Used when updating dependencies, resolving build issues etc labels Dec 2, 2026
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The RVC4 ASan/UBSan build now includes and exports a dlopen wrapper. The wrapper clears RTLD_DEEPBIND from the flags before forwarding the call.

Changes: RVC4 sanitizer handling

Layer / File(s) Summary
Sanitizer dlopen interception
device/rvc4/CMakeLists.txt, device/rvc4/src/utilities/SanitizerDlopen.cpp
The ASan/UBSan build compiles the wrapper and exports dlopen. The wrapper resolves the next dlopen, clears RTLD_DEEPBIND, and forwards the filename and modified flags.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: pheec, aljazdu

Merge Risk: Minimal · up to e7854

The change only affects the sanitizer-instrumented RVC4 firmware build, where it removes a flag that the ASan runtime rejects. Release firmware is unchanged, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(RVC4): run the GPU paths in the ASan/UBSan firmware" names the main change. The objectives say the PR fixes RVC4 ASan/UBSan firmware crashes on GPU paths by exporting a dlopen wrapper t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(RVC4): run the GPU paths in the ASan/UBSan firmware" names the main change. The objectives say the PR fixes RVC4 ASan/UBSan firmware crashes on GPU paths by exporting a dlopen wrapper that strips RTLD_DEEPBIND. The title is specific and matches the changeset's primary intent. It describes the outcome (GPU paths running under ASan/UBSan) rather than the mechanism (the dlopen wrapper), which is acceptable because the title still covers the main point.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

A rabbit sees the flags go by
One deep bind removed from view
The next dlopen gets the call
The sanitizer builds it too
I nibble clover, pleased and true

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e27963b1-6189-487a-9f91-4f0c06da38fa
Commits

Reviewing files that changed from the base of the PR and between 4d2642c and e78549c.

Files selected for processing: 2

  • device/rvc4/CMakeLists.txt
  • device/rvc4/src/utilities/SanitizerDlopen.cpp

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Recent review details

Context from checks skipped due to timeout: 10

  • GitHub Check: rvc4-fwp / reuse-or-build
  • GitHub Check: style
  • GitHub Check: consistency
  • GitHub Check: Required Python CI report
  • GitHub Check: Required Core CI report
  • GitHub Check: Run HIL tests (open Details)
  • GitHub Check: precheck
  • GitHub Check: Run Linux PR HIL tests / rvc4-fwp / reuse-or-build
  • GitHub Check: Comment lint
  • GitHub Check: precheck
Additional context used

Code guidelines: 1

AGENTS.md — auto-discovered
Path-based instructions: 1

Source excerpt: This repository is public.

CodeRabbit inference engine (AGENTS.md)

Files:

  • device/rvc4/CMakeLists.txt
  • device/rvc4/src/utilities/SanitizerDlopen.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No impact The PR has low to no impact on the repo. Used when updating dependencies, resolving build issues etc testable Trigger PR testing, latest python build, and Core CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant