Accept live thread TIDs in priority syscalls#232
Merged
Conversation
doanbaotrung
force-pushed
the
getpriority-PRIO_PROCESS
branch
from
July 20, 2026 06:35
e2836c0 to
4e48ed6
Compare
jserv
reviewed
Jul 21, 2026
doanbaotrung
force-pushed
the
getpriority-PRIO_PROCESS
branch
from
July 21, 2026 01:37
4e48ed6 to
28bb50b
Compare
Linux treats thread IDs as valid PRIO_PROCESS targets because each thread is a task. elfuse only accepted who 0 and the guest process ID, so getpriority(PRIO_PROCESS, tid) returned ESRCH for live guest threads. Add a shared process/TID liveness helper and use it from both scheduler queries and getpriority. Keep setpriority self-only while elfuse stores nice as one process-wide value. This avoids silently accepting a live TID and mutating the nice value reported for every task. Add regression coverage for live thread getpriority, non-self setpriority rejection, and dead thread ESRCH behavior. Fix sysprog21#231
doanbaotrung
force-pushed
the
getpriority-PRIO_PROCESS
branch
from
July 21, 2026 01:38
28bb50b to
41fa2d2
Compare
Collaborator
Author
|
Fixed the review comments. Changed:
|
Contributor
|
Thank @doanbaotrung for contributing! |
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.
Linux treats thread IDs as valid PRIO_PROCESS targets because each thread is a task. elfuse only accepted who 0 and the guest process ID, so getpriority(PRIO_PROCESS, tid) returned ESRCH for live guest threads.
Share PRIO_PROCESS target validation between getpriority and setpriority, accepting live guest TIDs from the thread table.
Add regression coverage for live thread getpriority, live thread setpriority, and dead thread ESRCH behavior.
Fix #231
Summary by cubic
Accept live guest TIDs as PRIO_PROCESS targets in getpriority, matching Linux and avoiding ESRCH for running threads. Add a shared
proc_pid_aliveused by getpriority and sched_* queries; keep setpriority self-only while nice is process-wide; add tests for live TID get, non-self set ESRCH, and dead TID ESRCH. Fixes #231.Written for commit 41fa2d2. Summary will update on new commits.