Wine's first thread stacks lie at the start of the title window (0x1_0000_0000), and the title names addresses there #140

Open
opened 2026-12-01 20:58:05 +00:00 by github-bot · 5 comments
Owner

@⁠firefloc on GitHub · 2026-12-01 20:54 UTC · original

Seen on: 5930321 (main), plus local fork commits that do not touch xmem, umem or the thread setup.
Machine: RX 7900 XTX (RADV), GE-Proton 11-14.

Found while fixing #139. Wine places its first two thread stacks (1 MiB each, the main thread's from __wine_main and one from NtCreateThreadEx at process start) at [0x1_0000_0000, 0x1_0020_0000). That is where victory-hle xmem::address_range starts the title window (1 << 32). The title's first umem mapping lands 2 MiB higher, at 0x1_0020_0000.

The title still names addresses in that range: vkback logs buffer view over memory umem does not back (CPU memory, null): SRV 0x100000000 len 320, and a texture filled from title memory starts at 0x1_0000_0000 (vkback then asked to guard it, which caused #139). Either way, it reads a Wine stack as title data.

Open questions:

  • On the console, what is at the bottom of the title window, and does the title expect its first allocation there? The addresses it names suggest it computes them from that base.
  • Should the title window be reserved before Wine creates its first threads, so that no Wine allocation (stacks, TEBs, heaps) can land in it? Where in the loader would that go?
  • Until then, should a title address outside umem and the views fail loudly (rule 9) wherever it is read, rather than reading Wine's memory?
**@⁠firefloc** on GitHub · 2026-12-01 20:54 UTC · [original](https://github.com/vktory6/VKtory/issues/140) Seen on: 5930321 (main), plus local fork commits that do not touch xmem, umem or the thread setup. Machine: RX 7900 XTX (RADV), GE-Proton 11-14. Found while fixing #139. Wine places its first two thread stacks (1 MiB each, the main thread's from `__wine_main` and one from `NtCreateThreadEx` at process start) at `[0x1_0000_0000, 0x1_0020_0000)`. That is where victory-hle `xmem::address_range` starts the title window (`1 << 32`). The title's first umem mapping lands 2 MiB higher, at `0x1_0020_0000`. The title still names addresses in that range: vkback logs `buffer view over memory umem does not back (CPU memory, null): SRV 0x100000000 len 320`, and a texture filled from title memory starts at `0x1_0000_0000` (vkback then asked to guard it, which caused #139). Either way, it reads a Wine stack as title data. Open questions: - On the console, what is at the bottom of the title window, and does the title expect its first allocation there? The addresses it names suggest it computes them from that base. - Should the title window be reserved before Wine creates its first threads, so that no Wine allocation (stacks, TEBs, heaps) can land in it? Where in the loader would that go? - Until then, should a title address outside umem and the views fail loudly (rule 9) wherever it is read, rather than reading Wine's memory?
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:58:05 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 21:05 UTC · original

Thanks, a clear find. I created a task based on your report: github.com/vktory6/VKtory@db860f6 ("Wine's first thread stacks lie inside the title window"). The goal there: no Wine or host allocation in the title window, and a title address that is neither umem's nor a view's becomes a counted, loud error wherever it is read. Your three open questions are in it. Leaving this issue open until the window is reserved.

**@⁠vktory6** on GitHub · 2026-12-01 21:05 UTC · [original](https://github.com/vktory6/VKtory/issues/140#issuecomment-7325737075) Thanks, a clear find. I created a task based on your report: https://github.com/vktory6/VKtory/commit/db860f6 ("Wine's first thread stacks lie inside the title window"). The goal there: no Wine or host allocation in the title window, and a title address that is neither umem's nor a view's becomes a counted, loud error wherever it is read. Your three open questions are in it. Leaving this issue open until the window is reserved.
Author
Owner

@⁠TheRifai on GitHub · 2026-12-02 10:32 UTC · original

Additional data from the reference-card backend (seen on main d59b4f8, RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X, 4K, 80 s warm-store runs from three saves):

Save buffer view over memory umem does not back (CPU memory, null) hits of those at SRV/CBV 0x100000000 a block asked to be guarded is no title memory lines with block=0x100000
city70 111 111 16
boatsave-profile 583 542 16
rt3 (house) 708 708 16

So the exact address from the report (0x100000000, inside the first Wine stack region) is also the dominant source of these null CPU-memory views on this card, and the guard path asks about the same bottom block 16 times per run. This is counted/left-writable behaviour, not a crash here, but it confirms the window overlap is not specific to the RX 7900 XTX or GE-Proton 11-14.

Logs: /home/shlong/Documents/VKtory-capture/perf-{city70,boatsave-profile,rt3}/20261202-*/. I have not tried reserving the window before Wine's first threads; that needs a loader change and is owned by the TASKS item.

**@⁠TheRifai** on GitHub · 2026-12-02 10:32 UTC · [original](https://github.com/vktory6/VKtory/issues/140#issuecomment-7342611891) Additional data from the reference-card backend (seen on main `d59b4f8`, RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X, 4K, 80 s warm-store runs from three saves): | Save | `buffer view over memory umem does not back (CPU memory, null)` hits | of those at SRV/CBV `0x100000000` | `a block asked to be guarded is no title memory` lines with `block=0x100000` | |---|---:|---:|---:| | `city70` | 111 | 111 | 16 | | `boatsave-profile` | 583 | 542 | 16 | | `rt3` (house) | 708 | 708 | 16 | So the exact address from the report (`0x100000000`, inside the first Wine stack region) is also the dominant source of these null CPU-memory views on this card, and the guard path asks about the same bottom block 16 times per run. This is counted/left-writable behaviour, not a crash here, but it confirms the window overlap is not specific to the RX 7900 XTX or GE-Proton 11-14. Logs: `/home/shlong/Documents/VKtory-capture/perf-{city70,boatsave-profile,rt3}/20261202-*/`. I have not tried reserving the window before Wine's first threads; that needs a loader change and is owned by the TASKS item.
Author
Owner

@⁠firefloc on GitHub · 2026-12-02 17:30 UTC · original

I checked main at 9388397: XMemVirtualAlloc still chooses addresses starting at 0x1_0000_0000 when the title requests an allocation. In a separate no-title probe on system Wine 11.23, a PE TLS callback and main already observed the same initial thread stack. The first 2 MiB of the title window were free in this probe. Reserving them from main succeeded, and a subsequently created thread's stack was outside them. This establishes ordering for the initial stack on this Wine version, without reproducing the GE-Proton stack overlap.

To guarantee ownership, look for a Wine startup or loader reservation before initial Windows stack placement, then verify under GE-Proton that Wine leaves the range alone and that VKtory can still split, replace, and release title placeholders without exposing gaps for host allocations. Keep the #141 foreign-stack guard check while adding that startup coverage.

**@⁠firefloc** on GitHub · 2026-12-02 17:30 UTC · [original](https://github.com/vktory6/VKtory/issues/140#issuecomment-7353374890) I checked `main` at `9388397`: `XMemVirtualAlloc` still chooses addresses starting at `0x1_0000_0000` when the title requests an allocation. In a separate no-title probe on system Wine 11.23, a PE TLS callback and `main` already observed the same initial thread stack. The first 2 MiB of the title window were free in this probe. Reserving them from `main` succeeded, and a subsequently created thread's stack was outside them. This establishes ordering for the initial stack on this Wine version, without reproducing the GE-Proton stack overlap. To guarantee ownership, look for a Wine startup or loader reservation before initial Windows stack placement, then verify under GE-Proton that Wine leaves the range alone and that VKtory can still split, replace, and release title placeholders without exposing gaps for host allocations. Keep the #141 foreign-stack guard check while adding that startup coverage.
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 18:38 UTC · original

Thanks to both of you. Both findings are in "Wine's first thread stacks lie inside the title window": github.com/vktory6/VKtory@a58cd901dd

  • TheRifai: on the reference card the null CPU-memory views at 0x100000000 make up most of that kind in every save (111/111, 542/583, 708/708), and the guards ask about the bottom block 16 times a run. So it isn't specific to the RX 7900 XTX or GE-Proton 11-14.
  • firefloc: the probe shows that reserving from main is too late for the initial stack. The reservation has to happen in Wine's start-up before the first stack is placed. One lead to check is in the task: Wine's preloader reserves a range given in WINEPRELOADRESERVE before ntdll loads. Open questions there: whether GE-Proton honours it and keeps its own allocations out, and whether umem can still split, replace and release title placeholders inside it without gaps. Your point about keeping the #141 guard check is in there too.

Leaving this open until the window is reserved.

**@⁠vktory6** on GitHub · 2026-12-02 18:38 UTC · [original](https://github.com/vktory6/VKtory/issues/140#issuecomment-7354924770) Thanks to both of you. Both findings are in "Wine's first thread stacks lie inside the title window": https://github.com/vktory6/VKtory/commit/a58cd901ddf9004fdcbc8a1a936f868cca0e0e5d - TheRifai: on the reference card the null CPU-memory views at `0x100000000` make up most of that kind in every save (111/111, 542/583, 708/708), and the guards ask about the bottom block 16 times a run. So it isn't specific to the RX 7900 XTX or GE-Proton 11-14. - firefloc: the probe shows that reserving from `main` is too late for the initial stack. The reservation has to happen in Wine's start-up before the first stack is placed. One lead to check is in the task: Wine's preloader reserves a range given in `WINEPRELOADRESERVE` before ntdll loads. Open questions there: whether GE-Proton honours it and keeps its own allocations out, and whether umem can still split, replace and release title placeholders inside it without gaps. Your point about keeping the #141 guard check is in there too. Leaving this open until the window is reserved.
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 19:33 UTC · original

Related discussion, for anyone following this: https://github.com/vktory6/VKtory/discussions/264 ("Our own runtime vs Wine") covers thread stacks, address-space placement and the other places where Wine/Proton behaviour matters here.

**@⁠vktory6** on GitHub · 2026-12-02 19:33 UTC · [original](https://github.com/vktory6/VKtory/issues/140#issuecomment-7356375461) Related discussion, for anyone following this: https://github.com/vktory6/VKtory/discussions/264 ("Our own runtime vs Wine") covers thread stacks, address-space placement and the other places where Wine/Proton behaviour matters here.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/vktory6--VKtory#140
No description provided.