Skip to content

nplb: Derive the denied priority in ErrorOnPermissionDenied - #13105

Merged
sacuff merged 3 commits into
youtube:mainfrom
hferreiro:nplb-setpriority
Oct 8, 2026
Merged

sacuff merged 3 commits into
youtube:mainfrom
hferreiro:nplb-setpriority

Conversation

@hferreiro

Copy link
Copy Markdown
Collaborator

PosixSetPriorityTests.ErrorOnPermissionDenied raises the process priority by one and expects EACCES, assuming any unprivileged raise is denied. An unprivileged process may, however, lower its nice value down to 20 - RLIMIT_NICE. Android grants applications enough of that limit to manage their own thread priorities, so on AOSP the raise succeeded and the test failed.

Try the first priority the kernel actually denies, one below both the current value and the RLIMIT_NICE ceiling.

Also check getpriority on its raw return value in this test and in SetProcessPrioritySuccessfully. Both checked the value after adding or subtracting one, so a failing getpriority (-1) was never reported.

Bug: 532068409

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ✅ PASS All checks passed
CI / android ✅ PASS Passed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ✅ PASS Passed
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


starboard: Fix priority tests for Android

PosixSetPriorityTests.ErrorOnPermissionDenied was failing on AOSP
because unprivileged processes can lower their nice value within the
RLIMIT_NICE limit.

Calculate a priority that is actually denied by checking RLIMIT_NICE
to ensure the test passes on platforms with relaxed priority limits.
Correct getpriority return value checks and enable the test in AOSP
filters.

Bug: 532068409

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request enables the PosixSetPriorityTests.ErrorOnPermissionDenied test on ARM and ARM64 AOSP platforms and updates its implementation to dynamically determine the priority ceiling using getrlimit with RLIMIT_NICE. Feedback on the changes highlights that RLIMIT_NICE is Linux-specific and will cause compilation failures on other POSIX platforms like macOS or FreeBSD, so this logic should be conditionally compiled using #ifdef RLIMIT_NICE.

PosixSetPriorityTests.ErrorOnPermissionDenied raises the process priority by
one and expects EACCES, assuming any unprivileged raise is denied. An
unprivileged process may, however, lower its nice value down to
20 - RLIMIT_NICE. Android grants applications enough of that limit to
manage their own thread priorities, so on AOSP the raise succeeded and the
test failed.

Try the first priority the kernel actually denies, one below both the
current value and the RLIMIT_NICE ceiling.

Also check `getpriority` on its raw return value in this test and in
SetProcessPrioritySuccessfully. Both checked the value after adding or
subtracting one, so a failing `getpriority` (-1) was never reported.

Bug: 532068409
@sacuff
sacuff merged commit 1cfb7b3 into youtube:main Oct 8, 2026
667 of 673 checks passed
@hferreiro
hferreiro deleted the nplb-setpriority branch October 9, 2026 10:18
briantting pushed a commit that referenced this pull request Oct 12, 2026
…missionDenied

Refer to original PR: #13105

PosixSetPriorityTests.ErrorOnPermissionDenied raises the process
priority by one and expects EACCES, assuming any unprivileged raise is
denied. An unprivileged process may, however, lower its nice value down
to 20 - RLIMIT_NICE. Android grants applications enough of that limit to
manage their own thread priorities, so on AOSP the raise succeeded and
the test failed.

Try the first priority the kernel actually denies, one below both the
current value and the RLIMIT_NICE ceiling.

Also check `getpriority` on its raw return value in this test and in
SetProcessPrioritySuccessfully. Both checked the value after adding or
subtracting one, so a failing `getpriority` (-1) was never reported.

Bug: 532068409

(cherry picked from commit 1cfb7b3)
briantting pushed a commit that referenced this pull request Oct 16, 2026
…missionDenied

Refer to original PR: #13105

PosixSetPriorityTests.ErrorOnPermissionDenied raises the process
priority by one and expects EACCES, assuming any unprivileged raise is
denied. An unprivileged process may, however, lower its nice value down
to 20 - RLIMIT_NICE. Android grants applications enough of that limit to
manage their own thread priorities, so on AOSP the raise succeeded and
the test failed.

Try the first priority the kernel actually denies, one below both the
current value and the RLIMIT_NICE ceiling.

Also check `getpriority` on its raw return value in this test and in
SetProcessPrioritySuccessfully. Both checked the value after adding or
subtracting one, so a failing `getpriority` (-1) was never reported.

Bug: 532068409

(cherry picked from commit 1cfb7b3)
briantting pushed a commit that referenced this pull request Oct 16, 2026
…missionDenied

Refer to original PR: #13105

PosixSetPriorityTests.ErrorOnPermissionDenied raises the process
priority by one and expects EACCES, assuming any unprivileged raise is
denied. An unprivileged process may, however, lower its nice value down
to 20 - RLIMIT_NICE. Android grants applications enough of that limit to
manage their own thread priorities, so on AOSP the raise succeeded and
the test failed.

Try the first priority the kernel actually denies, one below both the
current value and the RLIMIT_NICE ceiling.

Also check `getpriority` on its raw return value in this test and in
SetProcessPrioritySuccessfully. Both checked the value after adding or
subtracting one, so a failing `getpriority` (-1) was never reported.

Bug: 532068409

(cherry picked from commit 1cfb7b3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants