Conversation
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit 14431b3. Bugbot is set up for automated code reviews on this repo. Configure here. |
| if errors.Is(copyErr, unix.ESRCH) { | ||
| // The process that triggered the fault no longer exists — FC was killed | ||
| // or crashed while the page fetch was in flight. This is expected during | ||
| // sandbox teardown; treat it as benign. |
There was a problem hiding this comment.
Skipping onFailure (i.e. SignalExit) here changes the loop exit path for full-FC-death scenarios.
With the old code, any copyErr called SignalExit -> the exitFd pipe became readable -> the poll loop exited cleanly at the hasEvent(exitFd.Revents, unix.POLLIN) check.
With this change, when ESRCH means the entire FC process is gone, the loop now relies on the UFFD fd itself signalling completion. Looking at the serve loop (lines 154-175), POLLHUP on the UFFD fd is only tracked as a metric and continued -- the loop does not exit on POLLHUP alone. If the kernel sets only POLLHUP (not POLLIN) when FC's mm is released, the loop will busy-spin indefinitely until fdExit.Close() is called by external teardown code.
For the case this fix targets -- a single vCPU thread dying mid-fault while the rest of FC is still alive -- skipping SignalExit is correct. But the comment says FC was killed or crashed, implying full-process death. For that case, the clean exit now depends on either (a) external teardown always calling fdExit.Close() before this path is hit, or (b) the UFFD fd becoming readable (POLLIN + read error) after the mm is released. Given the existing TODO at line 167 about incomplete POLLHUP handling, it is worth verifying (a) is always guaranteed in the crash path.
Merge Score: 95/100🟢 The PR gracefully handles the Code Suggestions (1)Low Priority (1)
Reasoning: Just like the Suggested Code: span.SetAttributes(attribute.Bool("uffd.process_exited", true))
u.logger.Debug(ctx, "UFFD serve copy error: process no longer exists", zap.Error(copyErr))📊 Review Metadata
|
No description provided.