[Bug 57700] New: NTDLL under-aligns implicit module TLS
https://bugs.winehq.org/show_bug.cgi?id=57700 Bug ID: 57700 Summary: NTDLL under-aligns implicit module TLS Product: Wine Version: 10.0-rc6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs(a)winehq.org Reporter: me(a)purplesyringa.moe Distribution: --- Created attachment 77888 --> https://bugs.winehq.org/attachment.cgi?id=77888 Reproducer alloc_tls_slot in dlls/ntdll/loader.c spells: if (!(new_ptr = RtlAllocateHeap( GetProcessHeap(), 0, size + dir->SizeOfZeroFill ))) return -1; This allocates the thread-local storage without an alignment. MSDN says that the correct alignment is specified in the Characteristics field of the TLS directory, which Wine promptly ignores. (https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-tls-dire...) This leads to unsatisfied alignment requirements in programs that expect it, often leading to crashes, as seen in https://github.com/rust-lang/rust/issues/135719. For testing, I have attached a small example built with MSVC that allocates a page-aligned thread local and prints its address. The compiled executable is at https://mega.nz/file/AJhyVAyA#3JDbONv0-TIQPqLKpUW7zg9DLRjP9IqHsdOIpxUHSUs. The alignment specified in the TLS directory is 4096, matching the source code, as verified by `dumpbin /tls`. If you'd like me to attach the executable to the ticket directly or need more information, please do tell. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57700 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57700 Eric Pouech <eric.pouech(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech(a)gmail.com --- Comment #1 from Eric Pouech <eric.pouech(a)gmail.com> --- thanks for the detailed bug report created https://gitlab.winehq.org/wine/wine/-/merge_requests/7251 that should solve the issue -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla