Re: [PATCH v48 0/5] MR7650: Add support for AF_UNIX sockets (followup)
Prepared against `afunix` — four commits on top of `c869f8ed4eb`: ``` git fetch https://gitlab.winehq.org/giang17/wine afunix-followup ``` | commit | addresses | |---|---| | `server: harden the AF_UNIX socket path handling` | the two robustness points from note 148141 — `sun_path` length check, `chdir()` restored on the connect error path | | `ntdll: report bound AF_UNIX sockets as reparse points` | note 148143 — `S_ISSOCK` gets `FILE_ATTRIBUTE_REPARSE_POINT` + `IO_REPARSE_TAG_AF_UNIX`, and the four `S_ISREG`/`S_ISDIR` guards accept it | | `server: give AF_UNIX sockets their family before bind` | note 148148 — `init_socket()` presets `sun_family` for `WS_AF_UNIX` | | `server: open bound AF_UNIX sockets as reparse points` | note 148274 — `open_fd()` and `get_reparse_point()` | 85 lines across `dlls/ntdll/unix/file.c`, `server/fd.c` and `server/sock.c`. ## One change is not a straight port `open_fd()` on this branch handles the socket case inside `if (fd->unix_fd == -1)`, with the `stat()` already done and an `else` that raises the error — a different shape from the `goto skip_open_fail` the staging patch used, which is what the downstream tree still had. The change had to be rewritten for it: the two reparse cases became further branches of that existing cascade rather than a separate block earlier in the function. Behaviour is the same, and it composes with what follows — `st` is filled by the `stat()` above when the open fails, `fstat()` overwrites it when `O_PATH` succeeds, so `*mode` and the `S_ISSOCK` inode branch below both see the right thing. But since it is the one hunk that was not carried over unchanged, it is the one worth reading closely. ## Verification Built and measured on this branch, not carried over from downstream — fresh tree, fresh prefix, `../configure --prefix=/usr/local --enable-win64`. Each commit measured on top of the previous one, so the numbers in the commit messages are what that commit actually does rather than what the series does: | tree | `sock.c:146xx-147xx` | clears | |---|---:|---| | `afunix` (baseline) | 32 | — | | + harden | 32 | nothing — robustness only, as expected | | + ntdll reparse attribute | 24 | `14624`, `14703` | | + family | 16 | `14658`, `14693` | | + open / get_reparse_point | **0** | `14712`, `14716`, `14719`, `14720` | Eight assertions, each ×4 for the path forms the suite exercises (relative, `.\tmp.sock`, absolute DOS, `\??\`-prefixed NT) — 32 in total, and `test_afunix` now runs to the end with nothing failing. Three separate runs of the full series give 0 every time, at totals of 9, 23 and 42. That spread is the `TransmitFile` noise from note 148148 — the reason to count the `sock.c:146xx-147xx` range rather than the total. `ntdll:file` and `kernel32:file` are both at **0 failures** on the patched tree, which matters here because `open_fd()` is on the path of every file open, not only socket files. The commits carry a `Signed-off-by` and the branch's existing ones do not — rebase, squash, reword or re-author them however suits the series. ## Two limitations `O_PATH` is Linux-specific and there is no configure check for it. Guarded by `#ifdef`, a platform without it keeps the current behaviour for the reparse open; the plain open still reports `ERROR_CANT_ACCESS_FILE` there, since that branch does not depend on `O_PATH`. `FILE_DELETE_ON_CLOSE` combined with `FILE_OPEN_REPARSE_POINT` still takes the deletion branch, leaving `unix_fd` at -1, so `FSCTL_GET_REPARSE_POINT` would not answer on such a handle. The suite does not exercise that combination and the behaviour is unchanged, but it is a gap rather than a decision. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7650#note_148336
participants (1)
-
Giang Nguyen (@giang17)