Repository navigation
test(relay): inject a refused io_uring ring so startup is tested on every kernel - #8641
Conversation
…mlock-charging ones Linux 6.14 began charging io_uring SQ/CQ and provided-buffer rings to RLIMIT_MEMLOCK, a regression that 7.3 reverted (and stable backported), so the memlock test started succeeding on fixed kernels. Inject ENOMEM into io_uring_setup with a seccomp filter instead, and stop claiming every kernel charges rings to memlock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the net change through e9d1825: the test now injects the ring refusal itself, and two code comments limit the memlock claim to the affected kernels. e9d1825 moved the error message and docs wording to a follow-up PR.
- Refused-ring test:
uring_startup_reports_a_refused_ringruns in an isolated child process. That child installs a seccomp filter (PR_SET_NO_NEW_PRIVS+SECCOMP_FILTER_FLAG_TSYNC) that makesio_uring_setupreturnENOMEM, so the test no longer depends on kernel accounting orCAP_IPC_LOCK. The filter goes in after thesupported()probe andRelay::load, so only the relay's worker startup sees the refusal. The test's expected substrings (RLIMIT_MEMLOCK,ulimit -l,LimitMEMLOCK=) all still appear in the unchangedError::ringmessage. - Comments only: the
Error::ringdoc comment and thePRODUCTION_CQ_ENTRIEScomment inworker.rsnow say only Linux 6.14 up to the 7.3 fix charges rings toRLIMIT_MEMLOCK.
ℹ️ The PR description still describes the reverted changes
Since e9d1825, the PR no longer changes the Error::ring ENOMEM message, moq-uring/README.md, doc/bin/relay/config.md or moq-relay.service. The Approach, Validation (the quoted waiter message) and Impact sections still say it does. Update them before merge so the squash commit matches the change.
claude-opus-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughThe integration test replaces memlock exhaustion and a capability check with a synchronized seccomp filter that returns ENOMEM for io_uring_setup. It checks that relay readiness fails. Documentation now distinguishes shared RLIMIT_MEMLOCK accounting on Linux 6.14 through the 7.3 fix, including stable backports, from memory-cgroup accounting on other kernels. Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Problem
moq-relay'sruntime_uring::uring_startup_reports_the_memlock_limitfails deterministically on Linux 7.3, including the fedora self-hosted CI runners. That breaksmain's merge gate whenever the queue lands on one of those runners. The test setsRLIMIT_MEMLOCKto 0 and expects worker startup to fail, but on 7.3 startup succeeds.Root cause: Linux 6.14 moved the SQ/CQ rings and provided-buffer rings onto the region API, which charged them to
RLIMIT_MEMLOCK. That was a regression: the rings had been memcg-accounted since 5.12. Linux 7.3 reverted it in torvalds/linux@b59cabf9b4ac ("do not charge the SQ/CQ rings to RLIMIT_MEMLOCK") and torvalds/linux@cde56daf4b93 (same for provided-buffer rings). Both are taggedCc: stable. The test's premise only holds on 6.14–7.2 kernels without the backport.The relay's contract is still right: a ring refused at startup reaches the
Readywaiter as an actionable error, andrunfails. What was wrong is the claim, inmoq_uring::Error::ring, the CQ sizing comment, and the docs, that the kernel always charges rings to memlock.This does the work of the follow-up quest
quest/m0/test-flakes-2/uring-memlock.mdthat moq-dev/moq#8546 adds, so that follow-up can be dropped from #8546.Approach
uring_startup_reports_a_refused_ring): in its isolated child process, a seccomp filter makesio_uring_setupreturnENOMEM. A spent memory cgroup or a memlock-charging kernel refuses a ring the same way. The test still asserts that the error names the worker,RLIMIT_MEMLOCK,ulimit -landLimitMEMLOCK=(all present in the message onmain), and thatrunfails. It now runs on every kernel and under root, so theCAP_IPC_LOCKskip is gone.Error::ring's doc comment and the CQ sizing comment inworker.rsnow name the kernel range that charges memlock.ENOMEMmessage text and the user-facing docs (moq-uring/README.md,doc/bin/relay/config.md,moq-relay.service) make the same wrong claim. They move to a follow-up PR, moq-dev/moq#8642, so this behavior-preserving gate fix can land on its own.Decision I made without the user (recommendation taken):
Validation
RLIMIT_MEMLOCK=0, then sets up a 256/2048 ring, registers a 4096-entry provided-buffer ring, and registers a 1 MiB fixed buffer:ENOMEM.ENOMEM.io_create_region(NULL, …)for rings and buffer rings in v7.3, andctx->userin v6.18 and v7.0–v7.2.--features io-uring. The new test passes undercargo testand nextest.expect_err, so it isn't vacuous.failed to start the io_uring QUIC workers: io_uring worker 0 failed to start: io_uring setup failed: io error: Cannot allocate memory (os error 12): …RLIMIT_MEMLOCK….just checkpasses.Impact
Alternatives
EMFILEviaRLIMIT_NOFILE: depends on how many fds the process already has open, and wouldn't exercise theENOMEMmessage path.Follow-ups
ENOMEMmessage and the docs to name the affected kernel range.Caused by
No single PR: an upstream kernel change. moq-dev/moq#7593 wrote the test and moq-dev/moq#4167 the memlock wording, both against 6.14–7.2's memlock charge, which the kernel later reverted as a regression.
Waiting
Nothing.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: e9d1825
Base: origin/main at 6aa4f9c
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1d51f-57d7-7e02-9afa-6a69fa26daa9, round 1Score: 9/10,
Source review found no actionable defects, but runtime validation remains because builds and tests were not run as instructed.Rounds: 2; findings 0: fixed 0, refuted 0, open 0
Findings: none