Skip to content

Use 64-bit futex syscalls on RV32 Linux - #164748

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
TechnoPorg:64-bit-futex
Oct 24, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
TechnoPorg:64-bit-futex

Conversation

@TechnoPorg

@TechnoPorg TechnoPorg commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Closes #164694

This changes riscv32 Linux targets to use the SYS_futex_time64 syscall instead of SYS_futex in the standard library to fix compilation after rust-lang/libc#5455.

libc::timespec has a c_long for nanoseconds on 32-bit targets right now, whereas the kernel uses long long. I'm not sure whether this is a problem or not?

I'm also curious whether using the time64 syscall on all 32-bit targets is a desired change.

r? tgross35

@rustbot

rustbot commented Oct 22, 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

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added 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 Oct 22, 2026
@rustbot

rustbot commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The libs portion looks fine to me, but this is mostly a Miri PR. I think you should probably file it at the Miri repo since I believe more arches are tested there.

r? miri

View changes since this review

Comment thread library/std/src/sys/sync/futex/unix.rs
Comment thread library/std/src/sys/sync/futex/unix.rs Outdated
Comment on lines +16 to +24
// riscv32 uses a 64-bit `libc::timespec`, and only exposes the `SYS_futex_time64` syscall,
// whereas other 32-bit targets use their 32-bit `libc::timespec` with `SYS_futex`, and require
// opting into a 64-bit `timespec` with the `SYS_futex_time64` syscall.
target_arch = "riscv32" => {
use libc::SYS_futex_time64 as SYS_futex;
}
_ => {
use libc::SYS_futex;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a rather confusing comment, can it be simplified?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to clarify that the libc::timespec struct is ABI-compatible with the syscall that gets selected by this cfg_select!, since that tripped me up. I removed the timespec parts but if you have better wording suggestions I'm happy to implement them.

Comment thread src/tools/miri/tests/pass-dep/concurrency/linux-futex.rs Outdated
Comment thread src/tools/miri/src/shims/unix/linux_like/syscall.rs Outdated
Comment thread src/tools/miri/tests/pass-dep/concurrency/linux-futex.rs
@rustbot rustbot assigned saethlin and unassigned tgross35 Oct 22, 2026
@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 Oct 22, 2026
@rustbot

rustbot commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@TechnoPorg TechnoPorg changed the title Use 64-bit futex syscalls on 32-bit Linux targets Use 64-bit futex syscalls on RV32 Linux Oct 22, 2026
@tgross35

Copy link
Copy Markdown
Member

Actually, why are Miri changes needed at all for the std fix? We aren't running tests against rv32 in this repo as far as I'm aware

@TechnoPorg

Copy link
Copy Markdown
Contributor Author

Actually, why are Miri changes needed at all for the std fix? We aren't running tests against rv32 in this repo as far as I'm aware

I just grepped for SYS_futex with the intent of fixing everywhere it was used. But it seems the Miri changes would be more involved than I thought, so maybe instead I'll just file the lack of SYS_futex_time64 support as a Miri issue for now.

@rust-log-analyzer

This comment has been minimized.

@RalfJung

RalfJung commented Oct 22, 2026 via email

Copy link
Copy Markdown
Member

@TechnoPorg

Copy link
Copy Markdown
Contributor Author

I've gotten rid of my ill-fated Miri changes and if they happen at all, they can happen in a separate PR to the miri repository.

rv32 is not a supported Miri target currently. I am not even sure if we test 64bit riscv....

Does Miri support any 32-bit Linux targets? If not the SYS_futex_time64 syscall handling wouldn't even be necessary.

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c860e0d has been tentatively approved by tgross35

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 Oct 22, 2026
@tgross35

Copy link
Copy Markdown
Member

Does Miri support any 32-bit Linux targets? If not the SYS_futex_time64 syscall handling wouldn't even be necessary.

Atleast i686 and arm32 are https://github.com/rust-lang/miri/blob/eaacf5fb522e50f25aa0b12db34bc99c0bd38068/ci/ci.sh#L159-L191

@RalfJung

Copy link
Copy Markdown
Member

Turns out we do check riscv64a23-unknown-linux-gnu in CI.

But officially we only support tier 1 targets, and then we check some tier 2 targets but that's best-effort and will be disabled if a fix would be too much work and block other work. So yes we do support i686-linux.

jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 22, 2026
Use 64-bit futex syscalls on RV32 Linux

Closes rust-lang#164694

This changes riscv32 Linux targets to use the `SYS_futex_time64` syscall instead of `SYS_futex` in the standard library to fix compilation after rust-lang/libc#5455.

`libc::timespec` has a `c_long` for nanoseconds on 32-bit targets right now, whereas the kernel uses `long long`. I'm not sure whether this is a problem or not?

I'm also curious whether using the time64 syscall on _all_ 32-bit targets is a desired change.

r? tgross35
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 23, 2026
Use 64-bit futex syscalls on RV32 Linux

Closes rust-lang#164694

This changes riscv32 Linux targets to use the `SYS_futex_time64` syscall instead of `SYS_futex` in the standard library to fix compilation after rust-lang/libc#5455.

`libc::timespec` has a `c_long` for nanoseconds on 32-bit targets right now, whereas the kernel uses `long long`. I'm not sure whether this is a problem or not?

I'm also curious whether using the time64 syscall on _all_ 32-bit targets is a desired change.

r? tgross35
rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #164748 (Use 64-bit futex syscalls on RV32 Linux)
 - #159689 (Account for missing turbofish in resolve errors)
 - #164733 (Include `deprecated` attributes in `rustc_resolve` intra-doc link resolution)
 - #164754 (Update outdated/incorrect unstable tracking issue links)
 - #164761 ([tiny] Properly format return type in lifetime error with backticks)
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Use 64-bit futex syscalls on RV32 Linux



Closes #164694

This changes riscv32 Linux targets to use the `SYS_futex_time64` syscall instead of `SYS_futex` in the standard library to fix compilation after rust-lang/libc#5455.

`libc::timespec` has a `c_long` for nanoseconds on 32-bit targets right now, whereas the kernel uses `long long`. I'm not sure whether this is a problem or not?

I'm also curious whether using the time64 syscall on _all_ 32-bit targets is a desired change.

r? tgross35
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 23, 2026
@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0ad4612 failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #164780 (comment)

@rust-bors rust-bors Bot 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 Oct 23, 2026
@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

This PR was contained in a rollup (#164780), which was unapproved.

View changes since this unapproval

@TechnoPorg

Copy link
Copy Markdown
Contributor Author

rustix <1.1.5 is incompatible with libc >=0.2.190 (bytecodealliance/rustix#1676), so I've bumped it in the lockfile as well.

If someone with try build permissions could run the failed job again to see if this fixes it, that would be appreciated.

@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors try jobs=dist-powerpc64-linux-musl

rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Use 64-bit futex syscalls on RV32 Linux


try-job: dist-powerpc64-linux-musl
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 240af90 (240af9030f4cf2e710f13aab9d136dc893dc05e7)
Base parent: a0326ca (a0326caa8961d2900534b29e10a57afcdcf65135)

@TechnoPorg

Copy link
Copy Markdown
Contributor 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 Oct 23, 2026
@tgross35

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 093a6f1 has been approved by tgross35

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 Oct 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 24, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #163766 (Outline constant messages from panicking macros)
 - #147368 (Add extra `unchecked_disjoint_bitor` implementations.)
 - #164748 (Use 64-bit futex syscalls on RV32 Linux)
 - #164520 (powerpc: implement c-variadic correctly for softfloat targets)
 - #164671 (add maintainers for tier 2 riscv64 targets (baremetal only))
@rust-bors
rust-bors Bot merged commit 23586b2 into rust-lang:main Oct 24, 2026
15 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 24, 2026
Rollup merge of #164748 - TechnoPorg:64-bit-futex, r=tgross35

Use 64-bit futex syscalls on RV32 Linux

Closes #164694

This changes riscv32 Linux targets to use the `SYS_futex_time64` syscall instead of `SYS_futex` in the standard library to fix compilation after rust-lang/libc#5455.

`libc::timespec` has a `c_long` for nanoseconds on 32-bit targets right now, whereas the kernel uses `long long`. I'm not sure whether this is a problem or not?

I'm also curious whether using the time64 syscall on _all_ 32-bit targets is a desired change.

r? tgross35
mehmettoplu-rs pushed a commit to mehmettoplu-rs/miri that referenced this pull request Oct 24, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#163766 (Outline constant messages from panicking macros)
 - rust-lang/rust#147368 (Add extra `unchecked_disjoint_bitor` implementations.)
 - rust-lang/rust#164748 (Use 64-bit futex syscalls on RV32 Linux)
 - rust-lang/rust#164520 (powerpc: implement c-variadic correctly for softfloat targets)
 - rust-lang/rust#164671 (add maintainers for tier 2 riscv64 targets (baremetal only))
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-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.

std doesn't compile for riscv32gc-unknown-linux-gnu

7 participants