-
-
Notifications
You must be signed in to change notification settings - Fork 15.7k
#[thread_local] alignment broken on Windows, GNU ABI #135719
Copy link
Copy link
Open
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.F-thread_local`#![feature(thread_local)]``#![feature(thread_local)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessO-windows-gnuToolchain: GNU, Operating system: WindowsToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.F-thread_local`#![feature(thread_local)]``#![feature(thread_local)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessO-windows-gnuToolchain: GNU, Operating system: WindowsToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
I tried this code:
I expected to see this happen: three
0x100-aligned pointers.Instead, this happened: metal pipe falling
0x1f39e953850, 0x1f39e953950, 0x1f39e953a50(unaligned)0x1c287893900, 0x1c287893a00, 0x1c287893b00(aligned)0xf9a5f8, 0xf9a6f8, 0xf9a7f8(unaligned)0x6d2f00, 0x6d3000, 0x6d3100(aligned)0x232c80, 0x232d80, 0x232e80(unaligned)0x1320e0, 0x1321e0, 0x1322e0(unaligned)0x341f28, 0x342028, 0x342128(unaligned)0x34f010, 0x34f110, 0x34f210(unaligned)So either this affects all of Windows and I just got lucky twice, or this is two bugs in a trenchcoat, one affecting GNU ABI and another one in Wine. Not sure which.
Notably, checking mixed-alignment thread locals, like
u8, u8, u128, u128, u128, shows that the variables are correctly aligned with respect to each other within TLS, but the TLS base itself seems to be unaligned.Tentatively marking as
I-unsoundbecause of unaligned references bad, feel free to retag.Meta
rustc --version --verbose:wine --version:wine-9.22 (Staging)Tracking issue for visibility: #29594