fix(libkernel): reject port-zero connect on unconnected sockets #6884

Merged
MarcZX10 merged 4 commits from upstream-pr/6884 into main 2026-10-18 18:51:56 +00:00
MarcZX10 commented 2026-10-16 16:00:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T16:00:00Z.


What

Fixes #6880. Rejects connect() to port zero on unconnected IPv4 and IPv6 stream or datagram sockets with EADDRNOTAVAIL (49), matching FreeBSD 11.4. A connected stream socket still reports EISCONN; connected datagram behavior and sendto/sendmsg are unchanged. The implementation carries Hussein Kadhim’s two commits, preserving his authorship.

Tested

  • Linux x86_64, GCC 12.2, Release: fresh configuration and guest_socket_port_zero_tests target build passed.
  • CTest could not execute the test because this host lacks the project-required LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA CPU features; the host CPU guard stops it before socket checks.
  • The reviewer ran guest_socket_port_zero and the non-GPU socket/network tests on Linux after locally applying the same stream-socket predicate; all those tests passed, with only the two known baseline file-writer failures in the full suite. That run was on the previous PR head plus their local patch, not this pushed follow-up.
  • git diff --check and python3 tools/check_conventions.py --base upstream/main pass for this follow-up.

Checklist

  • Based on current main; no other open PR implements the same behavior
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • No notes, investigation files or images added
  • Generic behavior, not title-specific
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4890935887 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T16:00:00Z. --- ### What Fixes #6880. Rejects `connect()` to port zero on unconnected IPv4 and IPv6 stream or datagram sockets with `EADDRNOTAVAIL` (49), matching FreeBSD 11.4. A connected stream socket still reports `EISCONN`; connected datagram behavior and `sendto`/`sendmsg` are unchanged. The implementation carries Hussein Kadhim’s two commits, preserving his authorship. ### Tested - Linux x86_64, GCC 12.2, Release: fresh configuration and `guest_socket_port_zero_tests` target build passed. - CTest could not execute the test because this host lacks the project-required LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA CPU features; the host CPU guard stops it before socket checks. - The reviewer ran `guest_socket_port_zero` and the non-GPU socket/network tests on Linux after locally applying the same stream-socket predicate; all those tests passed, with only the two known baseline file-writer failures in the full suite. That run was on the previous PR head plus their local patch, not this pushed follow-up. - `git diff --check` and `python3 tools/check_conventions.py --base upstream/main` pass for this follow-up. ### Checklist - [x] Based on current `main`; no other open PR implements the same behavior - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] No notes, investigation files or images added - [x] Generic behavior, not title-specific - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-16 16:11:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T16:11:58Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4972 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 6044 core/libs/prx/libkernel/CMakeLists.txt
PR 6226 core/libs/prx/libkernel/CMakeLists.txt
PR 6244 core/libs/prx/libkernel/CMakeLists.txt
PR 6510 docs/dev/debt/libkernel.md
PR 6519 docs/dev/debt/libkernel.md
PR 6534 docs/dev/debt/libkernel.md
PR 6658 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 6908 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 6977 core/libs/prx/libkernel/CMakeLists.txt
core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7088 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/CMakeLists.txt
core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 7299 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 7447 docs/dev/debt/libkernel.md
PR 7450 core/libs/prx/libkernel/CMakeLists.txt
PR 7509 docs/dev/debt/libkernel.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6219653577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6219653577). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T16:11:58Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 4972](https://www.github.com/boykopovar/AnyPS5/pull/4972) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6226](https://www.github.com/boykopovar/AnyPS5/pull/6226) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6244](https://www.github.com/boykopovar/AnyPS5/pull/6244) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6510](https://www.github.com/boykopovar/AnyPS5/pull/6510) | `docs/dev/debt/libkernel.md` | | [PR 6519](https://www.github.com/boykopovar/AnyPS5/pull/6519) | `docs/dev/debt/libkernel.md` | | [PR 6534](https://www.github.com/boykopovar/AnyPS5/pull/6534) | `docs/dev/debt/libkernel.md` | | [PR 6658](https://www.github.com/boykopovar/AnyPS5/pull/6658) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 6908](https://www.github.com/boykopovar/AnyPS5/pull/6908) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7049](https://www.github.com/boykopovar/AnyPS5/pull/7049) | `docs/dev/debt/libkernel.md` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7105](https://www.github.com/boykopovar/AnyPS5/pull/7105) | `docs/dev/debt/libkernel.md` | | [PR 7149](https://www.github.com/boykopovar/AnyPS5/pull/7149) | `docs/dev/debt/libkernel.md` | | [PR 7192](https://www.github.com/boykopovar/AnyPS5/pull/7192) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/libs/prx/libkernel/Socket/src/Udp.cpp` | | [PR 7299](https://www.github.com/boykopovar/AnyPS5/pull/7299) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 7447](https://www.github.com/boykopovar/AnyPS5/pull/7447) | `docs/dev/debt/libkernel.md` | | [PR 7450](https://www.github.com/boykopovar/AnyPS5/pull/7450) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7509](https://www.github.com/boykopovar/AnyPS5/pull/7509) | `docs/dev/debt/libkernel.md` |
jotitadev commented 2026-10-16 17:12:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T17:12:19Z.

Review: COMMENTED


First native run of the new test on Linux (the description notes CTest could not execute it on the author's host).

Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON.
Head 34425f6eb merged onto main 66e290f1c.

Results:

  • guest_socket_port_zero fails on Linux in CheckStream(2):
    connect to port 0 on an unconnected stream socket must fail with EADDRNOTAVAIL (49) (errno 61)
    The UDP IPv4 and IPv6 checks before it pass.
  • Cause: the stream case keeps the host's answer, and the Linux host returns ECONNREFUSED for a TCP connect() to 127.0.0.1:0 / [::1]:0 (checked with a plain host probe: TCP -> ECONNREFUSED, UDP -> success). So "TCP already returns 49" holds on Windows, not on Linux.
  • Test-only on main (fix reverted): fails earlier, in CheckDatagram(2) with errno 2, as expected.
  • Full non-GPU suite (-E "^agc|gpu|vulkan|video_out"): 648/651 with the PR vs 648/650 on base; the extra failure is guest_socket_port_zero. The other two are the known file_writer_binary/file_writer_text failures on this host, also on base.

FreeBSD's in_pcbconnect_setup() (shared by tcp_connect() and udp_connect()) rejects port 0 with EADDRNOTAVAIL for both socket types, so extending the check to stream sockets would match FreeBSD on every host. I tried that locally by changing the type check in ZeroPortDatagramConnect to accept type 1 and 2: guest_socket_port_zero and the other 17 socket/UDP/net tests pass on Linux, and the full non-GPU suite is back to the 2 known failures. The connected-stream EISCONN and sendto checks are unaffected, since getpeername succeeds there. The alternative is to drop the stream port-0 assertion, but then Linux keeps returning 61 where FreeBSD returns 49.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5551157319 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#pullrequestreview-5551157319). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T17:12:19Z. **Review:** COMMENTED --- First native run of the new test on Linux (the description notes CTest could not execute it on the author's host). Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`. Head `34425f6eb` merged onto `main` `66e290f1c`. Results: - `guest_socket_port_zero` fails on Linux in `CheckStream(2)`: `connect to port 0 on an unconnected stream socket must fail with EADDRNOTAVAIL (49) (errno 61)` The UDP IPv4 and IPv6 checks before it pass. - Cause: the stream case keeps the host's answer, and the Linux host returns `ECONNREFUSED` for a TCP `connect()` to `127.0.0.1:0` / `[::1]:0` (checked with a plain host probe: TCP -> `ECONNREFUSED`, UDP -> success). So "TCP already returns 49" holds on Windows, not on Linux. - Test-only on `main` (fix reverted): fails earlier, in `CheckDatagram(2)` with errno 2, as expected. - Full non-GPU suite (`-E "^agc|gpu|vulkan|video_out"`): 648/651 with the PR vs 648/650 on base; the extra failure is `guest_socket_port_zero`. The other two are the known `file_writer_binary`/`file_writer_text` failures on this host, also on base. FreeBSD's `in_pcbconnect_setup()` (shared by `tcp_connect()` and `udp_connect()`) rejects port 0 with `EADDRNOTAVAIL` for both socket types, so extending the check to stream sockets would match FreeBSD on every host. I tried that locally by changing the type check in `ZeroPortDatagramConnect` to accept type 1 and 2: `guest_socket_port_zero` and the other 17 socket/UDP/net tests pass on Linux, and the full non-GPU suite is back to the 2 known failures. The connected-stream `EISCONN` and `sendto` checks are unaffected, since `getpeername` succeeds there. The alternative is to drop the stream port-0 assertion, but then Linux keeps returning 61 where FreeBSD returns 49. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-16 17:18:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T17:18:03Z.


Thanks for the Linux matrix and source investigation. I broadened the predicate in 629c069c1 to unconnected IPv4/IPv6 stream and datagram sockets, kept the getpeername guard so connected stream sockets retain EISCONN, and updated the debt note and PR scope. The Windows checks and builds I ran on the prior head did not cover Linux TCP; your Linux run exercised the corresponding widened predicate and reported the socket/network tests passing. I could not run the updated binary here: fresh configuration is blocked because this Linux host lacks XRandR support. Local conventions and git diff --check pass. Could you rerun guest_socket_port_zero on the pushed head when convenient?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6220861373 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6220861373). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T17:18:03Z. --- Thanks for the Linux matrix and source investigation. I broadened the predicate in `629c069c1` to unconnected IPv4/IPv6 stream and datagram sockets, kept the `getpeername` guard so connected stream sockets retain `EISCONN`, and updated the debt note and PR scope. The Windows checks and builds I ran on the prior head did not cover Linux TCP; your Linux run exercised the corresponding widened predicate and reported the socket/network tests passing. I could not run the updated binary here: fresh configuration is blocked because this Linux host lacks XRandR support. Local conventions and `git diff --check` pass. Could you rerun `guest_socket_port_zero` on the pushed head when convenient?
MarcZX10 commented 2026-10-16 17:20:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T17:20:40Z.


Correction to my previous validation note: I completed a fresh Linux configure and built guest_socket_port_zero_tests successfully. CTest then stopped at AnyPS5’s host CPU guard before socket checks because this Xeon lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA. The PR description now records the corrected build/test status.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6220904211 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6220904211). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T17:20:40Z. --- Correction to my previous validation note: I completed a fresh Linux configure and built `guest_socket_port_zero_tests` successfully. CTest then stopped at AnyPS5’s host CPU guard before socket checks because this Xeon lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA. The PR description now records the corrected build/test status.
MarcZX10 commented 2026-10-16 19:59:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T19:59:31Z.


Thanks for the Linux run and the negative control. This confirms that the port-zero normalization currently applies only to datagram sockets: Linux returns ECONNREFUSED for an unconnected stream while FreeBSD returns EADDRNOTAVAIL. Your local extension to stream sockets passes the focused socket tests and restores the full non-GPU suite to its two baseline failures. I will update the PR to normalize unconnected stream port-zero connects too, preserving the connected-stream checks, and report the focused validation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223610065 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6223610065). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T19:59:31Z. --- Thanks for the Linux run and the negative control. This confirms that the port-zero normalization currently applies only to datagram sockets: Linux returns `ECONNREFUSED` for an unconnected stream while FreeBSD returns `EADDRNOTAVAIL`. Your local extension to stream sockets passes the focused socket tests and restores the full non-GPU suite to its two baseline failures. I will update the PR to normalize unconnected stream port-zero connects too, preserving the connected-stream checks, and report the focused validation.
MarcZX10 commented 2026-10-16 20:00:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T20:00:16Z.


The stream normalization is now present in the PR head as commit 629c069c1b3a106abca3d6729874726266d792b6 (fix(libkernel): match FreeBSD port-zero stream connects). It extends the unconnected zero-port check to stream sockets, leaving the connected-stream EISCONN and sendto behavior intact. guest_socket_port_zero_tests builds locally; CTest is blocked before the test by this host’s PS5 CPU-feature guard (missing LZCNT, BMI1/2, MOVBE, AVX2 and FMA). The Linux review reported the focused socket and related tests passing with this change. Current PR checks: conventions, eligibility and report pass; full Linux/Windows and unrelated targeted jobs are skipped by workflow conditions.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223622868 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6223622868). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T20:00:16Z. --- The stream normalization is now present in the PR head as commit `629c069c1b3a106abca3d6729874726266d792b6` (`fix(libkernel): match FreeBSD port-zero stream connects`). It extends the unconnected zero-port check to stream sockets, leaving the connected-stream `EISCONN` and `sendto` behavior intact. `guest_socket_port_zero_tests` builds locally; CTest is blocked before the test by this host’s PS5 CPU-feature guard (missing LZCNT, BMI1/2, MOVBE, AVX2 and FMA). The Linux review reported the focused socket and related tests passing with this change. Current PR checks: conventions, eligibility and report pass; full Linux/Windows and unrelated targeted jobs are skipped by workflow conditions.
MarcZX10 commented 2026-10-16 20:53:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T20:53:02Z.


I have opened #6950 for the distinct listening-socket EOPNOTSUPP behavior from #6923. I manually checked the shared Udp.cpp hunks: #6884 adds the port-zero helper/check, while #6950 adds the listener check after address conversion and before the family check. They can coexist; if either lands first, I will preserve both changes when rebasing. #6950 also notes the shared-file overlap and the test evidence/limits.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6224484882 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6224484882). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T20:53:02Z. --- I have opened #6950 for the distinct listening-socket `EOPNOTSUPP` behavior from #6923. I manually checked the shared `Udp.cpp` hunks: #6884 adds the port-zero helper/check, while #6950 adds the listener check after address conversion and before the family check. They can coexist; if either lands first, I will preserve both changes when rebasing. #6950 also notes the shared-file overlap and the test evidence/limits.
oneandonlydean commented 2026-10-17 05:03:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T05:03:27Z.


@MarcZX100 #6950 has merged and now conflicts with this PR in Udp.cpp. Could you rebase onto main? Please keep the listener check ahead of the port-zero check when you resolve it, since that order is what review passed. We'll run full CI on the new head and merge it once that's green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6229937233 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6229937233). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T05:03:27Z. --- @MarcZX100 #6950 has merged and now conflicts with this PR in Udp.cpp. Could you rebase onto main? Please keep the listener check ahead of the port-zero check when you resolve it, since that order is what review passed. We'll run full CI on the new head and merge it once that's green.
blawesom commented 2026-10-17 09:35:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T09:35:45Z.


Rebase handoff — rebased onto current main (all commits, authorship unchanged). Three successive conflicts in Udp.cpp, all the same shape: main's newer Listening() helper kept alongside this PR's evolving port-zero connect check (UnsetPort → ZeroPortDatagramConnect → ZeroPortConnect across the series, each step's refinement preserved).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1335/1336 — the only failure is the known main regression (agc_driver_tessellation segfault, #4727), not this PR

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6884
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is ba915c253.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232357667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6232357667). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T09:35:45Z. --- **Rebase handoff** — rebased onto current `main` (all commits, authorship unchanged). Three successive conflicts in `Udp.cpp`, all the same shape: `main`'s newer `Listening()` helper kept alongside this PR's evolving port-zero connect check (`UnsetPort` → `ZeroPortDatagramConnect` → `ZeroPortConnect` across the series, each step's refinement preserved). Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1335/1336** — the only failure is the known `main` regression (`agc_driver_tessellation` segfault, #4727), not this PR **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6884 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `ba915c253`.
jotitadev commented 2026-10-17 11:19:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T11:19:57Z.

Review: COMMENTED


Rerun on the pushed head, as asked.

Machine: Linux x86_64, i7-8700 (passes the host CPU guard), Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON, full build.
Head 629c069c1 merged onto main d9b696ddb (clean merge).

  • guest_socket_port_zero passes, including the stream case that failed on 34425f6eb.
  • Test file only on main: fails at the first check, connect to port 0 on an unconnected datagram socket must fail with EADDRNOTAVAIL (49), so the test still covers the change.
  • Socket/network tests (ctest -R "socket|udp|^guest_sce_net$|refused", 18 tests): all pass.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out"): 649/651. The two failures are file_writer_binary and file_writer_text, which fail the same way on main on this machine (648/650).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5557544804 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#pullrequestreview-5557544804). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-17T11:19:57Z. **Review:** COMMENTED --- Rerun on the pushed head, as asked. Machine: Linux x86_64, i7-8700 (passes the host CPU guard), Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`, full build. Head `629c069c1` merged onto `main` `d9b696ddb` (clean merge). - `guest_socket_port_zero` passes, including the stream case that failed on `34425f6eb`. - Test file only on `main`: fails at the first check, `connect to port 0 on an unconnected datagram socket must fail with EADDRNOTAVAIL (49)`, so the test still covers the change. - Socket/network tests (`ctest -R "socket|udp|^guest_sce_net$|refused"`, 18 tests): all pass. - Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out"`): 649/651. The two failures are `file_writer_binary` and `file_writer_text`, which fail the same way on `main` on this machine (648/650). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-17 12:42:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T12:42:49Z.


Rebased onto current main (c9e6c45de) and incorporated the reviewed stream-socket port-zero handling from the rebase handoff. The two original commits remain authored by Hussein Kadhim; my follow-up commit remains authored by MarcZX100. guest_socket_port_zero_tests and libkernel build on Linux, check_conventions.py and git diff --check pass. I attempted guest_socket_port_zero; this host stops at the project CPU guard because it lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA, so runtime assertions remain for CI. The new head is 9452647ed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234012406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6234012406). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T12:42:49Z. --- Rebased onto current `main` (`c9e6c45de`) and incorporated the reviewed stream-socket port-zero handling from the rebase handoff. The two original commits remain authored by Hussein Kadhim; my follow-up commit remains authored by MarcZX100. `guest_socket_port_zero_tests` and `libkernel` build on Linux, `check_conventions.py` and `git diff --check` pass. I attempted `guest_socket_port_zero`; this host stops at the project CPU guard because it lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA, so runtime assertions remain for CI. The new head is `9452647ed`.
MarcZX10 commented 2026-10-17 12:43:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T12:43:50Z.


The new CI run is now complete: conventions, eligibility and report pass, but Linux, Windows, register-context, relinker and write-watch jobs were skipped by the workflow path filter. Since the earlier handoff requested full CI on the rebased head, could a maintainer dispatch the full build/test workflow for 9452647ed?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234022748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6234022748). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T12:43:50Z. --- The new CI run is now complete: conventions, eligibility and report pass, but Linux, Windows, register-context, relinker and write-watch jobs were skipped by the workflow path filter. Since the earlier handoff requested full CI on the rebased head, could a maintainer dispatch the full build/test workflow for `9452647ed`?
MarcZX10 commented 2026-10-17 13:18:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:18:05Z.


Thanks for rerunning the pushed head. The focused port-zero test and all 18 socket/network tests now pass on Linux; the only two non-GPU suite failures match base. This resolves the earlier Linux runtime gap. The hosted PR workflow still skipped the full platform jobs, so I’ll retain that limitation in the PR status notes.

AI-assisted: yes (Codex); report reviewed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234347497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6234347497). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T13:18:05Z. --- Thanks for rerunning the pushed head. The focused port-zero test and all 18 socket/network tests now pass on Linux; the only two non-GPU suite failures match base. This resolves the earlier Linux runtime gap. The hosted PR workflow still skipped the full platform jobs, so I’ll retain that limitation in the PR status notes. AI-assisted: yes (Codex); report reviewed.
jotitadev commented 2026-10-17 23:33:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T23:33:35Z.

Review: COMMENTED


Run on the rebased head 9452647ed, which the author's host cannot execute (CPU guard), and one ordering issue from the conflict resolution.

Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON, full build.
Head 9452647ed merged onto main 5de7a46e0 (clean merge).

  • guest_socket_port_zero and guest_socket_connect_listening pass, as do the other socket/network tests (ctest -R "socket|udp|^guest_sce_net$|refused", 21 tests).
  • Test file and its registration only, on main: fails at connect to port 0 on an unconnected datagram socket must fail with EADDRNOTAVAIL (49) (errno 2), so the test still covers the change.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out"): 698/698, the 697 tests of main plus guest_socket_port_zero.

Ordering: @oneandonlydean asked to keep the listener check ahead of the port-zero check. In 9452647ed, connect_nid_postfix calls ZeroPortConnect (Udp.cpp:1007) before if (socket->type == 1 && Listening(*socket)) return Fail(45); (Udp.cpp:1014). A listening stream socket has no peer, so ZeroPortConnect takes it and returns EADDRNOTAVAIL. I added one line to CheckStream before the close, connect_nid_postfix(listener, zero.data(), size) expecting -1 with errno 45:

  • with the PR: fails, errno 49;
  • with the ZeroPortConnect line moved after the Listening check: guest_socket_port_zero (with that line) and guest_socket_connect_listening pass.

FreeBSD's soconnectat() returns EOPNOTSUPP for a socket with SO_ACCEPTCONN before it reaches the protocol's connect, so 45 should win for a listener whatever the address.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5560634772 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#pullrequestreview-5560634772). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-17T23:33:35Z. **Review:** COMMENTED --- Run on the rebased head `9452647ed`, which the author's host cannot execute (CPU guard), and one ordering issue from the conflict resolution. Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`, full build. Head `9452647ed` merged onto `main` `5de7a46e0` (clean merge). - `guest_socket_port_zero` and `guest_socket_connect_listening` pass, as do the other socket/network tests (`ctest -R "socket|udp|^guest_sce_net$|refused"`, 21 tests). - Test file and its registration only, on `main`: fails at `connect to port 0 on an unconnected datagram socket must fail with EADDRNOTAVAIL (49) (errno 2)`, so the test still covers the change. - Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out"`): 698/698, the 697 tests of `main` plus `guest_socket_port_zero`. Ordering: @oneandonlydean asked to keep the listener check ahead of the port-zero check. In `9452647ed`, `connect_nid_postfix` calls `ZeroPortConnect` (Udp.cpp:1007) before `if (socket->type == 1 && Listening(*socket)) return Fail(45);` (Udp.cpp:1014). A listening stream socket has no peer, so `ZeroPortConnect` takes it and returns `EADDRNOTAVAIL`. I added one line to `CheckStream` before the close, `connect_nid_postfix(listener, zero.data(), size)` expecting -1 with errno 45: - with the PR: fails, `errno 49`; - with the `ZeroPortConnect` line moved after the `Listening` check: `guest_socket_port_zero` (with that line) and `guest_socket_connect_listening` pass. FreeBSD's `soconnectat()` returns `EOPNOTSUPP` for a socket with `SO_ACCEPTCONN` before it reaches the protocol's connect, so 45 should win for a listener whatever the address. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-18 18:26:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T18:26:16Z.


I rebased #6884 onto current main (cd20b7f6f) and addressed the listener ordering reported on the review:

  • connect_nid_postfix now returns EOPNOTSUPP for an already-listening stream socket before applying the port-zero rule.
  • guest_socket_port_zero now checks that connecting the listener to a zero-port address returns EOPNOTSUPP for IPv4 and IPv6.

The rebased tree passes tools/check_conventions.py --base upstream/main and git diff --check. The focused test target compiled in the existing Linux review build. CTest stopped before the assertions because this host lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA; that runtime result is not counted as a pass. Hosted checks for the new head are pending.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253512568 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6884#issuecomment-6253512568). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T18:26:16Z. --- I rebased #6884 onto current `main` (`cd20b7f6f`) and addressed the listener ordering reported on the review: - `connect_nid_postfix` now returns `EOPNOTSUPP` for an already-listening stream socket before applying the port-zero rule. - `guest_socket_port_zero` now checks that connecting the listener to a zero-port address returns `EOPNOTSUPP` for IPv4 and IPv6. The rebased tree passes `tools/check_conventions.py --base upstream/main` and `git diff --check`. The focused test target compiled in the existing Linux review build. CTest stopped before the assertions because this host lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA; that runtime result is not counted as a pass. Hosted checks for the new head are pending.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
boykopovar/AnyPS5!6884
No description provided.