latency-test, latency-histogram: warn when rtapi_app lacks RT privileges#4107
Open
grandixximo wants to merge 2 commits into
Open
latency-test, latency-histogram: warn when rtapi_app lacks RT privileges#4107grandixximo wants to merge 2 commits into
grandixximo wants to merge 2 commits into
Conversation
Without 'sudo make setuid' (or 'sudo make setcap') rtapi_app runs unprivileged: no SCHED_FIFO, no locked memory, so latency readings are wildly inflated and easy to mistake for a code regression. Warn, for a non-root user, when rtapi_app is neither setuid root nor carries the cap_sys_nice capability. Closes LinuxCNC#4044
77c1e3e to
8274d2d
Compare
Contributor
|
These tests are moot when you run on a non-RT kernel (like I do in dev). I'm not sure the noise is really necessary in that case. |
Only warn under PREEMPT_RT or RTAI; on a non-RT kernel the privileges do not matter, so the check would be noise.
Contributor
Author
|
silenced on non-rt |
Contributor
|
Great. Every little bit helps. Reduces user frustration and more importantly less developer time wasted on spurious issues. |
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.
What
Both latency tools now warn, for a non-root user, when
rtapi_appis neither setuid root nor carrying thecap_sys_nicefile capability. In that state the realtime threads cannot get SCHED_FIFO scheduling or locked memory, so the reported latency is wildly inflated and unrepresentative.Why
In #4044 a run-in-place build was used without
sudo make setuid.rtapi_appran unprivileged, the latency numbers blew up, and this was initially mistaken for a code regression. It was not; the setuid/setcap step had simply been skipped. A plain warning would have saved the back-and-forth. @rodw-au suggested ageteuid()/setuid check in the issue thread.How
A small check runs before the test starts:
rtapi_app; if not found, stay silent.sudo make setuid): silent.cap_sys_nicefile capability present (sudo make setcap): silent.A pure euid check was deliberately avoided: a normal deb install runs the scripts as an unprivileged user yet works fine via setuid-root
rtapi_app, so euid alone would false-warn on every correct install. The real signal is the privilege state ofrtapi_appitself.latency-test(bash) prints to stderr;latency-histogram(tcl) prints to stderr and, in GUI mode, also shows atk_messageBox.Closes #4044