Skip to content

miri: support statx syscall - #166564

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
RalfJung:miri-statc-syscall
Nov 27, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
RalfJung:miri-statc-syscall

Conversation

@RalfJung

Copy link
Copy Markdown
Member

This requires adjusting our "identical C types" check to unfold repr(transparent) types.

I thought std uses the statx syscall sometimes because of this, but it turns out it will use the weak symbol first. So adding the syscall isn't actually needed. But at that point I had already written the code, and this did lead me to discover an actual issue with our "identical C types" check.

r? @oli-obk

@rustbot

rustbot commented Nov 25, 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

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @oli-obk, @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 25, 2026
mask_op: &OpTy<'tcx>, // Should be an `unsigned int`
statxbuf_op: &OpTy<'tcx>, // Should be a `struct statx *`
) -> InterpResult<'tcx, Scalar> {
dest: &MPlaceTy<'tcx>,

@RalfJung RalfJung Nov 25, 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 switched this to passing the dest place because that's the standard style we're using for all new shims, and because the output type differs between the syscall (i64) and the libc function (i32).

View changes since the review

@oli-obk oli-obk left a comment •

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.

field.ty(*self.tcx, args),
);
interp_ok(
self.unfold_transparent(self.layout_of(ty)?, |adt| {

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.

Leave a comment here that unfold_transparent transitively normalizes the non-zst field type via the nested Layout::field call, as that isn't obvious from the code here

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.

In fact I think we can remove the explicit normalization here, layout_of also performs normalization.

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.

wellllll that's something that all the skip_norm_wip is trying to avoid in the future, but I'm gonna fix all that in one go for ctfe instead of trying to whackamole them one at a time

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.

IMO it makes perfect sense to say that layout should do normalization, since it has to do expensive computation anyway... but sure, happy to defer that discussion to the future. :)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 26, 2026
@RalfJung
RalfJung force-pushed the miri-statc-syscall branch 2 times, most recently from 09ffd78 to 525cf9b Compare November 26, 2026 14:10
@RalfJung

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 26, 2026
@oli-obk

oli-obk commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 525cf9b has been approved by oli-obk

It is now in the queue for this repository.

@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 Nov 27, 2026
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 27, 2026
@oli-obk

oli-obk commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@bors r-

looking into it more, to make sure we actually fix it in the future this needs to be skip_norm_wip

@rust-bors rust-bors Bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 27, 2026
@rust-bors

rust-bors Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@RalfJung

Copy link
Copy Markdown
Member Author

@bors r=oli-obk

@rust-bors

rust-bors Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0f4fc3b has been tentatively approved by oli-obk

It will be put into the queue for this repository once PR CI succeeds.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #165836 (Use LLVM option `-disable-auto-upgrade-debug-info`)
 - #164783 (callconv: mips64: match gcc for "alignment" of 16-byte-aligned ZSTs)
 - #166634 (do not lint `drop_bounds`, `dyn_drop`, `trivial_bounds` and const param names on items from external macros)
 - #166649 (abby dsl: minor refactor/cleanup)
 - #164628 (callconv: mips64: handle repr(transparent))
 - #166387 (Remove diagnostics import list)
 - #166564 (miri: support statx syscall)
 - #166583 (abby dsl tests: the passing test should check-pass)
 - #166595 (specify target CPUs in 'powerpc-types.rs' assembly test)
 - #166640 (compiletest: Use an explicit argfile instead of ArgFileCommand)
 - #166646 (Fix reversed argument counts in Fn trait mismatch note)
@rust-bors
rust-bors Bot merged commit 6f71f05 into rust-lang:main Nov 27, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup merge of #166564 - RalfJung:miri-statc-syscall, r=oli-obk

miri: support statx syscall

This requires adjusting our "identical C types" check to unfold `repr(transparent)` types.

I thought std uses the statx syscall sometimes because of [this](https://github.com/rust-lang/rust/blob/3481260b58faf2802ca1efb83ccc558250c7d98c/library/std/src/sys/fs/unix.rs#L157-L158), but it turns out it will use the weak symbol first. So adding the syscall isn't actually needed. But at that point I had already written the code, and this did lead me to discover an actual issue with our "identical C types" check.

r? @oli-obk
@RalfJung
RalfJung deleted the miri-statc-syscall branch November 27, 2026 18:54
mehmettoplu-rs pushed a commit to mehmettoplu-rs/miri that referenced this pull request Nov 28, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#165836 (Use LLVM option `-disable-auto-upgrade-debug-info`)
 - rust-lang/rust#164783 (callconv: mips64: match gcc for "alignment" of 16-byte-aligned ZSTs)
 - rust-lang/rust#166634 (do not lint `drop_bounds`, `dyn_drop`, `trivial_bounds` and const param names on items from external macros)
 - rust-lang/rust#166649 (abby dsl: minor refactor/cleanup)
 - rust-lang/rust#164628 (callconv: mips64: handle repr(transparent))
 - rust-lang/rust#166387 (Remove diagnostics import list)
 - rust-lang/rust#166564 (miri: support statx syscall)
 - rust-lang/rust#166583 (abby dsl tests: the passing test should check-pass)
 - rust-lang/rust#166595 (specify target CPUs in 'powerpc-types.rs' assembly test)
 - rust-lang/rust#166640 (compiletest: Use an explicit argfile instead of ArgFileCommand)
 - rust-lang/rust#166646 (Fix reversed argument counts in Fn trait mismatch note)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants