Skip to content

feat: skip SQPOLL when rootless container detected (SQP-LAND.4) - #5559

Merged
oferchen merged 4 commits into
feat/sqp-land-3-detect-rootlessfrom
feat/sqp-land-4-wire-rootless-detection
Jun 10, 2026
Merged

oferchen merged 4 commits into
feat/sqp-land-3-detect-rootlessfrom
feat/sqp-land-4-wire-rootless-detection

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Wires fast_io::container::detect_rootless_container (from SQP-LAND.3) into IoUringConfig::build_ring so SQPOLL is declined before the doomed io_uring_setup(IORING_SETUP_SQPOLL) syscall is issued inside a rootless container.
  • Inside a rootless Podman / Docker container, CAP_SYS_NICE is structurally unavailable. SQPOLL setup always returns EPERM, so the current behaviour wastes a guaranteed-failing syscall on every ring construction and only sets SQPOLL_FALLBACK after the kernel rejects the request. The detection signal lets us short-circuit cleanly, log a context-rich diagnostic citing the detector, and downgrade to a standard ring.
  • Linux backend delegates the decision to a small pure helper rootless_container_disables_sqpoll_inner so unit tests can pump the detector outcome without root, mock filesystems, or actual containers. On non-Linux targets the gate is a constant false.
  • The fallback path is unchanged: still graceful (logged at the Io debug flag), still surfaced via SQPOLL_FALLBACK for --version, and still funnels into the existing standard-ring constructor.

Important

Prereq. This PR is stacked on feat/sqp-land-3-detect-rootless (PR #5554) because crate::container::detect_rootless_container ships there. Once #5554 lands on master, re-target this PR's base to master (GitHub auto-rebases the diff).

Audit: docs/audits/sqpoll-rootless-detection-status.md (SQP-LAND.1, PR #5548).
Prereq helper: SQP-LAND.3 (PR #5554).

Test plan

  • Three new unit tests cover the rootless gate via the injectable inner helper:
    • detector returns true -> gate trips, SQPOLL_FALLBACK is set, sqpoll_requested is neutralised.
    • detector returns false -> gate does not trip, SQPOLL request reaches the builder, SQPOLL_FALLBACK stays clear.
    • sqpoll_requested == false -> detector is never called (zero /proc/self/uid_map probes when there is nothing to disable).
  • No public API change. The thin rootless_container_disables_sqpoll wrapper and its inner helper are crate-private.
  • No call-site changes outside build_ring.
  • CI - fmt+clippy, nextest (stable), Windows, macOS, Linux musl.

Wire `fast_io::container::detect_rootless_container` (SQP-LAND.3) into
`IoUringConfig::build_ring` so SQPOLL is declined before the doomed
`io_uring_setup(IORING_SETUP_SQPOLL)` syscall is issued inside a rootless
container.

Inside a rootless Podman / Docker container, `CAP_SYS_NICE` is
structurally unavailable. SQPOLL setup always returns `EPERM`, so the
current behaviour wastes a guaranteed-failing syscall on every ring
construction and only sets `SQPOLL_FALLBACK` after the kernel rejects
the request. The detection signal lets us short-circuit cleanly, log a
context-rich diagnostic citing the detector, and downgrade to a
standard ring.

The Linux backend now delegates the decision to a small pure helper
`rootless_container_disables_sqpoll_inner` so unit tests can pump the
detector outcome without root, mock filesystems, or actual containers.
On non-Linux targets the gate is a constant `false` because SQPOLL is
Linux-only.

The fallback path is unchanged: still graceful (logged at the `Io`
debug flag), still surfaced via `SQPOLL_FALLBACK` for `--version`, and
still funnels into the existing standard-ring constructor.

Audit: docs/audits/sqpoll-rootless-detection-status.md (SQP-LAND.1).
Prereq helper: SQP-LAND.3.
@github-actions github-actions Bot added the enhancement New feature or request label Jun 10, 2026
oferchen added 3 commits June 10, 2026 15:32
Mirrors the SQP-LAND.3 base fix: is_identity_uid_map now treats an empty /proc/self/uid_map as no-signal and lets probe_with_reader fall through to the marker-file probes instead of falsely reporting a user namespace.
@oferchen
oferchen merged commit e1df8d0 into feat/sqp-land-3-detect-rootless Jun 10, 2026
69 checks passed
@oferchen
oferchen deleted the feat/sqp-land-4-wire-rootless-detection branch June 11, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant