Skip to content

feat(uffd): handle UFFD_EVENT_REMOVE; track per-page state; race-safe COPY#2520

Open
ValentaTomas wants to merge 4 commits intofeat/block-state-trackerfrom
feat/uffd-remove-events-matrix
Open

feat(uffd): handle UFFD_EVENT_REMOVE; track per-page state; race-safe COPY#2520
ValentaTomas wants to merge 4 commits intofeat/block-state-trackerfrom
feat/uffd-remove-events-matrix

Conversation

@ValentaTomas
Copy link
Copy Markdown
Member

@ValentaTomas ValentaTomas commented Apr 29, 2026

Handles UFFD_EVENT_REMOVE so balloon-deflate / madvise(MADV_DONTNEED) transitions pages to a removed state instead of leaving stale faulted mappings. Drains the REMOVE batch under settleRequests.Lock; workers hold settleRequests.RLock across the state read → UFFDIO_COPYSetRange sequence so a concurrent REMOVE can't slip between the read and the install. Soft-fails UFFDIO_COPY EAGAIN / partial copies onto a deferredFaults queue and wakes the poll loop via a self-pipe.

Depends on #2545.

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 29, 2026

PR Summary

High Risk
High risk because it changes core userfaultfd serve-loop behavior, locking, and kernel event handling (including UFFD_EVENT_REMOVE, deferred faults, and copy semantics), which can deadlock or corrupt guest memory if wrong. The new logic also affects prefaulting and page state transitions under concurrency.

Overview
Adds first-class handling for UFFD_EVENT_REMOVE by tracking per-page state (missing/faulted/removed) and updating state in the serve loop so madvise(MADV_DONTNEED) transitions pages to removed rather than leaving stale mappings. Refactors fault handling to short-circuit already-faulted pages, zero-fill removed pages, and treat UFFDIO_COPY EAGAIN/partial copies as a soft-failure that gets queued for retry and wakes the poll loop via a new self-pipe.

Updates prefaulting to respect page state and mark prefaulted pages as faulted, and expands the test harness to cover REMOVE-enabled/disabled matrices, MADV_DONTNEED operations (including multi-page), and targeted race/liveness tests for stale-source and deadlock scenarios.

Reviewed by Cursor Bugbot for commit 53f9544. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da912303d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go Outdated
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go Outdated
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/prefault.go
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go Outdated
@ValentaTomas ValentaTomas marked this pull request as draft May 1, 2026 18:05
@ValentaTomas ValentaTomas force-pushed the feat/uffd-remove-events-matrix branch from da91230 to efa01a5 Compare May 2, 2026 08:48
ValentaTomas added a commit that referenced this pull request May 2, 2026
…ernel redeliver

Folds audit findings #1 and #7 into one commit since they share the same
error arm in faultPage. The kernel surfaces concurrent mm churn (e.g.
balloon-driven madvise(MADV_DONTNEED), mremap, fork against the same mm)
through UFFDIO_COPY in two distinct ways: as an EAGAIN errno from the
syscall, or — once UFFD_FEATURE_EVENT_REMOVE is enabled — through the
partial-copy convention where the syscall returns 0 and cpy.copy carries
either -EAGAIN or 0..pagesize. Hugetlb pages can also surface a positive
short copy if a fault preempts the operation mid-page (#7).

Pre-#2520 the latter path went through fmt.Errorf("UFFDIO_COPY copied N
bytes...") and fell into the catch-all writeErr != nil arm — which calls
onFailure() / fdExit.SignalExit(), tears the uffd serve loop down, and
crashes the sandbox the moment the guest touches an unmapped page. The
pre-existing errno-EAGAIN soft handler covered only the syscall errno
path.

Move the partial-copy classification into a small helper so both surfaces
collapse onto the existing EAGAIN-returning-(false, nil) branch in
faultPage. No retry budget — matches Firecracker's reference handler in
src/firecracker/examples/uffd/uffd_utils.rs (Err(PartiallyCopied(n)) if
n == 0 || n == -EAGAIN ⇒ return false). Add a uffd.copy_eagain span
attribute for observability.

Tests: unit-test classifyCopyResult directly. faultPage doesn't expose
an Fd seam to mock UFFDIO_COPY without an interface refactor that would
materially expand the diff; per the audit's "smallest pragmatic test"
guidance the classifier covers the new branching and the existing
cross-process matrix tests cover the integration path.
@ValentaTomas ValentaTomas changed the title feat(uffd): add UFFD_EVENT_REMOVE handling, removed pageState, and matrix-mode tests feat(uffd): handle UFFD_EVENT_REMOVE and add matrix-mode tests May 2, 2026
ValentaTomas added a commit that referenced this pull request May 2, 2026
…onrpc over unix socket (#2519)

Replace the cross-process userfaultfd test harness's pipes + signals
(`SIGUSR1` shutdown, `SIGUSR2` page-state snapshot,
ready/offsets/gate-cmd/gate-sync pipes) with one Unix socket carrying
stdlib `net/rpc` + `net/rpc/jsonrpc`. The userfaultfd and the rpc
socketpair half are passed via `ExtraFiles`.

Production change: one `atomic.Pointer[func(uintptr, faultPhase)]` field
on `Userfaultfd` and three nil-checked inline call sites. Test builds
install the hook via `SetTestFaultHook` defined in a `_test.go` file.

Stacked follow-ups:

- `UFFD_EVENT_REMOVE` handling + matrix tests — #2520
- Stale-source / madvise-deadlock / faulted-short-circuit race tests —
#2521
- Stale-source race fix — #2512
Base automatically changed from refactor/uffd-test-harness to main May 2, 2026 19:32
@ValentaTomas ValentaTomas changed the title feat(uffd): handle UFFD_EVENT_REMOVE and add matrix-mode tests feat(uffd): UFFD_EVENT_REMOVE handling, race tests, and stale-source fix May 3, 2026
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
@ValentaTomas ValentaTomas changed the title feat(uffd): UFFD_EVENT_REMOVE handling, race tests, and stale-source fix feat(uffd): handle UFFD_EVENT_REMOVE; track per-page state; race-safe COPY May 3, 2026
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/prefault.go Outdated
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
ValentaTomas added a commit that referenced this pull request May 3, 2026
…state

Replace the map-based pageTracker with block.StateTracker[pageState], a
roaring-bitmap-backed tracker with O(1) range ops. pageState gains a
third value, removed, which is wired at the type level but not yet
written anywhere -- #2520 adds the REMOVE-event handler that produces
it. Page indices are computed at the call site via header.BlockIdx.
pageStateEntries is updated to iterate the exported bitmaps so the
cross-process test harness keeps working.
@ValentaTomas ValentaTomas force-pushed the feat/uffd-remove-events-matrix branch from 68037d2 to ceec7d6 Compare May 3, 2026 07:10
@ValentaTomas ValentaTomas changed the base branch from main to feat/block-state-tracker May 3, 2026 07:12
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
ValentaTomas added a commit that referenced this pull request May 3, 2026
…state

Replace the map-based pageTracker with block.StateTracker[pageState], a
roaring-bitmap-backed tracker with O(1) range ops. pageState gains a
third value, removed, which is wired at the type level but not yet
written anywhere -- #2520 adds the REMOVE-event handler that produces
it. Page indices are computed at the call site via header.BlockIdx.
pageStateEntries is updated to iterate the exported bitmaps so the
cross-process test harness keeps working.

Inline the 3-line pageState enum into userfaultfd.go and drop the
dedicated page_tracker.go now that pageTracker is gone.

Convert block.StateTracker's NewStateTracker / SetRange API from panics
to errors. Distinct-state validation and unsupported-state checks now
return fmt.Errorf descriptors; the userfaultfd-side init propagates the
constructor error through NewUserfaultfdFromFd, and the SetRange call
in the worker path logs and continues since these errors only fire on
programming bugs.
@ValentaTomas ValentaTomas force-pushed the feat/block-state-tracker branch from 95659d3 to bf4fc62 Compare May 3, 2026 07:30
@ValentaTomas ValentaTomas force-pushed the feat/uffd-remove-events-matrix branch from ceec7d6 to 9ce0941 Compare May 3, 2026 07:36
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
@ValentaTomas ValentaTomas marked this pull request as ready for review May 3, 2026 08:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ce09411f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/race_test.go Outdated
Production:
  - UFFDIO_REGISTER_MODE_REMOVE is requested so the kernel reports
    MADV_DONTNEED'd pages via UFFD_EVENT_REMOVE.
  - Userfaultfd.Serve splits read events into removes + pagefaults,
    drains the REMOVE batch under settleRequests.Lock (calling
    pageTracker.SetRange(.., removed) with BlockIdx-computed indices),
    then dispatches the pagefault batch.
  - Worker dispatch switches on pageTracker.Get(idx): faulted ->
    short-circuit, removed -> zero-fill (source = nil), missing ->
    copy from u.src. The state read happens inside the worker under
    settleRequests.RLock so a concurrent REMOVE can't slip between
    the read and the install.
  - faultPage gains zero-fill paths for source == nil (4K read =
    DONTWAKE zero + WP + wake; 4K write = zero + wake; hugepage =
    copy(EmptyHugePage)) and returns (handled, err) so the worker can
    defer UFFDIO_COPY EAGAIN back into a deferredFaults queue.
  - wakeupPipe + deferredFaults wake the poll loop when a worker
    defers, so a deferred fault doesn't sit waiting for an unrelated
    UFFD event. The received uffd fd is marked FD_CLOEXEC.
  - Prefault short-circuits for faulted || removed.

Tests:
  - testConfig gains removeEnabled; the parent unregisters the UFFD
    region on cleanup when REMOVE is on so munmap doesn't block on
    un-acked events.
  - Page-state wire format exposes removed via helpers_test.go.
  - operationModeRemove + executeRemove (madvise MADV_DONTNEED).
  - runMatrix wraps every existing generic test in remove-off and
    remove-on subtests so the no-REMOVE path (still used by
    production templates) stays covered while the new path is
    exercised. The matrix-level t.Parallel() is intentionally
    omitted to cap peak concurrency in CI.
  - remove_test.go: TestRemove, TestRemoveThenFault,
    TestRemoveThenWriteGated, TestWriteThenRemoveGated. Gated tests
    are //nolint:tparallel — a paused gated handler keeps a faulting
    goroutine suspended in the kernel pagefault path; a STW GC pause
    from a parallel test would wait forever for that goroutine to
    reach a safe point.
  - race_test.go: deterministic stale-source / madvise-deadlock /
    faulted-short-circuit regressions, serialised, with the
    FD_CLOEXEC and UFFDIO_COPY-EAGAIN fixes covered.
ValentaTomas added a commit that referenced this pull request May 3, 2026
…state

Replace the map-based pageTracker with block.StateTracker[pageState], a
roaring-bitmap-backed tracker with O(1) range ops. pageState gains a
third value, removed, which is wired at the type level but not yet
written anywhere -- #2520 adds the REMOVE-event handler that produces
it. Page indices are computed at the call site via header.BlockIdx.
pageStateEntries is updated to iterate the exported bitmaps so the
cross-process test harness keeps working.

Inline the 3-line pageState enum into userfaultfd.go and drop the
dedicated page_tracker.go now that pageTracker is gone.

Convert block.StateTracker's NewStateTracker / SetRange API from panics
to errors. Distinct-state validation and unsupported-state checks now
return fmt.Errorf descriptors; the userfaultfd-side init propagates the
constructor error through NewUserfaultfdFromFd, and the SetRange call
in the worker path logs and continues since these errors only fire on
programming bugs.
@ValentaTomas ValentaTomas force-pushed the feat/block-state-tracker branch from bf4fc62 to 02f8da8 Compare May 3, 2026 08:43
@ValentaTomas ValentaTomas force-pushed the feat/uffd-remove-events-matrix branch from 9ce0941 to 5896b7b Compare May 3, 2026 08:43
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
A worker holding settleRequests.RLock must never block readEvents,
because madvise(MADV_DONTNEED) blocks the producer until userspace
reads the UFFD_EVENT_REMOVE — and the producer can be the FC balloon
thread that other syscalls depend on. Use a dedicated readSerial
mutex (not settleRequests) to serialize serve-loop iterations with
snapshot-time Export, while keeping the existing settleRequests
discipline (workers RLock, REMOVE batch Lock) intact so readEvents
remains lock-free relative to workers.

Restores liveness for TestNoMadviseDeadlockWithInflightCopy while
closing the read-vs-apply race that motivated the prior buggy commit
(345f7e9, now amended).
@ValentaTomas ValentaTomas force-pushed the feat/uffd-remove-events-matrix branch from 345f7e9 to db978d4 Compare May 3, 2026 10:22
ValentaTomas added a commit that referenced this pull request May 3, 2026
…loon

Adds the FC-side integration plumbing for free page reporting on top of
the UFFD REMOVE-event handling in #2520:

- template-manager proto: optional bool freePageReporting (field 17).
- TemplateConfig + sandbox.Config gain a FreePageReporting bool that
  flows from template create → build phases (base/steps/finalize) →
  sandbox factory → fc.Process.Create.
- fc.apiClient.enableFreePageReporting calls PUT /balloon with
  free_page_reporting=true after entropy setup and before VM start.
- fcversion.HasFreePageReporting gates rollout to FC v1.14+.
- Adds free-page-reporting LaunchDarkly feature flag.
- create-build CLI: --free-page-reporting flag, defaults to enabled
  when FC version supports it.
- smoketest: opportunistically enables FPR when the FC version under
  test supports it.

UFFD-side changes (REMOVE handling, page tracker, race tests, fix)
remain in #2520; this PR is purely the production rollout path.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 53f9544. Configure here.

Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants