libkernel: a descriptor that is not open hides the address argument errors of bind, connect and sendto #8391

Closed
opened 2026-10-20 12:03:43 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 12:03:43 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T12:03:43Z.


Repro

bind(-1, addr, 1), bind(-1, addr, 256), bind(-1, NULL, 16), connect(-1, addr, 1), sendto(-1, "x", 1, 0, addr, 1).
Expected (FreeBSD 11.4 sys/kern/uipc_syscalls.c:194, :549, :765-766): EINVAL, ENAMETOOLONG, EFAULT, EINVAL, EINVAL, because the address (getsockaddr`) is examined before the descriptor is looked up.
Actual: EBADF for all of them.
Test: core/libs/tests/GuestSocketAddressLength.cpp. Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/socket-argument-order-fb. AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5941289425 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8391). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T12:03:43Z. --- ### Repro `bind(-1, addr, 1)`, `bind(-1, addr, 256)`, `bind(-1, NULL, 16)`, `connect(-1, addr, 1)`, `sendto(-1, "x", 1, 0, addr, 1)`. Expected (FreeBSD 11.4 sys/kern/uipc_syscalls.c`:194, :549, :765-766): EINVAL, ENAMETOOLONG, EFAULT, EINVAL, EINVAL, because the address (`getsockaddr`) is examined before the descriptor is looked up. Actual: EBADF for all of them. Test: core/libs/tests/GuestSocketAddressLength.cpp. Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/socket-argument-order-fb. AI-assisted (Claude Code).
Sign in to join this conversation.
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#8391
No description provided.