fix(libc): report the empty host name measured on a PS5 #10128

Merged
orezraey merged 4 commits from upstream-pr/10128 into main 2026-10-26 09:00:36 +00:00
orezraey commented 2026-10-23 10:35:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-23T10:35:07Z.


What

gethostname returned the fixed name AnyPS5. I measured it on a retail PS5 (firmware 13.60) with a homebrew probe, from a payload process. The source and console log are in this gist (pmisc).

Call PS5
gethostname(buffer, 256) 0, errno unchanged, the buffer holds an empty string
gethostname(buffer, 1) 0, buffer[0] is 0

It now reports the same empty name. Copying, the null queries and ENAMETOOLONG for a zero-length buffer still follow FreeBSD's gethostname. The debt entry records the measurement and says that a title process, or a console with a configured name, may read another name.

sysctl kern.hostname still answers AnyPS5 here; my other change on SystemConfiguration.cpp answers the measured empty string there too.

Tested

Windows 11, MinGW (winlibs).

  • guest_hostname now expects the empty name for every buffer length. It fails on main and passes three runs in a row with the change.
  • tools/check_conventions.py passes.
  • tools/pr_overlap.py lists #8279 (other lines of the debt file, macOS build of the tests) and #6044 (moves test files); neither changes gethostname.

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:4981438701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10128). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-23T10:35:07Z. --- ### What `gethostname` returned the fixed name `AnyPS5`. I measured it on a retail PS5 (firmware 13.60) with a homebrew probe, from a payload process. The source and console log are in [this gist](https://gist.github.com/orezraey/5cebf6403a5d24945fe677a1e84123fe) (`pmisc`). | Call | PS5 | |---|---| | `gethostname(buffer, 256)` | 0, `errno` unchanged, the buffer holds an empty string | | `gethostname(buffer, 1)` | 0, `buffer[0]` is 0 | It now reports the same empty name. Copying, the null queries and `ENAMETOOLONG` for a zero-length buffer still follow FreeBSD's `gethostname`. The debt entry records the measurement and says that a title process, or a console with a configured name, may read another name. `sysctl` `kern.hostname` still answers `AnyPS5` here; my other change on `SystemConfiguration.cpp` answers the measured empty string there too. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, MinGW (winlibs). - `guest_hostname` now expects the empty name for every buffer length. It fails on `main` and passes three runs in a row with the change. - `tools/check_conventions.py` passes. - `tools/pr_overlap.py` lists #8279 (other lines of the debt file, macOS build of the tests) and #6044 (moves test files); neither changes `gethostname`. ### 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
MarcZX10 commented 2026-10-23 10:50:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T10:50:15Z.

Review: APPROVED


The gist records successful gethostname calls with both 256-byte and 1-byte buffers, an empty string, and unchanged errno, matching the implementation. The code retains the existing null query and short-buffer behavior; the zero-length case is not claimed as a console measurement. GCC 12.2 syntax checks for the implementation and test passed, as did exact-worktree conventions, diff-check, and main-sync (3 ahead/29 behind; merge clean). The author reports the Windows hostname regression passing three times. The #8279 debt-file overlap concerns a separate interfaces entry, and #6044 is currently dirty against main with its broader test-file moves; neither implements this hostname behavior. Hosted checks pass and product jobs are skipped by the workflow.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5627211769 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10128#pullrequestreview-5627211769). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T10:50:15Z. **Review:** APPROVED --- The gist records successful `gethostname` calls with both 256-byte and 1-byte buffers, an empty string, and unchanged errno, matching the implementation. The code retains the existing null query and short-buffer behavior; the zero-length case is not claimed as a console measurement. GCC 12.2 syntax checks for the implementation and test passed, as did exact-worktree conventions, diff-check, and main-sync (3 ahead/29 behind; merge clean). The author reports the Windows hostname regression passing three times. The #8279 debt-file overlap concerns a separate interfaces entry, and #6044 is currently dirty against main with its broader test-file moves; neither implements this hostname behavior. Hosted checks pass and product jobs are skipped by the workflow.
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!10128
No description provided.