feat(libkernel): accept a kevent read event on descriptor 0 #6343

Merged
klosixgaming-arch merged 1 commit from upstream-pr/6343 into main 2026-10-18 23:46:19 +00:00
klosixgaming-arch commented 2026-10-15 12:27:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-15T12:27:04Z.


What

EA SPORTS FC 27 (PPSA34015) creates a kqueue at start-up and registers EVFILT_READ for descriptor 0 in it. The code (eboot 0xba76b90) sets up an input console command, then calls kqueue() and kevent(kq, {ident 0, EVFILT_READ, EV_ADD}, 1, NULL, 0, NULL), stores the kqueue, and ignores kevent's result. With the PPSA34015 pull requests listed under Tested applied on main, the title then stops with:

terminate called after throwing an instance of 'std::runtime_error'
  what():  kevent: EVFILT_READ on a non-socket descriptor not implemented
FATAL: abort() (SIGABRT)

kevent now accepts a read event on the host stream on descriptor 0. The event never triggers, the same way select never reports descriptor 0 readable (libkernel debt, "console title with no input"). The change is limited to that case:

  • Write events on descriptors 0 to 2 still throw.
  • Read events on other non-socket descriptors still throw.
  • A descriptor 0 that was not open when libkernel loaded still follows the existing path.

The debt entry for kqueue and kevent records the new case.

Tested

  • Windows 11, WinLibs GCC 15.2.0, RTX 5090 (NVIDIA 610.47), Ryzen 9 9950X3D: PPSA34015 01.000.004 gets past the stop above and reaches the EA SPORTS FC 27 splash screen, which is still compiling shaders at 1–2 fps. Reaching this point also needs notaxeltv's open PPSA34015 pull requests (#5352 #6034 #6049 #6056 #6058 #6062 #6072 #6074 #6079 #6084 #6085 #6086 #6087 #6088 #6089 #6090 #6092), applied on main for this run.
  • guest_kqueue has a new case for this and passes on Linux (GCC 13.3), run with descriptor 0 open and with it closed. On Windows, PPSA34015 runs the new path (above). On this Windows machine, guest_kqueue fails later in the existing DeniedParentWatch case (the vnode watch error lacks "parent"), which this change does not touch and #6173 changes.

Checklist

  • Based on current main; no other open PR implements the same functions (#5973 adds pipe read ends to the same function; descriptor 0 here is a console, not a pipe)
  • 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
  • Unblocks: PPSA34015 #6344
  • GPUs tested: RTX 5090
  • AI-assisted: yes. Written with AI assistance and reviewed by me.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4873221934 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6343). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-15T12:27:04Z. --- ### What EA SPORTS FC 27 (PPSA34015) creates a kqueue at start-up and registers `EVFILT_READ` for descriptor 0 in it. The code (eboot `0xba76b90`) sets up an `input` console command, then calls `kqueue()` and `kevent(kq, {ident 0, EVFILT_READ, EV_ADD}, 1, NULL, 0, NULL)`, stores the kqueue, and ignores `kevent`'s result. With the PPSA34015 pull requests listed under Tested applied on `main`, the title then stops with: ``` terminate called after throwing an instance of 'std::runtime_error' what(): kevent: EVFILT_READ on a non-socket descriptor not implemented FATAL: abort() (SIGABRT) ``` `kevent` now accepts a read event on the host stream on descriptor 0. The event never triggers, the same way `select` never reports descriptor 0 readable ([libkernel debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/debt/libkernel.md), "console title with no input"). The change is limited to that case: - Write events on descriptors 0 to 2 still throw. - Read events on other non-socket descriptors still throw. - A descriptor 0 that was not open when libkernel loaded still follows the existing path. The debt entry for kqueue and kevent records the new case. ### Tested - Windows 11, WinLibs GCC 15.2.0, RTX 5090 (NVIDIA 610.47), Ryzen 9 9950X3D: PPSA34015 01.000.004 gets past the stop above and reaches the EA SPORTS FC 27 splash screen, which is still compiling shaders at 1–2 fps. Reaching this point also needs notaxeltv's open PPSA34015 pull requests (#5352 #6034 #6049 #6056 #6058 #6062 #6072 #6074 #6079 #6084 #6085 #6086 #6087 #6088 #6089 #6090 #6092), applied on `main` for this run. - `guest_kqueue` has a new case for this and passes on Linux (GCC 13.3), run with descriptor 0 open and with it closed. On Windows, PPSA34015 runs the new path (above). On this Windows machine, `guest_kqueue` fails later in the existing `DeniedParentWatch` case (`the vnode watch error lacks "parent"`), which this change does not touch and #6173 changes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (#5973 adds pipe read ends to the same function; descriptor 0 here is a console, not a pipe) - [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] Unblocks: PPSA34015 #6344 - [x] GPUs tested: RTX 5090 - [x] AI-assisted: yes. Written with AI assistance and reviewed by me.
github-actions[bot] commented 2026-10-15 12:33:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:33:16Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6542 docs/dev/debt/libkernel.md L112-113
PR 7075 docs/dev/debt/libkernel.md L113
PR 7121 docs/dev/debt/libkernel.md L113-114
PR 7129 core/libs/prx/libkernel/Equeue/src/Kqueue.cpp L142
docs/dev/debt/libkernel.md L113
PR 7653 core/libs/prx/libkernel/Equeue/src/Kqueue.cpp L2-3
docs/dev/debt/libkernel.md L113

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 5021 docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestKqueue.cpp
PR 6446 docs/dev/debt/libkernel.md
PR 6510 core/libs/prx/libkernel/Equeue/src/Kqueue.cpp
core/libs/tests/GuestKqueue.cpp
docs/dev/debt/libkernel.md
PR 6519 docs/dev/debt/libkernel.md
PR 6534 docs/dev/debt/libkernel.md
PR 6908 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 6977 docs/dev/debt/libkernel.md
PR 7039 docs/dev/debt/libkernel.md
PR 7049 core/libs/prx/libkernel/Equeue/src/Kqueue.cpp
core/libs/tests/GuestKqueue.cpp
docs/dev/debt/libkernel.md
PR 7088 core/libs/prx/libkernel/Equeue/src/Kqueue.cpp
core/libs/tests/GuestKqueue.cpp
docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7332 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6192134786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6343#issuecomment-6192134786). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:33:16Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6542](https://www.github.com/boykopovar/AnyPS5/pull/6542) | `docs/dev/debt/libkernel.md` [L112-113](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/docs/dev/debt/libkernel.md#L112-L113) | | | | [PR 7075](https://www.github.com/boykopovar/AnyPS5/pull/7075) | `docs/dev/debt/libkernel.md` [L113](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/docs/dev/debt/libkernel.md#L113) | | | | [PR 7121](https://www.github.com/boykopovar/AnyPS5/pull/7121) | `docs/dev/debt/libkernel.md` [L113-114](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/docs/dev/debt/libkernel.md#L113-L114) | | | | [PR 7129](https://www.github.com/boykopovar/AnyPS5/pull/7129) | `core/libs/prx/libkernel/Equeue/src/Kqueue.cpp` [L142](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/core/libs/prx/libkernel/Equeue/src/Kqueue.cpp#L142)<br>`docs/dev/debt/libkernel.md` [L113](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/docs/dev/debt/libkernel.md#L113) | | | | [PR 7653](https://www.github.com/boykopovar/AnyPS5/pull/7653) | `core/libs/prx/libkernel/Equeue/src/Kqueue.cpp` [L2-3](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/core/libs/prx/libkernel/Equeue/src/Kqueue.cpp#L2-L3)<br>`docs/dev/debt/libkernel.md` [L113](https://github.com/boykopovar/AnyPS5/blob/8b8edc56195f2ff6ec8e1a87b2463dc408580c54/docs/dev/debt/libkernel.md#L113) | | | 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 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestKqueue.cpp` | | [PR 6446](https://www.github.com/boykopovar/AnyPS5/pull/6446) | `docs/dev/debt/libkernel.md` | | [PR 6510](https://www.github.com/boykopovar/AnyPS5/pull/6510) | `core/libs/prx/libkernel/Equeue/src/Kqueue.cpp`<br>`core/libs/tests/GuestKqueue.cpp`<br>`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 6908](https://www.github.com/boykopovar/AnyPS5/pull/6908) | `docs/dev/debt/libkernel.md` | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `docs/dev/debt/libkernel.md` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `docs/dev/debt/libkernel.md` | | [PR 7039](https://www.github.com/boykopovar/AnyPS5/pull/7039) | `docs/dev/debt/libkernel.md` | | [PR 7049](https://www.github.com/boykopovar/AnyPS5/pull/7049) | `core/libs/prx/libkernel/Equeue/src/Kqueue.cpp`<br>`core/libs/tests/GuestKqueue.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `core/libs/prx/libkernel/Equeue/src/Kqueue.cpp`<br>`core/libs/tests/GuestKqueue.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) | `docs/dev/debt/libkernel.md` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `docs/dev/debt/libkernel.md` | | [PR 7509](https://www.github.com/boykopovar/AnyPS5/pull/7509) | `docs/dev/debt/libkernel.md` |
klosixgaming-arch commented 2026-10-15 13:05:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-15T13:05:29Z.


No dependency — this PR builds on neither:

  • #5973 adds EVFILT_READ for the read end of a pipe. Here descriptor 0 is the host console stream (PPSA34015 registers standard input in a kqueue at start-up), not a pipe. The two add separate branches to AddDescriptorKnote, so they can merge in either order.
  • #5847 implements the event flags (EV_DISABLE, EV_DISPATCH, EV_FORCEONESHOT); that is a different code path from this descriptor-filter change. The only shared file is the debt doc, where both edit the same kqueue bullet at different parts (this PR adds the sentence about read events on descriptor 0; #5847 removes those flags from the throw list), so whichever merges second resolves it trivially.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6192760587 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6343#issuecomment-6192760587). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-15T13:05:29Z. --- No dependency — this PR builds on neither: - #5973 adds `EVFILT_READ` for the read end of a pipe. Here descriptor 0 is the host console stream (PPSA34015 registers standard input in a kqueue at start-up), not a pipe. The two add separate branches to `AddDescriptorKnote`, so they can merge in either order. - #5847 implements the event flags (`EV_DISABLE`, `EV_DISPATCH`, `EV_FORCEONESHOT`); that is a different code path from this descriptor-filter change. The only shared file is the debt doc, where both edit the same kqueue bullet at different parts (this PR adds the sentence about read events on descriptor 0; #5847 removes those flags from the throw list), so whichever merges second resolves it trivially.
karimibrahim07 commented 2026-10-16 14:10:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-16T14:10:07Z.

Review: COMMENTED


Windows check of head 8078b7ef3, merged onto main 5d9dcc42d (clean merge). Windows 11 Pro (26300), WinLibs GCC 15.2.0 r7, Ninja Release.

  • guest_kqueue passes on Windows here, including the new StandardInput case and DeniedParentWatch. So the failure you saw in DeniedParentWatch looks specific to that machine. guest_select, guest_select_wait, guest_poll and guest_equeue_events also pass.
  • It does conflict with #5973, contrary to the comment above. With both heads, git merge-tree reports content conflicts in Kqueue.cpp and in the kqueue bullet of docs/dev/debt/libkernel.md. In Kqueue.cpp, #5973 rewrites the if (!GuestSockets::IsOpen(descriptor)) block that this PR's new branch sits directly above. The resolution is mechanical: keep this PR's descriptor-0 branch first, then #5973's socket-or-pipe block. The debt sentence needs both additions. Whichever merges second needs that resolution.
  • One interaction for that resolution: with this branch first, a descriptor 0 that the host attached to a pipe (a run with stdin redirected) gets the never-triggering knote rather than #5973's pipe readiness, because File::IsHostStream(0) is true for any stream libkernel found at load. That seems the right choice for a console title, which has no input on descriptor 0. If it's intended, the debt sentence could say so.

AI-assisted: yes. I ran the build and tests above and the trial merge with #5973.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5548935848 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6343#pullrequestreview-5548935848). Originally posted by [karimibrahim07](https://github.com/karimibrahim07) on 2026-10-16T14:10:07Z. **Review:** COMMENTED --- Windows check of head `8078b7ef3`, merged onto `main` `5d9dcc42d` (clean merge). Windows 11 Pro (26300), WinLibs GCC 15.2.0 r7, Ninja Release. - `guest_kqueue` **passes on Windows here**, including the new `StandardInput` case and `DeniedParentWatch`. So the failure you saw in `DeniedParentWatch` looks specific to that machine. `guest_select`, `guest_select_wait`, `guest_poll` and `guest_equeue_events` also pass. - **It does conflict with #5973**, contrary to the comment above. With both heads, `git merge-tree` reports content conflicts in `Kqueue.cpp` and in the kqueue bullet of `docs/dev/debt/libkernel.md`. In `Kqueue.cpp`, #5973 rewrites the `if (!GuestSockets::IsOpen(descriptor))` block that this PR's new branch sits directly above. The resolution is mechanical: keep this PR's descriptor-0 branch first, then #5973's socket-or-pipe block. The debt sentence needs both additions. Whichever merges second needs that resolution. - **One interaction for that resolution:** with this branch first, a descriptor 0 that the host attached to a pipe (a run with stdin redirected) gets the never-triggering knote rather than #5973's pipe readiness, because `File::IsHostStream(0)` is true for any stream libkernel found at load. That seems the right choice for a console title, which has no input on descriptor 0. If it's intended, the debt sentence could say so. AI-assisted: yes. I ran the build and tests above and the trial merge with #5973.
hugodearaujo commented 2026-10-18 14:58:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-18T14:58:06Z.


Another title needs this: Assassin's Creed Mirage (PPSA13960, 01.007.000). On main 0d078f75d it stops 7 s after start with kevent: EVFILT_READ on a descriptor that is neither a socket nor the read end of a pipe not implemented. With this PR's Kqueue.cpp change it passes that point; the next stop is a separate main-thread stack issue (#7532), and with #7532 and #7533 as well it runs through its start-up screens (#7534). EA SPORTS FC 25 (PPSA20049) also stops at this kevent read in my runs on main 66702f1cf.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251376587 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6343#issuecomment-6251376587). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-18T14:58:06Z. --- Another title needs this: Assassin's Creed Mirage (PPSA13960, 01.007.000). On `main` 0d078f75d it stops 7 s after start with `kevent: EVFILT_READ on a descriptor that is neither a socket nor the read end of a pipe not implemented`. With this PR's `Kqueue.cpp` change it passes that point; the next stop is a separate main-thread stack issue (#7532), and with #7532 and #7533 as well it runs through its start-up screens (#7534). EA SPORTS FC 25 (PPSA20049) also stops at this kevent read in my runs on `main` 66702f1cf.
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!6343
No description provided.