Skip to content

rocprofv3: warn when LD_PRELOAD paths contain spaces - #13695

Open
0x5t4l1n wants to merge 1 commit into
ROCm:developfrom
0x5t4l1n:fix/rocprofv3-ld-preload-space-warning
Open

0x5t4l1n wants to merge 1 commit into
ROCm:developfrom
0x5t4l1n:fix/rocprofv3-ld-preload-space-warning

Conversation

@0x5t4l1n

Copy link
Copy Markdown

Summary

Fixes #13245.

rocprofv3 builds LD_PRELOAD by joining library paths with colons. When the ROCm install directory contains a space (common with pip/venv installs in paths like /home/user/Documents/My research/.venv), glibc's ld.so silently splits the entry at the space, generating four confusing "cannot preload" errors and failing to load the tool library through the preload route.

Fix

Before calling update_env("LD_PRELOAD", ...), check whether any path in prepend_preload or append_preload contains a space. If so, print a clear, actionable warning to stderr that:

  • names each affected path
  • explains why it cannot appear in LD_PRELOAD
  • points users to move the install to a space-free path or use ROCP_TOOL_LIBRARIES as a workaround

Tracing still works today via the ROCP_TOOL_LIBRARIES route (which is unaffected by spaces). The warning ensures users understand the incomplete preload rather than seeing four opaque ld.so errors.

glibc's ld.so(8) splits LD_PRELOAD on whitespace as well as colons and
provides no escaping. When the ROCm install path contains a space (e.g.
a pip venv in '/home/user/Documents/My research/.venv') every LD_PRELOAD
entry is split at the space, generating one 'cannot preload' error per
fragment and silently failing to load the library.

Detect this before calling update_env and print a clear, actionable
warning to stderr listing each affected path. The existing ROCP_TOOL_LIBRARIES
route is unaffected by spaces and continues to deliver the tool library,
so tracing still works today; the warning flags the incomplete preload so
users know to move the venv to a space-free path.

Fixes ROCm#13245

Signed-off-by: 0x5t4l1n <stalin.s@owasp.org>
@0x5t4l1n
0x5t4l1n requested review from a team as code owners October 18, 2026 12:55
Copilot AI balanced review requested due to automatic review settings October 18, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@therock-pr-bot

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocprofiler-sdk/source/bin/rocprofv3.py; no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rocprofiler-sdk] rocprofv3 puts its tool libraries in LD_PRELOAD, which breaks when the ROCm path contains a space (e.g. pip-installed ROCm in a venv)

2 participants