[PR #6352] [MERGED] refactor(process): share paired prlimit ceiling ownership #7299

Closed
opened 2026-11-01 21:46:51 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6352
Author: @morluto
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @morluto

Base: main ← Head: cursor/resource-limit-ownership-78f5


📝 Commits (3)

  • 5634d9f refactor(process): share paired prlimit ceiling ownership
  • 3909888 test(pcap): admit capture limits without host prlimit
  • 4b79c10 style(pcap): format the capture ceiling test

📊 Changes

12 files changed (+222 additions, -46 deletions)

View changed files

📝 scripts/verify/architecture-guards.mjs (+37 -11)
📝 src/firmware/FirmwareCommand.ts (+11 -7)
📝 src/firmware/FirmwareRelease.ts (+3 -1)
📝 src/javascript/recovery/WakaruCommand.test.ts (+47 -0)
📝 src/javascript/recovery/WakaruCommand.ts (+9 -6)
📝 src/javascript/recovery/WakaruRelease.ts (+4 -1)
➕ src/pcap/PcapNativeBound.test.ts (+66 -0)
📝 src/pcap/PcapNativeBound.ts (+13 -11)
📝 src/process/LinuxResourceLimits.test.ts (+9 -3)
📝 src/process/LinuxResourceLimits.ts (+11 -4)
📝 tests/boundary/firmware/firmwareIntegration.test.ts (+6 -1)
📝 tests/process-global/firmwarePublicationDeadline.test.ts (+6 -1)

📄 Description

Summary

Paired Linux prlimit ceilings now come from prlimitArgumentVector and prlimitCeilingArguments in src/process/LinuxResourceLimits.ts. Firmware, Wakaru, and pcap stop spelling those options inline. Byte and CPU budgets are unchanged.

The capture-ceiling test uses a temporary executable, so it does not require /usr/bin/prlimit.

Problem and expected behavior

Architecture guards already required one owner for paired soft and hard ceilings, but the census only matched the --core=0:0 spelling. Firmware and Wakaru passed a bare value (--cpu=120, --core=0). util-linux 2.39.3 treats a bare value as both soft and hard, the same as soft:hard when the numbers are equal. Pcap spelled the paired form itself, including 1024 ** 3 and 64 * 1024 ** 2 for the same 1 GiB and 64 MiB ceilings as BOUNDED_PRODUCER_LIMITS.

Those producers now call the shared owner. Enforced ceilings stay the same numbers.

Change and scope

  • prlimitArgumentVector is built from prlimitCeilingArguments, the command-less prefix. Pcap uses the prefix because PcapCommand appends the producer command. Its CPU ceiling stays 300 seconds.
  • Firmware and Wakaru call prlimitArgumentVector with their existing file-size and 120-second CPU budgets. Their 1 GiB address space is BOUNDED_PRODUCER_LIMITS.address_space_bytes.
  • The architecture guard now rejects a bare --core=0 and allowlists only the EVMole soft-only form (--core=0:), which leaves the inherited hard ceiling in place. EVMole budgets stay 3 GiB address space, 16 MiB file, and 30 CPU seconds. selectEvmWorkerLimits stays a separate selector because it returns Result, checks units, and rejects a soft limit above its hard limit.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/process/LinuxResourceLimits.ts owns paired prlimit options and the shared 1 GiB address-space and 64 MiB file ceilings. The change is at producer admission, before the owned command is spawned.
  • Contribution scope fit and linked maintainer decision: not applicable. This consolidates existing limiter arguments inside current provider boundaries. No new provider, target execution, injection, mutation, or protection recovery.
  • CLI and MCP/tool-catalog contract: none. Public budgets and tool descriptions are unchanged.
  • Provider, bridge, target-format, or platform compatibility: Firmware and Wakaru argv now uses explicit soft:hard (--cpu=120:120, --core=0:0) instead of a bare value. On util-linux 2.39.3 those forms set the same soft and hard numbers. Pcap's emitted vector is unchanged aside from taking it from the shared helper. EVMole stays soft-only.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. No target selection or cleanup change.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: LinuxResourceLimits.test.ts locks the ceiling prefix. PcapNativeBound.test.ts locks the 1 GiB Windows job ceiling and the 300-second capture vector against a temporary executable. WakaruCommand.test.ts locks the shared vector. Firmware launch assertions expect the paired spelling.
  • Base reproduction or other evidence: On this host, prlimit from util-linux 2.39.3 set identical soft and hard rows for --cpu=5 --core=0 --as=1073741824 --fsize=4096 and the N:N form. --cpu=5: left the hard limits unlimited. That measurement is why firmware and Wakaru moved, and why EVMole did not.
  • User-visible CLI/MCP output (if applicable): none. Budgets reported to callers stay the same numbers.
  • Remaining proof gaps: real Binwalk, Unblob, Wakaru, and TShark runs were not executed. Equivalence is from prlimit itself plus unit and fixture launch assertions.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • node scripts/verify/architecture-guards.mjs — passed across 1875 source files (on 5634d9fd).
  • npm run test:local -- src/process/LinuxResourceLimits.test.ts src/pcap/PcapNativeBound.test.ts src/javascript/recovery/WakaruCommand.test.ts — 3 files, 21 tests passed (on 5634d9fd).
  • npm run test:focused -- tests/boundary/firmware/firmwareIntegration.test.ts tests/process-global/firmwarePublicationDeadline.test.ts — 2 files, 57 tests passed (on 5634d9fd).
  • npm run test:local -- src/pcap/PcapNativeBound.test.ts — 2 tests passed after the temporary-executable change (39098883a).
  • npm run check:fast — typecheck and lint succeeded on 5634d9fd and again on 39098883a. check:fast does not run format:check.
  • npx oxfmt --check src/pcap/PcapNativeBound.test.ts — passed after formatting (4b79c104a).
  • npm run test:focused -- tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts — 44 tests passed locally, including the cancellation case that failed once in CI shard 4/8 on 39098883a.
  • prlimit 2.39.3 comparison of bare, N:N, and soft: forms — bare and N:N printed the same soft and hard rows; soft: left hard unlimited.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Numerical budgets are unchanged. The firmware and Wakaru limiter argv spelling is now explicit soft:hard.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux prlimit 2.39.3 compared bare, paired, and soft-only forms. No Hopper, Ghidra, or browser coverage applies.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: containment ceilings are the same numbers. Pcap still uses 300 CPU seconds and no resident-input budget. EVMole still does not lower inherited hard ceilings.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6352 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `cursor/resource-limit-ownership-78f5` --- ### 📝 Commits (3) - [`5634d9f`](https://github.com/morluto/rea/commit/5634d9fdbf854ac2b2e7d43e66b5b01541b64429) refactor(process): share paired prlimit ceiling ownership - [`3909888`](https://github.com/morluto/rea/commit/39098883a75fb5052983085ce1a51eb31981a4f3) test(pcap): admit capture limits without host prlimit - [`4b79c10`](https://github.com/morluto/rea/commit/4b79c104a6967c0f85c4c751305e1fbcd0c4d387) style(pcap): format the capture ceiling test ### 📊 Changes **12 files changed** (+222 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `scripts/verify/architecture-guards.mjs` (+37 -11) 📝 `src/firmware/FirmwareCommand.ts` (+11 -7) 📝 `src/firmware/FirmwareRelease.ts` (+3 -1) 📝 `src/javascript/recovery/WakaruCommand.test.ts` (+47 -0) 📝 `src/javascript/recovery/WakaruCommand.ts` (+9 -6) 📝 `src/javascript/recovery/WakaruRelease.ts` (+4 -1) ➕ `src/pcap/PcapNativeBound.test.ts` (+66 -0) 📝 `src/pcap/PcapNativeBound.ts` (+13 -11) 📝 `src/process/LinuxResourceLimits.test.ts` (+9 -3) 📝 `src/process/LinuxResourceLimits.ts` (+11 -4) 📝 `tests/boundary/firmware/firmwareIntegration.test.ts` (+6 -1) 📝 `tests/process-global/firmwarePublicationDeadline.test.ts` (+6 -1) </details> ### 📄 Description <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Summary Paired Linux `prlimit` ceilings now come from `prlimitArgumentVector` and `prlimitCeilingArguments` in `src/process/LinuxResourceLimits.ts`. Firmware, Wakaru, and pcap stop spelling those options inline. Byte and CPU budgets are unchanged. The capture-ceiling test uses a temporary executable, so it does not require `/usr/bin/prlimit`. ## Problem and expected behavior Architecture guards already required one owner for paired soft and hard ceilings, but the census only matched the `--core=0:0` spelling. Firmware and Wakaru passed a bare value (`--cpu=120`, `--core=0`). util-linux 2.39.3 treats a bare value as both soft and hard, the same as `soft:hard` when the numbers are equal. Pcap spelled the paired form itself, including `1024 ** 3` and `64 * 1024 ** 2` for the same 1 GiB and 64 MiB ceilings as `BOUNDED_PRODUCER_LIMITS`. Those producers now call the shared owner. Enforced ceilings stay the same numbers. ## Change and scope - `prlimitArgumentVector` is built from `prlimitCeilingArguments`, the command-less prefix. Pcap uses the prefix because `PcapCommand` appends the producer command. Its CPU ceiling stays 300 seconds. - Firmware and Wakaru call `prlimitArgumentVector` with their existing file-size and 120-second CPU budgets. Their 1 GiB address space is `BOUNDED_PRODUCER_LIMITS.address_space_bytes`. - The architecture guard now rejects a bare `--core=0` and allowlists only the EVMole soft-only form (`--core=0:`), which leaves the inherited hard ceiling in place. EVMole budgets stay 3 GiB address space, 16 MiB file, and 30 CPU seconds. `selectEvmWorkerLimits` stays a separate selector because it returns `Result`, checks units, and rejects a soft limit above its hard limit. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Unresolved scope, authority, side effects, or required verification block integration. Link the required maintainer scope decision for new providers or capabilities involving target execution, injection, mutation, or protection recovery; ordinary fixes within existing boundaries may state "not applicable". Draft PRs may leave the scope decision pending and the readiness and merge checklists unchecked. Maintainers can help resolve open questions. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/process/LinuxResourceLimits.ts` owns paired prlimit options and the shared 1 GiB address-space and 64 MiB file ceilings. The change is at producer admission, before the owned command is spawned. - Contribution scope fit and linked maintainer decision: not applicable. This consolidates existing limiter arguments inside current provider boundaries. No new provider, target execution, injection, mutation, or protection recovery. - CLI and MCP/tool-catalog contract: none. Public budgets and tool descriptions are unchanged. - Provider, bridge, target-format, or platform compatibility: Firmware and Wakaru argv now uses explicit `soft:hard` (`--cpu=120:120`, `--core=0:0`) instead of a bare value. On util-linux 2.39.3 those forms set the same soft and hard numbers. Pcap's emitted vector is unchanged aside from taking it from the shared helper. EVMole stays soft-only. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. No target selection or cleanup change. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact (CI generates and validates ignored catalogs and `skills/`; edit authored instructions in `.agents/skills/reverse-engineer-anything/` and never commit build outputs): none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [ ] Read existing files or captured data. - [x] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `LinuxResourceLimits.test.ts` locks the ceiling prefix. `PcapNativeBound.test.ts` locks the 1 GiB Windows job ceiling and the 300-second capture vector against a temporary executable. `WakaruCommand.test.ts` locks the shared vector. Firmware launch assertions expect the paired spelling. - Base reproduction or other evidence: On this host, `prlimit` from util-linux 2.39.3 set identical soft and hard rows for `--cpu=5 --core=0 --as=1073741824 --fsize=4096` and the `N:N` form. `--cpu=5:` left the hard limits unlimited. That measurement is why firmware and Wakaru moved, and why EVMole did not. - User-visible CLI/MCP output (if applicable): none. Budgets reported to callers stay the same numbers. - Remaining proof gaps: real Binwalk, Unblob, Wakaru, and TShark runs were not executed. Equivalence is from `prlimit` itself plus unit and fixture launch assertions. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `node scripts/verify/architecture-guards.mjs` — passed across 1875 source files (on `5634d9fd`). - `npm run test:local -- src/process/LinuxResourceLimits.test.ts src/pcap/PcapNativeBound.test.ts src/javascript/recovery/WakaruCommand.test.ts` — 3 files, 21 tests passed (on `5634d9fd`). - `npm run test:focused -- tests/boundary/firmware/firmwareIntegration.test.ts tests/process-global/firmwarePublicationDeadline.test.ts` — 2 files, 57 tests passed (on `5634d9fd`). - `npm run test:local -- src/pcap/PcapNativeBound.test.ts` — 2 tests passed after the temporary-executable change (`39098883a`). - `npm run check:fast` — typecheck and lint succeeded on `5634d9fd` and again on `39098883a`. `check:fast` does not run `format:check`. - `npx oxfmt --check src/pcap/PcapNativeBound.test.ts` — passed after formatting (`4b79c104a`). - `npm run test:focused -- tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts` — 44 tests passed locally, including the cancellation case that failed once in CI shard 4/8 on `39098883a`. - `prlimit` 2.39.3 comparison of bare, `N:N`, and `soft:` forms — bare and `N:N` printed the same soft and hard rows; `soft:` left hard unlimited. ## Compatibility, safety, and release - Breaking changes or migration steps: none. Numerical budgets are unchanged. The firmware and Wakaru limiter argv spelling is now explicit `soft:hard`. - Real Hopper/Ghidra, browser, or OS coverage: Linux `prlimit` 2.39.3 compared bare, paired, and soft-only forms. No Hopper, Ghidra, or browser coverage applies. - Package or release metadata impact: none. - Security, privacy, process, or containment review: containment ceilings are the same numbers. Pcap still uses 300 CPU seconds and no resident-input budget. EVMole still does not lower inherited hard ceilings. ## Author readiness Human owner: @morluto - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-59c0458d-a519-5fbd-8ee7-be69fe8e78f5?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-59c0458d-a519-5fbd-8ee7-be69fe8e78f5&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:46:51 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7299
No description provided.