Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] Fix scheduler test incorrectly guessing user privileges #95562

Merged

Conversation

overmighty
Copy link
Member

@overmighty overmighty commented Jun 14, 2024

Non-root users may be able to set real-time scheduling policies. Don't
expect failure to set real-time scheduling policies based on UID.
Instead, check that if it fails, it is either due to missing privileges,
or unsupported parameters if the scheduling policy is not mandated by
POSIX.

Fixes #95564.

These tests fail on Arch Linux, where setting these scheduling policies
succeeds even when not running as root.
@llvmbot llvmbot added the libc label Jun 14, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 14, 2024

@llvm/pr-subscribers-libc

Author: OverMighty (overmighty)

Changes

These tests fail on Arch Linux, where setting these scheduling policies
succeeds even when not running as root.


Full diff: https://github.com/llvm/llvm-project/pull/95562.diff

1 Files Affected:

  • (modified) libc/test/src/sched/param_and_scheduler_test.cpp (+5-3)
diff --git a/libc/test/src/sched/param_and_scheduler_test.cpp b/libc/test/src/sched/param_and_scheduler_test.cpp
index 8e81f2ed1517f..7cf553f1af525 100644
--- a/libc/test/src/sched/param_and_scheduler_test.cpp
+++ b/libc/test/src/sched/param_and_scheduler_test.cpp
@@ -145,9 +145,11 @@ class SchedTest : public LIBC_NAMESPACE::testing::Test {
   using LlvmLibcSchedTest = SchedTest;                                         \
   TEST_F(LlvmLibcSchedTest, Sched_##policy) { testSched(policy, can_set); }
 
-// Root is required to set these policies.
-LIST_SCHED_TESTS(SCHED_FIFO, LIBC_NAMESPACE::getuid() == 0)
-LIST_SCHED_TESTS(SCHED_RR, LIBC_NAMESPACE::getuid() == 0)
+// Temporarily disabled as these tests are failing on Arch Linux where
+// scheduling policy setting succeeds without running as root.
+// // Root is required to set these policies.
+// LIST_SCHED_TESTS(SCHED_FIFO, LIBC_NAMESPACE::getuid() == 0)
+// LIST_SCHED_TESTS(SCHED_RR, LIBC_NAMESPACE::getuid() == 0)
 
 // No root is required to set these policies.
 LIST_SCHED_TESTS(SCHED_OTHER, true)

Non-root users may be able to set real-time scheduling policies. Don't
expect failure to set real-time scheduling policies based on UID.
Instead, check that if it fails, it is either due to missing privileges,
or unsupported parameters if the scheduling policy is not mandated by
POSIX.
@overmighty overmighty changed the title [libc] Temporarily disable SCHED_FIFO and SCHED_RR tests [libc] Fix scheduler test incorrectly guessing user privileges Jun 17, 2024
@overmighty
Copy link
Member Author

I don't have write access to the repo, could someone merge this for me please?

@jhuber6 jhuber6 merged commit 57778ec into llvm:main Jun 20, 2024
6 checks passed
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
…95562)

Non-root users may be able to set real-time scheduling policies. Don't
expect failure to set real-time scheduling policies based on UID.
Instead, check that if it fails, it is either due to missing privileges,
or unsupported parameters if the scheduling policy is not mandated by
POSIX.

Fixes llvm#95564.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc] SCHED_FIFO and SCHED_RR tests fail on Arch Linux
5 participants