feat(libSceLibcInternal): implement inet_netof, inet_lnaof, inet_makeaddr and inet_network #12924

Merged
heditrigui merged 4 commits from upstream-pr/12924 into main 2026-11-04 06:27:16 +00:00
heditrigui commented 2026-10-29 14:32:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by heditrigui on 2026-10-29T14:32:38Z.


What

Implement IPv4 network address helper functions in libSceLibcInternal (core/libs/prx/libSceLibcInternal/Inet.cpp):

  • inet_netof (NID UXEIr+tUsM4) and alias __inet_netof (NID 3R15U5X00nY): extract the network number in host byte order according to IPv4 class rules (Class A: top 8 bits, Class B: top 16 bits, Class C: top 24 bits).
  • inet_lnaof (NID 4y7OKpbXUDs) and alias __inet_lnaof (NID bD39ou3sn7w): extract the local network address (host part) in host byte order according to IPv4 class rules.
  • inet_makeaddr (NID 5YaIoLorY8A) and alias __inet_makeaddr (NID 9cf7QE7cmto): synthesize an in_addr structure in network byte order from host byte order network (net) and host (host) parts.
  • inet_network (NID -Qdf3rmtqRA) and alias __inet_network (NID xDCABmswhcM): parse numbers-and-dots IPv4 network strings (supporting decimal, octal 0..., and hexadecimal 0x... notations) into host byte order network numbers. Return INADDR_NONE (0xffffffffu) on invalid formats, out-of-range components, or nullptr.
  • Added unit tests in core/libs/tests/GuestInetAddress.cpp (CheckInetAddressHelpers) covering Class A, Class B, Class C address extraction, address construction, and network string parsing across standard, hex, octal, and malformed inputs.
  • Documented technical debt and reference alignment with FreeBSD 11.4 in docs/dev/debt/libSceLibcInternal.md.

Tested

  • Verified guest_inet_address test target on Linux x86-64 (CachyOS, kernel 6.17.7, GCC 15.2.0, glibc 2.42) by @blawesom (Release, BUILD_TESTING=ON): all assertions passed.
  • Ran python tools/check_conventions.py --base upstream/main --head HEAD cleanly (0 errors).
  • Ran python core/libs/tests/test_public_headers.py --audit-only cleanly (399 libraries, 26,751 exports verified; 0 errors).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5069920034 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12924). Originally posted by [heditrigui](https://github.com/heditrigui) on 2026-10-29T14:32:38Z. --- ### What Implement IPv4 network address helper functions in `libSceLibcInternal` (`core/libs/prx/libSceLibcInternal/Inet.cpp`): - `inet_netof` (NID `UXEIr+tUsM4`) and alias `__inet_netof` (NID `3R15U5X00nY`): extract the network number in host byte order according to IPv4 class rules (Class A: top 8 bits, Class B: top 16 bits, Class C: top 24 bits). - `inet_lnaof` (NID `4y7OKpbXUDs`) and alias `__inet_lnaof` (NID `bD39ou3sn7w`): extract the local network address (host part) in host byte order according to IPv4 class rules. - `inet_makeaddr` (NID `5YaIoLorY8A`) and alias `__inet_makeaddr` (NID `9cf7QE7cmto`): synthesize an `in_addr` structure in network byte order from host byte order network (`net`) and host (`host`) parts. - `inet_network` (NID `-Qdf3rmtqRA`) and alias `__inet_network` (NID `xDCABmswhcM`): parse numbers-and-dots IPv4 network strings (supporting decimal, octal `0...`, and hexadecimal `0x...` notations) into host byte order network numbers. Return `INADDR_NONE` (`0xffffffffu`) on invalid formats, out-of-range components, or `nullptr`. - Added unit tests in `core/libs/tests/GuestInetAddress.cpp` (`CheckInetAddressHelpers`) covering Class A, Class B, Class C address extraction, address construction, and network string parsing across standard, hex, octal, and malformed inputs. - Documented technical debt and reference alignment with FreeBSD 11.4 in `docs/dev/debt/libSceLibcInternal.md`. ### Tested - Verified `guest_inet_address` test target on Linux x86-64 (CachyOS, kernel 6.17.7, GCC 15.2.0, glibc 2.42) by @blawesom (`Release`, `BUILD_TESTING=ON`): all assertions passed. - Ran `python tools/check_conventions.py --base upstream/main --head HEAD` cleanly (0 errors). - Ran `python core/libs/tests/test_public_headers.py --audit-only` cleanly (399 libraries, 26,751 exports verified; 0 errors). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current main; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation .md files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
rooklz commented 2026-10-29 15:41:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T15:41:27Z.

Review: COMMENTED


Reviewed at dcdd2453ed (AI-assisted: yes). I tested the libSceLibcInternal code only. No console measurements.

What I ran (macOS arm64, clang, ASan + UBSan with no recovery)

  • Inet.cpp and GuestInetAddress.cpp built standalone from this head. The only stubs were __error and __inet_ntop, written as host shims. The test passes.

  • I compiled FreeBSD 11.4 inet_network.c, inet_netof.c, inet_lnaof.c and inet_makeaddr.c from 8c639945a4, the revision your debt line cites, and compared them with this code:

    • 3M random inet_network strings over 0-9 x X a-f A-F g G . \t \n - +
    • 3M random netof/lnaof/makeaddr triples, including net values near the class thresholds

    There were 0 mismatches, so the parser follows the cited file exactly.

  • NIDs: tools/nid_names.py names all eight NIDs as written.

  • Gates: check_conventions --base upstream/main passes, git diff --check is clean, and merge-tree against bb04a4f1ea is clean. pr_overlap shows only debt-file neighbours (#11748–#11752 at L22). No other PR touches Inet.cpp or the same exports.

1. A null text should throw, not return INADDR_NONE (requested)
FreeBSD's inet_network dereferences cp without checking it, so returning 0xffffffff for null is a result we made up. It also doesn't match this file: inet_aton throws on null (Inet.cpp:22, debt line 21: "a null text, which the console dereferences, throws"). To match:

    if (text == nullptr) throw std::invalid_argument("inet_network: null text");

Change the null row to expect the throw, and change the debt sentence "Null string returns INADDR_NONE" to say a null text throws.

2. Seven mutants survive the current rows (optional rows below kill all of them)
I made 20 single-edit mutants of the new code:

  • Killed: 10.
  • Equivalent: 3 (the netof/lnaof class tests written as 0x7f… or bit30 == 0). The differential confirms these give the same results.
  • Survived: 7, and each one is a real difference from FreeBSD:
    • upper-case hex digits use the 'a' base
    • !digit is skipped before a '.' (".1", "1..2" accepted)
    • the trailing check accepts only ' '
    • the trailing check also accepts '-'
    • the prefix accepts only lower-case 'x'
    • a hex digit doesn't set digit ("xf" rejected)
    • IsSpace narrowed to space and tab

These 5 rows kill all 7. I took the expected values from the compiled FreeBSD file, and the rows pass on this head:

    Require(inet_network_nid_postfix("0XAB") == 0xabu && inet_network_nid_postfix("0xAb.0XcD") == 0xabcdu && inet_network_nid_postfix("xF") == 0xfu, "inet_network upper-case hex");
    Require(inet_network_nid_postfix("x") == 0xffffffffu && inet_network_nid_postfix("X") == 0xffffffffu, "inet_network x without digits");
    Require(inet_network_nid_postfix("1..2") == 0xffffffffu && inet_network_nid_postfix(".1") == 0xffffffffu && inet_network_nid_postfix("1.") == 0xffffffffu, "inet_network empty part");
    Require(inet_network_nid_postfix("1\t") == 1u && inet_network_nid_postfix("1\n") == 1u && inet_network_nid_postfix("1\v") == 1u, "inet_network trailing whitespace");
    Require(inet_network_nid_postfix("1-") == 0xffffffffu, "inet_network trailing junk");

After adding them, all 17 non-equivalent mutants are killed.

Notes

  • The 3-clause BSD licence block above inet_network follows the precedent in libc/src/Math.cpp, so I have no objection there.
  • netof/lnaof/makeaddr match FreeBSD bit for bit, including class D and E treated as class C and net >= 2^24 giving net | host.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5700589828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12924#pullrequestreview-5700589828). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-29T15:41:27Z. **Review:** COMMENTED --- Reviewed at dcdd2453ed (AI-assisted: yes). I tested the libSceLibcInternal code only. No console measurements. **What I ran (macOS arm64, clang, ASan + UBSan with no recovery)** - `Inet.cpp` and `GuestInetAddress.cpp` built standalone from this head. The only stubs were `__error` and `__inet_ntop`, written as host shims. The test passes. - I compiled FreeBSD 11.4 `inet_network.c`, `inet_netof.c`, `inet_lnaof.c` and `inet_makeaddr.c` from `8c639945a4`, the revision your debt line cites, and compared them with this code: - 3M random `inet_network` strings over `0-9 x X a-f A-F g G . \t \n - +` - 3M random `netof`/`lnaof`/`makeaddr` triples, including `net` values near the class thresholds There were **0 mismatches**, so the parser follows the cited file exactly. - NIDs: `tools/nid_names.py` names all eight NIDs as written. - Gates: `check_conventions --base upstream/main` passes, `git diff --check` is clean, and `merge-tree` against bb04a4f1ea is clean. `pr_overlap` shows only debt-file neighbours (#11748–#11752 at L22). No other PR touches `Inet.cpp` or the same exports. **1. A null text should throw, not return `INADDR_NONE` (requested)** FreeBSD's `inet_network` dereferences `cp` without checking it, so returning `0xffffffff` for null is a result we made up. It also doesn't match this file: `inet_aton` throws on null (`Inet.cpp:22`, debt line 21: "a null text, which the console dereferences, throws"). To match: ```cpp if (text == nullptr) throw std::invalid_argument("inet_network: null text"); ``` Change the null row to expect the throw, and change the debt sentence "Null string returns `INADDR_NONE`" to say a null text throws. **2. Seven mutants survive the current rows (optional rows below kill all of them)** I made 20 single-edit mutants of the new code: - Killed: 10. - Equivalent: 3 (the netof/lnaof class tests written as `0x7f…` or `bit30 == 0`). The differential confirms these give the same results. - Survived: 7, and each one is a real difference from FreeBSD: - upper-case hex digits use the 'a' base - `!digit` is skipped before a '.' (`".1"`, `"1..2"` accepted) - the trailing check accepts only ' ' - the trailing check also accepts '-' - the prefix accepts only lower-case 'x' - a hex digit doesn't set `digit` (`"xf"` rejected) - `IsSpace` narrowed to space and tab These 5 rows kill all 7. I took the expected values from the compiled FreeBSD file, and the rows pass on this head: ```cpp Require(inet_network_nid_postfix("0XAB") == 0xabu && inet_network_nid_postfix("0xAb.0XcD") == 0xabcdu && inet_network_nid_postfix("xF") == 0xfu, "inet_network upper-case hex"); Require(inet_network_nid_postfix("x") == 0xffffffffu && inet_network_nid_postfix("X") == 0xffffffffu, "inet_network x without digits"); Require(inet_network_nid_postfix("1..2") == 0xffffffffu && inet_network_nid_postfix(".1") == 0xffffffffu && inet_network_nid_postfix("1.") == 0xffffffffu, "inet_network empty part"); Require(inet_network_nid_postfix("1\t") == 1u && inet_network_nid_postfix("1\n") == 1u && inet_network_nid_postfix("1\v") == 1u, "inet_network trailing whitespace"); Require(inet_network_nid_postfix("1-") == 0xffffffffu, "inet_network trailing junk"); ``` After adding them, all 17 non-equivalent mutants are killed. **Notes** - The 3-clause BSD licence block above `inet_network` follows the precedent in `libc/src/Math.cpp`, so I have no objection there. - netof/lnaof/makeaddr match FreeBSD bit for bit, including class D and E treated as class C and `net >= 2^24` giving `net | host`.
MarcZX10 commented 2026-10-29 16:29:54 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Reviewed — changes requested

The final component in inet_network is not range-checked, so the implementation and test accept 0x1234 although the cited FreeBSD 11.4 implementation rejects that component as greater than 0xff.

What I ran

Head 8c611f7be6f824ca2710969862170edc9f9bc11f; base bb04a4f1ea0175e9e4f149f0359a764d62ff3296. The head includes the base and merges cleanly. Environment: Debian 12, GCC 12.2.0, Release build; focused test executable run via QEMU x86_64 in Haswell mode.

cmake --build /dev/shm/AnyPS5-build-12915-full --target guest_inet_address_tests -j2
qemu-x86_64 -cpu Haswell -L / /dev/shm/AnyPS5-build-12915-full/tests/guest_inet_address_tests
git -C /dev/shm/AnyPS5-review-12915 diff --check bb04a4f1ea0175e9e4f149f0359a764d62ff3296...HEAD
python3 /dev/shm/AnyPS5-review-12915/tools/check_conventions.py --base bb04a4f1ea0175e9e4f149f0359a764d62ff3296
gh pr checks 12924 --repo boykopovar/AnyPS5

Results

Check Result
guest_inet_address_tests build Passed; target was up to date on the final build invocation.
guest_inet_address_tests via QEMU Passed, exit 0. Its current 0x1234 assertion passes and exposes the behavior mismatch described below.
git diff --check Passed, exit 0.
Conventions Passed locally and in CI.
Hosted checks Eligibility, intake, report, Windows, conventions, and labels passed. Linux and specialized jobs were skipped.
Exact output

Build:

[0/2] Re-checking globbed directories...
ninja: no work to do.

Focused QEMU test:

qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.pcid [bit 17]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
[src/HostCpu.cpp:193 operator()] host CPU Intel Core Processor (Haswell): has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, XSAVEOPT, OS AVX state (XCR0); lacks RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEC, SSE4A, PREFETCHW, CLZERO

Convention check:

All conventions checks passed.

Diff check emitted no output and exited 0. Hosted check output:

conventions	pass	22s	https://github.com/boykopovar/AnyPS5/actions/runs/40901459290/job/123544573919
labels	pass	6s	https://github.com/boykopovar/AnyPS5/actions/runs/40901459261/job/123544569472
report	pass	50s	https://github.com/boykopovar/AnyPS5/actions/runs/40901463593/job/123544581780
windows	pass	13m3s	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544923455
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927139
register-context	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927115
relinker	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927249
relinker-asan	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927935
write-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927948
eligibility	pass	6s	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544582315

Negative control

Assertion Change made to code under test Did the new test fail?
A one-component network value above 0xff returns INADDR_NONE, as FreeBSD 11.4 does No mutation; the PR test currently asserts 0x1234 is returned Not exercised as a regression assertion; the existing positive assertion passes.

Findings

Blocking

inet_network_nid_postfix validates value <= 0xff only when a dot is encountered. The final component bypasses that guard, and the count == 1 branch returns it unchanged. Thus inet_network("0x1234") returns 0x1234, while FreeBSD 11.4 rejects it at the per-component val > 0xffU check. The new test currently encodes the divergent result as expected behavior. Please range-check the final component and change the test to expect INADDR_NONE (or provide console evidence that justifies diverging from the stated FreeBSD reference and update the debt entry).

    if (!digit || value > 0xff) return 0xffffffffu;

Non-blocking

None identified in this pass.

Sources

Not verified

  • Console behavior; the PR marks these helpers unverified on console.
  • Linux-hosted CI was skipped by repository policy; local focused execution used QEMU user mode, not native hardware.
  • I did not run a negative-control mutation.

To get this to a good state

Reject a final inet_network component above 0xff and add a regression assertion for the single-component case, or document console evidence for the differing behavior. I will rerun the same commands on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5701305933 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12924#pullrequestreview-5701305933). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T16:29:54Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The final component in `inet_network` is not range-checked, so the implementation and test accept `0x1234` although the cited FreeBSD 11.4 implementation rejects that component as greater than `0xff`. ## What I ran Head `8c611f7be6f824ca2710969862170edc9f9bc11f`; base `bb04a4f1ea0175e9e4f149f0359a764d62ff3296`. The head includes the base and merges cleanly. Environment: Debian 12, GCC 12.2.0, Release build; focused test executable run via QEMU x86_64 in Haswell mode. ```sh cmake --build /dev/shm/AnyPS5-build-12915-full --target guest_inet_address_tests -j2 qemu-x86_64 -cpu Haswell -L / /dev/shm/AnyPS5-build-12915-full/tests/guest_inet_address_tests git -C /dev/shm/AnyPS5-review-12915 diff --check bb04a4f1ea0175e9e4f149f0359a764d62ff3296...HEAD python3 /dev/shm/AnyPS5-review-12915/tools/check_conventions.py --base bb04a4f1ea0175e9e4f149f0359a764d62ff3296 gh pr checks 12924 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | `guest_inet_address_tests` build | Passed; target was up to date on the final build invocation. | | `guest_inet_address_tests` via QEMU | Passed, exit 0. Its current `0x1234` assertion passes and exposes the behavior mismatch described below. | | `git diff --check` | Passed, exit 0. | | Conventions | Passed locally and in CI. | | Hosted checks | Eligibility, intake, report, Windows, conventions, and labels passed. Linux and specialized jobs were skipped. | <details> <summary>Exact output</summary> Build: ```text [0/2] Re-checking globbed directories... ninja: no work to do. ``` Focused QEMU test: ```text qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.pcid [bit 17] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.hle [bit 4] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11] [src/HostCpu.cpp:193 operator()] host CPU Intel Core Processor (Haswell): has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, XSAVEOPT, OS AVX state (XCR0); lacks RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEC, SSE4A, PREFETCHW, CLZERO ``` Convention check: ```text All conventions checks passed. ``` Diff check emitted no output and exited 0. Hosted check output: ```text conventions pass 22s https://github.com/boykopovar/AnyPS5/actions/runs/40901459290/job/123544573919 labels pass 6s https://github.com/boykopovar/AnyPS5/actions/runs/40901459261/job/123544569472 report pass 50s https://github.com/boykopovar/AnyPS5/actions/runs/40901463593/job/123544581780 windows pass 13m3s https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544923455 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927139 register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927115 relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927249 relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927935 write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927948 eligibility pass 6s https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544582315 ``` </details> ## Negative control | Assertion | Change made to code under test | Did the new test fail? | |---|---|---| | A one-component network value above `0xff` returns `INADDR_NONE`, as FreeBSD 11.4 does | No mutation; the PR test currently asserts `0x1234` is returned | Not exercised as a regression assertion; the existing positive assertion passes. | ## Findings ### Blocking `inet_network_nid_postfix` validates `value <= 0xff` only when a dot is encountered. The final component bypasses that guard, and the `count == 1` branch returns it unchanged. Thus `inet_network("0x1234")` returns `0x1234`, while FreeBSD 11.4 rejects it at the per-component `val > 0xffU` check. The new test currently encodes the divergent result as expected behavior. Please range-check the final component and change the test to expect `INADDR_NONE` (or provide console evidence that justifies diverging from the stated FreeBSD reference and update the debt entry). ```suggestion if (!digit || value > 0xff) return 0xffffffffu; ``` ### Non-blocking None identified in this pass. ## Sources - PR parser and test at [`8c611f7be6f824ca2710969862170edc9f9bc11f`](https://github.com/boykopovar/AnyPS5/blob/8c611f7be6f824ca2710969862170edc9f9bc11f/core/libs/prx/libSceLibcInternal/Inet.cpp#L187-L200) and [its test](https://github.com/boykopovar/AnyPS5/blob/8c611f7be6f824ca2710969862170edc9f9bc11f/core/libs/tests/GuestInetAddress.cpp#L96-L103). - FreeBSD 11.4 `inet_network.c` at pinned commit [`d106002967eff712894ab8b5337bbbff106ce5e0`](https://github.com/freebsd/freebsd-src/blob/d106002967eff712894ab8b5337bbbff106ce5e0/lib/libc/inet/inet_network.c#L533-L545), which rejects each parsed component greater than `0xff` before storing it. ## Not verified - Console behavior; the PR marks these helpers unverified on console. - Linux-hosted CI was skipped by repository policy; local focused execution used QEMU user mode, not native hardware. - I did not run a negative-control mutation. ## To get this to a good state Reject a final `inet_network` component above `0xff` and add a regression assertion for the single-component case, or document console evidence for the differing behavior. I will rerun the same commands on the new head.
MarcZX10 commented 2026-10-29 16:33:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T16:33:19Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The 0x1234 range issue is fixed in head dcdd2453eda246d1dadd843f33e4134965434589; the remaining blocking issue is that the PR asserts an unmeasured null-input result which diverges from its pinned FreeBSD reference and the repository’s unknown-behavior rule.

What I ran

Head dcdd2453eda246d1dadd843f33e4134965434589; base bb04a4f1ea0175e9e4f149f0359a764d62ff3296. git merge-tree --write-tree completed cleanly and returned tree 07024cc8c8f5c12c97f015fe80b7171722586cea. Environment: Debian 12, GCC 12.2.0, Release build; focused test executed through QEMU x86_64 in Haswell mode.

cmake --build /dev/shm/AnyPS5-build-12915-full --target guest_inet_address_tests -j2
qemu-x86_64 -cpu Haswell -L / /dev/shm/AnyPS5-build-12915-full/tests/guest_inet_address_tests
python3 /dev/shm/AnyPS5-review-12915/core/libs/tests/test_public_headers.py --audit-only
git -C /dev/shm/AnyPS5-review-12915 diff --check bb04a4f1ea0175e9e4f149f0359a764d62ff3296...HEAD
python3 /dev/shm/AnyPS5-review-12915/tools/check_conventions.py --base bb04a4f1ea0175e9e4f149f0359a764d62ff3296
gh api repos/boykopovar/AnyPS5/commits/dcdd2453eda246d1dadd843f33e4134965434589/check-runs

Results

Check Result
guest_inet_address_tests build Passed.
Focused test under QEMU Passed, exit 0.
Public header audit Passed: 373 libraries, 14,008 exports.
git diff --check Passed, exit 0.
Local conventions Passed.
Hosted checks on this exact head Windows, conventions, labels, report, eligibility passed; Linux and specialized jobs were skipped.
Exact captured output

Build:

[1/4] Building CXX object core/libs/prx/libSceLibcInternal/CMakeFiles/libSceLibcInternal.dir/Inet.cpp.o
[2/4] Linking CXX shared library core/libs/libs/unpatched/libSceLibcInternal.prx
[3/4] Building CXX object core/libs/prx/libSceLibcInternal/CMakeFiles/guest_inet_address_tests.dir/__/__/tests/GuestInetAddress.cpp.o
[4/4] Linking CXX executable tests/guest_inet_address_tests

QEMU test:

qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.pcid [bit 17]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
[src/HostCpu.cpp:193 operator()] host CPU Intel Core Processor (Haswell): has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, XSAVEOPT, OS AVX state (XCR0); lacks RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEC, SSE4A, PREFETCHW, CLZERO

Public header audit:

373 libraries, 14008 exports: unique declarations and umbrella coverage verified

Conventions:

All conventions checks passed.

The diff check emitted no output and exited 0. Exact-head hosted check runs:

write-watch	completed	skipped	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927948
relinker-asan	completed	skipped	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927935
relinker	completed	skipped	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927249
linux	completed	skipped	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927139
register-context	completed	skipped	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927115
windows	completed	success	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544923455
eligibility	completed	success	https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544582315
report	completed	success	https://github.com/boykopovar/AnyPS5/actions/runs/40901463593/job/123544581780
conventions	completed	success	https://github.com/boykopovar/AnyPS5/actions/runs/40901459290/job/123544573919
labels	completed	success	https://github.com/boykopovar/AnyPS5/actions/runs/40901459261/job/123544569472

Negative control

Assertion Change made to code under test Did the new test fail?
Null input follows the source behavior rather than returning a fabricated sentinel No mutation. The test asserts nullptr returns 0xffffffffu. Not independently exercised as a negative control; the focused test passes with the sentinel behavior.

Findings

Blocking

inet_network_nid_postfix(nullptr) returns INADDR_NONE, and the new test pins that result, but the PR's cited FreeBSD 11.4 implementation dereferences the input before validating it. The PS5 behavior for this case is unmeasured, and AGENTS.md says unknown general behavior should throw and be recorded rather than return a made-up result. Please throw for the null input and change the test, or provide console evidence for the sentinel result and update the debt entry to identify that evidence.

    if (text == nullptr) throw std::invalid_argument("inet_network: null text");

Non-blocking

A prior reviewer’s differential and mutation report recommends adding focused rows for empty dotted components, uppercase hex, and trailing whitespace/junk. The implementation now follows the cited parser shape, and I did not independently repeat that mutation run; these cases would make future parser changes easier to check.

Sources

Not verified

  • Console behavior for null input.
  • Native Linux execution; the focused executable was run in QEMU user mode.
  • The prior reviewer’s mutation and randomized differential experiments were read but not repeated here.

To get this to a good state

Resolve the unmeasured null-input behavior by throwing and updating the assertion, or provide console evidence that supports the sentinel result. I will rerun the same commands on the resulting head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5701353742 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12924#pullrequestreview-5701353742). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T16:33:19Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The `0x1234` range issue is fixed in head `dcdd2453eda246d1dadd843f33e4134965434589`; the remaining blocking issue is that the PR asserts an unmeasured null-input result which diverges from its pinned FreeBSD reference and the repository’s unknown-behavior rule. ## What I ran Head `dcdd2453eda246d1dadd843f33e4134965434589`; base `bb04a4f1ea0175e9e4f149f0359a764d62ff3296`. `git merge-tree --write-tree` completed cleanly and returned tree `07024cc8c8f5c12c97f015fe80b7171722586cea`. Environment: Debian 12, GCC 12.2.0, Release build; focused test executed through QEMU x86_64 in Haswell mode. ```sh cmake --build /dev/shm/AnyPS5-build-12915-full --target guest_inet_address_tests -j2 qemu-x86_64 -cpu Haswell -L / /dev/shm/AnyPS5-build-12915-full/tests/guest_inet_address_tests python3 /dev/shm/AnyPS5-review-12915/core/libs/tests/test_public_headers.py --audit-only git -C /dev/shm/AnyPS5-review-12915 diff --check bb04a4f1ea0175e9e4f149f0359a764d62ff3296...HEAD python3 /dev/shm/AnyPS5-review-12915/tools/check_conventions.py --base bb04a4f1ea0175e9e4f149f0359a764d62ff3296 gh api repos/boykopovar/AnyPS5/commits/dcdd2453eda246d1dadd843f33e4134965434589/check-runs ``` ## Results | Check | Result | |---|---| | `guest_inet_address_tests` build | Passed. | | Focused test under QEMU | Passed, exit 0. | | Public header audit | Passed: 373 libraries, 14,008 exports. | | `git diff --check` | Passed, exit 0. | | Local conventions | Passed. | | Hosted checks on this exact head | Windows, conventions, labels, report, eligibility passed; Linux and specialized jobs were skipped. | <details> <summary>Exact captured output</summary> Build: ```text [1/4] Building CXX object core/libs/prx/libSceLibcInternal/CMakeFiles/libSceLibcInternal.dir/Inet.cpp.o [2/4] Linking CXX shared library core/libs/libs/unpatched/libSceLibcInternal.prx [3/4] Building CXX object core/libs/prx/libSceLibcInternal/CMakeFiles/guest_inet_address_tests.dir/__/__/tests/GuestInetAddress.cpp.o [4/4] Linking CXX executable tests/guest_inet_address_tests ``` QEMU test: ```text qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.pcid [bit 17] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.hle [bit 4] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10] qemu-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11] [src/HostCpu.cpp:193 operator()] host CPU Intel Core Processor (Haswell): has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, XSAVEOPT, OS AVX state (XCR0); lacks RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEC, SSE4A, PREFETCHW, CLZERO ``` Public header audit: ```text 373 libraries, 14008 exports: unique declarations and umbrella coverage verified ``` Conventions: ```text All conventions checks passed. ``` The diff check emitted no output and exited 0. Exact-head hosted check runs: ```text write-watch completed skipped https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927948 relinker-asan completed skipped https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927935 relinker completed skipped https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927249 linux completed skipped https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927139 register-context completed skipped https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544927115 windows completed success https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544923455 eligibility completed success https://github.com/boykopovar/AnyPS5/actions/runs/40901463574/job/123544582315 report completed success https://github.com/boykopovar/AnyPS5/actions/runs/40901463593/job/123544581780 conventions completed success https://github.com/boykopovar/AnyPS5/actions/runs/40901459290/job/123544573919 labels completed success https://github.com/boykopovar/AnyPS5/actions/runs/40901459261/job/123544569472 ``` </details> ## Negative control | Assertion | Change made to code under test | Did the new test fail? | |---|---|---| | Null input follows the source behavior rather than returning a fabricated sentinel | No mutation. The test asserts `nullptr` returns `0xffffffffu`. | Not independently exercised as a negative control; the focused test passes with the sentinel behavior. | ## Findings ### Blocking `inet_network_nid_postfix(nullptr)` returns `INADDR_NONE`, and the new test pins that result, but the PR's cited FreeBSD 11.4 implementation dereferences the input before validating it. The PS5 behavior for this case is unmeasured, and `AGENTS.md` says unknown general behavior should throw and be recorded rather than return a made-up result. Please throw for the null input and change the test, or provide console evidence for the sentinel result and update the debt entry to identify that evidence. ```suggestion if (text == nullptr) throw std::invalid_argument("inet_network: null text"); ``` ### Non-blocking A prior reviewer’s differential and mutation report recommends adding focused rows for empty dotted components, uppercase hex, and trailing whitespace/junk. The implementation now follows the cited parser shape, and I did not independently repeat that mutation run; these cases would make future parser changes easier to check. ## Sources - Current PR null handling and assertion at [`dcdd2453eda246d1dadd843f33e4134965434589`](https://github.com/boykopovar/AnyPS5/blob/dcdd2453eda246d1dadd843f33e4134965434589/core/libs/prx/libSceLibcInternal/Inet.cpp#L183-L185) and [the focused test](https://github.com/boykopovar/AnyPS5/blob/dcdd2453eda246d1dadd843f33e4134965434589/core/libs/tests/GuestInetAddress.cpp#L125-L127). - FreeBSD 11.4 `inet_network.c`, pinned at [`8c639945a44588f6cfdddfb057bb5aad88735da0`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/libc/inet/inet_network.c#L486-L498), reads the input directly without a null check. - Repository instruction: [`AGENTS.md` at the PR head](https://github.com/boykopovar/AnyPS5/blob/dcdd2453eda246d1dadd843f33e4134965434589/AGENTS.md#L4-L4). ## Not verified - Console behavior for null input. - Native Linux execution; the focused executable was run in QEMU user mode. - The prior reviewer’s mutation and randomized differential experiments were read but not repeated here. ## To get this to a good state Resolve the unmeasured null-input behavior by throwing and updating the assertion, or provide console evidence that supports the sentinel result. I will rerun the same commands on the resulting head.
MarcZX10 commented 2026-10-29 21:37:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T21:37:28Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The latest update addresses the attribution and null-case comments, but this head still conflicts with current main and has no reported run of the changed guest_inet_address test.

What I ran

Reviewed head 2142a6b49cffeb6a7eefe829f568210142024718 (PR base bb04a4f1ea0175e9e4f149f0359a764d62ff3296) against current main 52f212ec053f917455f2f87674ddb708dcc545d8. I inspected the latest commit, the changed source/tests/debt entry, the merge preview, and hosted checks. No local build or tests were run.

git merge-tree --write-tree refs/remotes/upstream/main refs/review/pr-12924-head
git diff --check 2142a6b49cffeb6a7eefe829f568210142024718^..2142a6b49cffeb6a7eefe829f568210142024718

Results

Check Result
Merge preview onto current main Conflict in docs/dev/debt/libSceLibcInternal.md
Latest-commit diff check Passed (no output)
Hosted conventions and labels Pass
guest_inet_address on this head No run reported; the earlier Windows result was for dcdd2453ed, before these parser/test changes
Unedited command output
git diff --check: no output; exit status 0
merge-tree: conflict in docs/dev/debt/libSceLibcInternal.md

Findings

Blocking

  • The PR is labeled needs rebase; the merge preview against current main conflicts in docs/dev/debt/libSceLibcInternal.md. Please merge current main and resolve that debt-entry conflict.
  • The latest commit changes inet_network null handling and adds edge-case/null assertions, but the reported guest_inet_address run is for the previous head. Please run the registered target on the rebased head and include its result.

Non-blocking

  • The Regents license and FreeBSD adaptation attribution are now at the top of Inet.cpp, and the new tests cover uppercase hex, malformed components, trailing whitespace/junk, and null exceptions. The debt entry now explicitly says console behavior is unverified.

Not verified

I did not build locally or run guest_inet_address. The hosted jobs currently shown are conventions and labels; I did not see a product-test job for this head.

To get this to a good state

Please resolve the conflict with current main, run guest_inet_address on the resulting head, and post the exact command and output. I will recheck the same source and test on that head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5705311638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12924#pullrequestreview-5705311638). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T21:37:28Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The latest update addresses the attribution and null-case comments, but this head still conflicts with current `main` and has no reported run of the changed `guest_inet_address` test. ## What I ran Reviewed head `2142a6b49cffeb6a7eefe829f568210142024718` (PR base `bb04a4f1ea0175e9e4f149f0359a764d62ff3296`) against current `main` `52f212ec053f917455f2f87674ddb708dcc545d8`. I inspected the latest commit, the changed source/tests/debt entry, the merge preview, and hosted checks. No local build or tests were run. ```sh git merge-tree --write-tree refs/remotes/upstream/main refs/review/pr-12924-head git diff --check 2142a6b49cffeb6a7eefe829f568210142024718^..2142a6b49cffeb6a7eefe829f568210142024718 ``` ## Results | Check | Result | |---|---| | Merge preview onto current `main` | Conflict in `docs/dev/debt/libSceLibcInternal.md` | | Latest-commit diff check | Passed (no output) | | Hosted conventions and labels | Pass | | `guest_inet_address` on this head | No run reported; the earlier Windows result was for `dcdd2453ed`, before these parser/test changes | <details> <summary>Unedited command output</summary> ```text git diff --check: no output; exit status 0 merge-tree: conflict in docs/dev/debt/libSceLibcInternal.md ``` </details> ## Findings ### Blocking - The PR is labeled `needs rebase`; the merge preview against current `main` conflicts in `docs/dev/debt/libSceLibcInternal.md`. Please merge current `main` and resolve that debt-entry conflict. - The latest commit changes `inet_network` null handling and adds edge-case/null assertions, but the reported `guest_inet_address` run is for the previous head. Please run the registered target on the rebased head and include its result. ### Non-blocking - The Regents license and FreeBSD adaptation attribution are now at the top of `Inet.cpp`, and the new tests cover uppercase hex, malformed components, trailing whitespace/junk, and null exceptions. The debt entry now explicitly says console behavior is unverified. ## Not verified I did not build locally or run `guest_inet_address`. The hosted jobs currently shown are conventions and labels; I did not see a product-test job for this head. ## To get this to a good state Please resolve the conflict with current `main`, run `guest_inet_address` on the resulting head, and post the exact command and output. I will recheck the same source and test on that head.
CnRJay commented 2026-11-01 19:54:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:54:15Z.

Review: COMMENTED


Tested lists only the conventions check and the header audit. blawesom's run of guest_inet_address at 2c9970dbe2 passes; please put a run of that test at the current head in the description so it doesn't depend on a comment.

No title on main reaches these four yet, so this will be read after title-linked PRs.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729937704 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12924#pullrequestreview-5729937704). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:54:15Z. **Review:** COMMENTED --- `Tested` lists only the conventions check and the header audit. blawesom's run of `guest_inet_address` at 2c9970dbe2 passes; please put a run of that test at the current head in the description so it doesn't depend on a comment. No title on `main` reaches these four yet, so this will be read after title-linked PRs.
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!12924
No description provided.