Skip to content

sanitize_standard_fds: Miri supports poll now#159961

Open
RalfJung wants to merge 2 commits into
rust-lang:mainfrom
RalfJung:miri-sanitize_standard_fds
Open

sanitize_standard_fds: Miri supports poll now#159961
RalfJung wants to merge 2 commits into
rust-lang:mainfrom
RalfJung:miri-sanitize_standard_fds

Conversation

@RalfJung

Copy link
Copy Markdown
Member

However, so far it doesn't support it on the standard FDs (0..=2). So let's support those in poll and then remove a Miri special case in std.

@rustbot

rustbot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 26, 2026
@rustbot

rustbot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

r? @clarfonthey

rustbot has assigned @clarfonthey.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey, jhpratt

@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the miri-sanitize_standard_fds branch from a36f0a9 to a4caad8 Compare July 26, 2026 12:27
/// closed in the mean time.
fn test_unblock_after_socket_close() {
// MacOS behaves different (`read` errors with EBADFD when the file description is closed)
// MacOS behaves different (`read` errors with EBADF when the file description is closed)

@clarfonthey clarfonthey Jul 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Frustrated that these both are very similar errors that exist and mean slightly different things, but want to verify this is actually correct here. Based upon the Linux manual:

EBADF Bad file descriptor (POSIX.1-2001).
EBADFD File descriptor in bad state.

It feels like EBADFD is correct, but from what it seems, MacOS only has EBADF? And just want to verify this is correct since I'm not 100% sure.

View changes since the review

@RalfJung RalfJung Jul 26, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I only just realized that those two errors both exist and are different. I am fairly sure that we saw EBADF on macOS, not EBADFD, as EBADF is usually returned when calling read on a closed FD so that would make sense. Also as you say macOS doesn't even seem to have EBADFD. I don't have macOS machine so verifying this isn't entirely trivial and doesn't seem worth it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's fair, then. My verification after poking around was the macos-errno crate which does indeed list EBADF and not EBADFD, so, I'll say that's good enough.

@clarfonthey

Copy link
Copy Markdown
Contributor

r=me minus one small note.

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a4caad8 has been approved by clarfonthey

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

Reason for tree closure: spurious failures

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants