Skip to content

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

Description

@rubenfiszel

Description

setrlimit/prlimit64 with RLIMIT_MSGQUEUE always fails with EPERM under runsc, including when the new limit equals the current one. RLIMIT_MSGQUEUE is not in setableLimits in pkg/sentry/syscalls/linux/sys_rlimit.go, and prlimit64 returns EPERM for any resource missing from that map.

On Linux, an unprivileged process may set any RLIMIT_MSGQUEUE value up to its hard limit.

This breaks sandboxes that set every rlimit before running a program. nsjail is one: with its default configuration it calls setrlimit(RLIMIT_MSGQUEUE, <current soft limit>) and aborts on failure, so no jail can start under runsc unless all rlimits are disabled (--disable_rlimits).

setableLimits already lists limits that are accepted but not enforced (Core, ProcessCount, RealTimePriority, "to avoid returning EPERM, since some apps expect them to succeed"). POSIX message queues are not implemented, so MessageQueueBytes could join that list the same way.

Steps to reproduce

docker run --rm --runtime=runsc python:3-alpine python3 -c '
import resource
r = resource.RLIMIT_MSGQUEUE
cur = resource.getrlimit(r)
print(cur)
resource.setrlimit(r, cur)
print("ok")'
  • Linux (runc): prints (819200, 819200) then ok.
  • runsc release-20261012.0, and master as of 2026-10-18: prints (819200, 819200), then ValueError: not allowed to raise maximum limit. Python reports EPERM from setrlimit that way.

runsc version

runsc version release-20261012.0
spec: 1.2.1

Also reproduced with a nightly build (release-20261012.0-139-g73eaa38549eb).

docker version (if using docker)

Reproduced under containerd 2.2 (k3s 1.35) with RuntimeClass handler runsc, default platform (systrap). The repro above is the docker equivalent.

uname

Linux 6.8.0 x86_64 (host)

Possible fix

Add limits.MessageQueueBytes to setableLimits next to the other accepted-but-not-enforced limits. Enforcing it is unnecessary while mq_open is unimplemented.

Activity

  1. added 2 commits that reference this issue on Oct 19, 2026
    74844b4
    c4fc872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions