Enable Full PerfSpect Functionality by Removing --noroot Flag - #44
Open
artursarlo wants to merge 2 commits into
Open
Enable Full PerfSpect Functionality by Removing --noroot Flag#44artursarlo wants to merge 2 commits into
--noroot Flag#44artursarlo wants to merge 2 commits into
Conversation
| ld_paths = env['LD_LIBRARY_PATH'].split(':') | ||
| # Filter out paths that contain _MEI (PyInstaller temp directories) | ||
| cleaned_paths = [p for p in ld_paths if '_MEI' not in p] | ||
| if cleaned_paths: |
There was a problem hiding this comment.
how are we sure that this change in env['LD_LIBRARY_PATH'] wont cause the regression
| @@ -91,10 +91,21 @@ def start(self) -> None: | |||
| str(self._perfspect_duration), | |||
| "--output", | |||
| PERFSPECT_DATA_DIRECTORY, | |||
There was a problem hiding this comment.
perfspect ran perfectly with --noroot. What new capabilities are enabled when running as root. Giving root access to run perfspect incurs security risk
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.
Enable Full PerfSpect Functionality by Removing
--norootFlagMotivation
PerfSpect was previously run with the
--norootflag, which disables some expected functionalities and limits hardware metrics collection capabilities. This PR removes the--norootflag and instead configures the containerized environment with the dependencies PerfSpect requires to run with full functionality.Problem
When running PerfSpect without the
--norootflag in a PyInstaller-packaged gProfiler container, two issues prevented successful execution:sudoandbashby default, which PerfSpect requireslibz.so.1) and setsLD_LIBRARY_PATHto find them. When PerfSpect runssudo perf, sudo inherits this environment and attempts to load the glibc version oflibz.so.1instead of Alpine's musl version, causing a symbol mismatch error:Solution
1. Install Required Dependencies in Container (
container.Dockerfile)RUN apk add --no-cache sudo bashsudo: Required by PerfSpect to run perf commands with elevated privilegesbash: Required by PerfSpect's internal scripts (Alpine usesashby default)2. Clean PyInstaller Environment Variables (
gprofiler/hw_metrics.py)Filter out PyInstaller's temporary library paths from
LD_LIBRARY_PATHbefore spawning PerfSpect:This ensures sudo loads the correct system libraries compatible with Alpine's musl libc.
3. Fix PyInstaller Hidden Imports (
pyinstaller.spec)Added missing hidden imports that PyInstaller wasn't detecting automatically:
These are dependencies of
pkg_resources/setuptoolsthat were causing runtime import errors.Changes
container.Dockerfile: Installsudoandbashpackagesgprofiler/hw_metrics.py: Remove--norootflag and addLD_LIBRARY_PATHcleaningpyinstaller.spec: Add hidden imports forbackportsandjaracomodulesBenefits
--norootlimitations)Testing
--noroot