Skip to content

winrun: Steam sign-in window renders (cross-process drawing, Z order, socket owners) - #107

Merged
v3nn7 merged 10 commits into
mainfrom
fix/steam-window
Nov 5, 2026
Merged

v3nn7 merged 10 commits into
mainfrom
fix/steam-window

Conversation

@v3nn7

@v3nn7 v3nn7 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #106, which was merged before these commits. With this PR the 64-bit Steam client shows a fully rendered "Sign in to Steam" window: the sign-in form, plus the QR code the Steam servers send.

Changes

  • Socket owner PIDs (kernel/src/net.rs; NetSocket::pid takes the place of the old reserved field, so the record stays 56 bytes; GetExtendedTcpTable now fills dwOwningPid). Steam answered its web UI websocket with 403 because it could not identify the peer process.
  • atlthunk.dll (window procedure thunks for ATL), plus CallWindowProcA, PtInRegion and Shell_NotifyIconA: steamwebhelper.exe died right after creating its window.
  • RWX pages that are not present switch too (mem.rs): V8 code pages that were discarded while read-execute faulted, and the renderer died. MEM_RESET now keeps pages committed, as on Windows.
  • Drawing on another process's window: window handles name their process, so a handle is valid in every process, as on Windows. GetDC + BitBlt on another process's window sends the pixels to the owning process through its handle service (new DRAW request), and the owner draws them. IsWindow asks the owner (IS_WINDOW request). Chromium's GPU process draws the browser's window this way. Test: xwindow.exe (6/6 on Windows 11).
  • Z order: windows go to the top when created, shown, activated or placed at HWND_TOP. EnumWindows lists top-level windows (no child or message-only windows) from the top down. Before this, Chromium's occlusion tracking marked Steam's window as covered, and the renderer never drew.
  • Winsock: a non-blocking connect returns WSAEWOULDBLOCK even when the connection completes or fails at once. select with every set empty fails with WSAEINVAL. Both checked on Windows 11; winsock.exe updated to match.
  • File sharing: an open for no data access (WRITE_DAC, READ_CONTROL, attributes only) is not checked against other opens' share modes, as on Windows. Chromium's PreventExecuteMapping failed on the file renderers park strings in, and the renderer died about 75 s after the window appeared.
  • Diagnostics, enabled with environment variables: OSYX_WINRUN_ECHO_FILES (copy what a program writes to matching files to stderr), OSYX_WINRUN_APPEND_ARGS (add arguments to matching child programs), OSYX_WINRUN_TRACE_FILES (log file I/O), named threads in stall reports, a per-thread syscall record for thread ids up to 8192 (kernel), and traces of socket data and dispatched faults under FAILTRACE.

Verification

  • Steam test runs on OSyx/QEMU, s67n through s67r: sign-in window rendered, and the renderer was stable for 180 s in s67r.
  • Win32 suite on OSyx before the file-sharing commit: 2947 passed, 0 failed.
  • Not run on this exact branch head: a build and the suite after cherry-picking onto main.

Remaining

  • ANGLE/SwiftShader EGL initialisation fails in the GPU process; Chromium falls back to software compositing.
  • Web fonts (MotivaSans) fail to load in the renderer.

Labels: bug, network, kernel, desktop

🤖 Generated with Claude Code

v3nn7 and others added 10 commits November 5, 2026 01:42
Shows what a program's socket traffic carries (the first 240 bytes of
the first 300 transfers, as escaped text) for send, recv, WSASend and
WSARecv, overlapped or not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steam's client answers its web UI transport socket with 403 Forbidden
unless the connecting process checks out: it looks the peer's port up
with GetExtendedTcpTable and opens the owning process. dwOwningPid was
always 0 (the kernel recorded no owner), OpenProcess(0) failed and every
connection from the web helper was refused.

The kernel's socket objects now record the process that made them
(socket or accept), the socket list reports it (NetSocket::pid, in the
former reserved field: the record stays 56 bytes), and
GetExtendedTcpTable fills dwOwningPid in its owner-PID and owner-module
classes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steam's web helper creates its main window ("SteamWebhelper") through
ATL, which takes its window procedure thunks from atlthunk.dll on
Windows 10 and later. The DLL was missing, ATL's fallback failed and it
raised STATUS_NO_MEMORY, ending the browser process a second after the
window appeared.

AtlThunk_AllocateData/InitData/DataToCode/FreeData hand out 16-byte
thunks from pools of a code page (written once, then executable) and a
data page: each thunk loads its first argument and procedure RIP-relative
from its data slot, so no code is written per thunk. newlibs.exe checks
the four functions (all pass on Windows 11).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rest of steamwebhelper.exe's delay imports: the web helper ended
with a delay-load failure on USER32!CallWindowProcA right after creating
the Steam window. CallWindowProcA calls the procedure as
CallWindowProcW does (messages are the same for both character sets in
this runtime), PtInRegion tests a point against a region's rectangles,
and Shell_NotifyIconA answers as Shell_NotifyIconW.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mmit

Steam's sign-in window appeared, then its renderer died writing V8 code
pages (PAGE_EXECUTE_READWRITE, committed). jit_fault only switched
present pages between read-write and read-execute; a page discarded
(DiscardVirtualMemory, MEM_RESET) or never touched while mapped
read-execute faults as not present, and the write went unhandled.

jit_fault now records the pages it made read-execute. A fault on a page
that is not present switches it too when its mapping forbids the access;
when the mapping allows it, the fault is the kernel failing to give a
frame and keeps the normal exception path, as before. Setting a
protection (commit, VirtualProtect) clears the record for its pages.

MEM_RESET no longer marks its pages uncommitted: on Windows they stay
committed with their protection.

The unhandled-exception report gives the page fault error code with an
access violation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Chromium's GPU process draws the browser process's windows: in software
compositing it calls GetDC on the browser's HWND and BitBlts each frame
into it. winrun's window handles were per-process counters and GetDC of
an unknown handle returned NULL, so Steam's sign-in window stayed black.

Window handles now name their process (0x20000000 + pid * 0x10000 +
4 * slot; slots go round so a destroyed window's handle is not reused at
once). GetDC of another live process's window gives a DC whose BitBlt
sends the pixels, in a shared memory object, to that process through its
handle service (new DRAW request); the owner draws them with its own
GetDC/ReleaseDC, which presents them. IsWindow of another process's
window asks that process (IS_WINDOW request).

xwindow.exe checks it with a child process blitting into its parent's
window (6/6 on Windows 11) and joins the Win32 checks under PRISM.

Diagnostics under OSYX_WINRUN_FAILTRACE: the first cross-process blits,
and an exception handed to the program's unhandled-exception filter (a
crash handler's filter usually ends the process silently).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- OSYX_WINRUN_ECHO_FILES=<part>[;<part>]: what the program writes to a
  file whose path contains a part goes to stderr too (Steam and CEF keep
  their logs in files inside the guest).
- OSYX_WINRUN_APPEND_ARGS=<part>:<args>: arguments added to children
  whose program path contains <part> ('+' separates, '~' is a comma), for
  Chromium's logging switches.
- Stall reports name each thread (SetThreadDescription).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steam's sign-in window stayed black: Chromium's native window occlusion
tracking walks EnumWindows and takes each listed window as covering the
ones after it. winrun listed every window of the process (child and
message-only windows too) in handle order, so older windows of the web
helper came before Steam's window and its content was marked occluded;
the renderer then never drew.

Windows now carry a place in the Z order: a window goes to the top when
created, shown (other than the no-activate and minimizing commands),
activated (SetForegroundWindow, SetActiveWindow, BringWindowToTop) or
placed at HWND_TOP/HWND_TOPMOST, and to the bottom at HWND_BOTTOM.
EnumWindows lists top-level, non-message-only windows from the top down;
GetTopWindow(NULL) gives the topmost.

With this, cross-process drawing and the earlier fixes, the 64-bit Steam
client shows its rendered "Sign in to Steam" window (QR code from the
Steam servers included).

Also: the stall reports' per-thread system call record covers thread
ids up to 8192 (kernel, diagnostics only), a DuplicateHandle of a
section refused for rights is named under FAILTRACE, and the first
EnumWindows results are traced.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A non-blocking connect whose connection fails at once (refused,
  unreachable, reset, timed out) returns WSAEWOULDBLOCK; SO_ERROR,
  FD_CONNECT and select report the failure, as on Windows.
- select with nothing in any set fails with WSAEINVAL (checked on
  Windows 11) instead of sleeping; winsock.exe expected the sleep.

The Win32 suite on OSyx: 2947 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Windows a CreateFile asking only for access that touches no data
(WRITE_DAC, READ_CONTROL, attributes) is not checked against the share
modes of other opens, and its own share mode restricts no one. winrun
counted it like any open, so Chromium's PreventExecuteMapping (which
reopens a fresh temporary file with WRITE_DAC to deny mapping it
executable) failed with a sharing violation on files the browser had
open, the temporary file its renderers park strings in included.

Diagnostics: OSYX_WINRUN_TRACE_FILES=<part> logs ReadFile and WriteFile
on matching files (offset, size, result), and faults dispatched to the
program's handlers are traced under OSYX_WINRUN_FAILTRACE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@v3nn7 v3nn7 added bug Something isn't working network Area: networking kernel Area: kernel desktop Area: desktop labels Nov 5, 2026
@v3nn7
v3nn7 merged commit 248fa5b into main Nov 5, 2026
4 checks passed
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codspeed

codspeed Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 36 untouched benchmarks


Comparing fix/steam-window (685e836) with main (dff9870)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (685e836) during the generation of this report, so dff9870 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working desktop Area: desktop kernel Area: kernel network Area: networking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant