Skip to content

Allow setting RLIMIT_MSGQUEUE - #15948

Merged
copybara-service[bot] merged 1 commit into
gvisor:masterfrom
adi-IL:fix-rlimit-msgqueue-setable
Oct 19, 2026
Merged

copybara-service[bot] merged 1 commit into
gvisor:masterfrom
adi-IL:fix-rlimit-msgqueue-setable

Conversation

@adi-IL

@adi-IL adi-IL commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #15944

setrlimit(RLIMIT_MSGQUEUE, ...) returns EPERM even when the new value equals the current one, because limits.MessageQueueBytes is missing from setableLimits in sys_rlimit.go. This adds it, so the limit is accepted and stored but not enforced, the same as Core, ProcessCount and RealTimePriority.

Testing: new RlimitTest.SetRlimitMsgqueue in rlimits.cc reads RLIMIT_MSGQUEUE, sets the same value back, then lowers the soft limit by 1 and reads it back. It fails with EPERM without the change and passes with it under //test/syscalls:rlimits_test_runsc_ptrace.

prlimit64 rejected RLIMIT_MSGQUEUE with EPERM because it was missing
from setableLimits, even when setting the current value. Accept it
without enforcing it, like RLIMIT_CORE and RLIMIT_NPROC.

Fixes gvisor#15944
@manninglucas manninglucas added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Oct 19, 2026
copybara-service Bot pushed a commit that referenced this pull request Oct 19, 2026
Fixes #15944

`setrlimit(RLIMIT_MSGQUEUE, ...)` returns EPERM even when the new value equals the current one, because `limits.MessageQueueBytes` is missing from `setableLimits` in `sys_rlimit.go`. This adds it, so the limit is accepted and stored but not enforced, the same as Core, ProcessCount and RealTimePriority.

Testing: new `RlimitTest.SetRlimitMsgqueue` in `rlimits.cc` reads RLIMIT_MSGQUEUE, sets the same value back, then lowers the soft limit by 1 and reads it back. It fails with EPERM without the change and passes with it under `//test/syscalls:rlimits_test_runsc_ptrace`.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#15948 from adi-IL:fix-rlimit-msgqueue-setable c4fc872
PiperOrigin-RevId: 1002551540
@copybara-service
copybara-service Bot merged commit 33b4e65 into gvisor:master Oct 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull Causes the PR to be imported into Google. Will be removed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setrlimit(RLIMIT_MSGQUEUE) fails with EPERM, even to its current value

2 participants