Repository navigation
fix(jvm): support async-profiler for non-root JVMs - #166
Merged
Merged
Conversation
Pre-create each output with the JVM filesystem identity inside a root-owned, unpredictable directory, then publish through the held descriptor. Run asprof from the agent image and stage only its library in the target so workloads cannot replace code executed by the agent.
Run the integration binary from the agent image with the host PID namespace against a non-root JVM using default and read-only root filesystems. Verify library staging permissions, flamegraph and JFR output, and the failure mode when the output file is not pre-created.
mifisignal
force-pushed
the
fix/160-nonroot-output
branch
from
September 15, 2026 15:36
b5b9ae0 to
0a74b2b
Compare
|
Owner
|
Hi @mifisignal Thanks for your contribution! |
josepdcs
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
Async-profiler cannot create its output when the target JVM runs as a non-root user because the shared output directory is root-owned. This causes profiling to finish without producing a usable result.
Fixes #160.
What changed
Pre-create each result file with the target JVM's filesystem identity inside a root-owned, unpredictable directory under the target's
/tmp. The agent retains an open descriptor for publishing, preventing the workload from redirecting the privileged read.Run
asproffrom the agent image and stage onlylibasyncProfiler.soinside the target container. This keeps agent-executed code outside the workload's control and supports targets with read-only root filesystems when/tmpis writable.Add integration coverage using a real non-root JVM for:
Validation
go test ./internal/agent/profiler/jvm/...git diff --check main...HEAD