Fix CloudXR runtime crash from OpenSSL symbol conflict#254
Conversation
📝 WalkthroughWalkthroughThese changes implement conditional library dependency stripping and symbol binding behavior for CloudXR. A new build-time patchelf integration removes the libssl.so.3 dependency from libcloudxr.so when available, while runtime library loading uses RTLD_DEEPBIND flag mode when supported by the platform. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/core/cloudxr/python/CMakeLists.txt`:
- Around line 87-94: The patchelf target (cloudxr_patchelf using
PATCHELF_EXECUTABLE on "${CLOUDXR_NATIVE_DIR}/libcloudxr.so") must be guarded by
a symbol check: after extracting the SDK tarball (respecting
CXR_RUNTIME_SDK_VERSION) run readelf -d on libcloudxr.so to confirm libssl.so.3
is in DT_NEEDED, then run readelf -Ws (or equivalent) to search undefined symbol
names for OpenSSL prefixes (e.g. SSL_, EVP_, TLS_, BIO_, X509_); only execute
patchelf --remove-needed libssl.so.3 if libssl.so.3 is needed and no OpenSSL
symbols are referenced, otherwise fail the build with a clear error message
instructing to remove the workaround or update the SDK; implement this logic in
the cloudxr_patchelf custom target (or a helper custom command) so
add_dependencies(cloudxr_patchelf cloudxr_native_bundle) remains correct.
In `@src/core/cloudxr/python/runtime.py`:
- Around line 193-194: Consolidate libcloudxr.so loading by extracting the
ctypes.CDLL call into a single helper (e.g., _load_libcloudxr or
load_libcloudxr) and replace direct ctypes.CDLL usages in both run() and
runtime_version() with that helper; ensure the helper accepts/uses RTLD_DEEPBIND
(using getattr(os, "RTLD_DEEPBIND", 0)) as the mode and returns the loaded
library so both run() and runtime_version() get the same symbol-resolution
behavior consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 53f5927c-8627-4941-ac90-d9a31cfa7a2c
📒 Files selected for processing (2)
src/core/cloudxr/python/CMakeLists.txtsrc/core/cloudxr/python/runtime.py
* Revert "Promote run_cloudxr_via_wheel.sh to run_cloudxr.sh" This reverts commit 882ae3b. * Add Kitmaker integration (#172) * Revert "Rename run_cloudxr.sh to run_cloudxr_via_docker.sh" This reverts commit ae0d9b6. * Revert "Revert "Rename run_cloudxr.sh to run_cloudxr_via_docker.sh"" This reverts commit 706d746. * Revert "Revert "Promote run_cloudxr_via_wheel.sh to run_cloudxr.sh"" This reverts commit c32b91d. * WIP test --------- Co-authored-by: Jiwen Cai <jiwenc@nvidia.com> Co-authored-by: Andrei Aristarkhov <aaristarkhov@nvidia.com>
Load libcloudxr.so with RTLD_DEEPBIND so NVST resolves OpenSSL symbols from its own scope instead of picking up Python's incompatible libssl.so.3 from the global scope.
Add a patchelf build step to strip the spurious libssl.so.3 NEEDED entry from libcloudxr.so after extracting the SDK tarball, since the library never calls any OpenSSL functions directly.
Summary by CodeRabbit
Bug Fixes
Chores