Commit Graph
1068 Commits
Author SHA1 Message Date
Adrià 4036fab1b2 Merge pull request #7437 from lucaslima430/fix/libkernel-socket-fcntl-duplication
fix(libkernel): support socket fcntl duplication
2026-10-20 17:40:06 +02:00
bluandClaude Opus 5.5 0ecef87c4c fix(libkernel): answer Windows reparse points that are not links
lstat and readlink threw NotImplemented for every Windows reparse point
other than a symbolic link or a drive junction. A tag without the name
surrogate bit (cloud files, deduplication) does not stand for another path,
so lstat now answers as stat does and readlink returns EINVAL, as FreeBSD
does for a file that is not a link and as CPython's os.lstat and os.readlink
do (bpo-37834). A name surrogate that is neither a symbolic link nor a
junction (a mounted volume, a WSL link) is reported as the reparse point
itself with the mode of its attributes, and readlink returns EINVAL.

The tests set reparse tags with FSCTL_SET_REPARSE_POINT, one without the
name surrogate bit and one with it. A compact /exe (WOF) file cannot serve
as the fixture: on Windows 11 24H2 the WOF filter hides the reparse point
from GetFileAttributesW and FileAttributeTagInfo alike. Windows refuses
every open of an unhandled tag without FILE_FLAG_OPEN_REPARSE_POINT, so the
test requires lstat to agree with stat rather than to succeed.

mashingaan's boykopovar/AnyPS5#6447 returned EINVAL for other reparse
points without the tag check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-20 08:21:33 -07:00
Federico Marras 5f6c30547e Merge remote-tracking branch 'upstream/main' into feat/kqueue-read-on-kqueue
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-20 17:18:22 +02:00
Retr0 4e2ee895d2 docs(debt): drop the Windows directory dup gap from libkernel
d3011ae11 made dup and dup2 of a Windows directory descriptor share
its DirectoryState, as FreeBSD's kern_dup shares the open file, and
removed the clause; a later merge of the entry brought it back.
GuestDirectoryRewind covers both calls.
2026-10-20 18:15:30 +03:00
Adrià 1e1a19bf48 Merge pull request #7075 from AlexOfTheForest/feat/kevent-pipe-write
feat(libkernel): support EVFILT_WRITE on the write end of a pipe
2026-10-20 17:15:03 +02:00
elieh999 bb396009e0 fix(libkernel): store the process resource limit 2026-10-20 18:01:27 +03:00
xXPBSXxandClaude Sonnet 5.5 0bb7b02e9f fix(libkernel): answer a bound IPv4 datagram send to port 0 without the host
Linux's udp_sendmsg refuses port 0 with EINVAL, so a send that FreeBSD
accepts (the socket is bound to a specific address and port and the
destination is not INADDR_ANY or INADDR_BROADCAST) failed there. Nothing can
receive on port 0, so the call now returns the length itself on every host.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 16:56:47 +02:00
Federico Marras 6ead14f9e8 feat(libkernel): watch a kqueue with EVFILT_READ 2026-10-20 16:56:06 +02:00
xXPBSXxandClaude Sonnet 5.5 aec1f2c012 fix(libkernel): fail sendto to port 0 from an unbound IPv4 datagram socket with EADDRNOTAVAIL
udp_output hands the destination to in_pcbconnect_setup unless the socket is
bound to a specific address and port and the destination is neither
INADDR_ANY nor INADDR_BROADCAST, and in_pcbconnect_setup fails port 0 with
EADDRNOTAVAIL. The send went to the host, which accepted it. sendto, and
sendmsg through it, now fails the same way for an AF_INET datagram socket
that is not connected. connect to port 0 already did.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 16:54:21 +02:00
frankea 73bc20e93d Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into ps5-measured-1340
# Conflicts:
#	docs/dev/debt/libSceAgcDriver.md
2026-10-20 09:21:31 -04:00
xXPBSXxandClaude Sonnet 5.5 26f861dd27 feat(libkernel): accept MSG_WAITALL in recv, recvfrom and recvmsg on a stream socket
soreceive_generic keeps a MSG_WAITALL receive on a stream socket waiting until
the buffer is full, the peer closes or an error occurs. The three calls failed
every flag but MSG_PEEK and MSG_DONTWAIT with EOPNOTSUPP. A stream socket now
passes the flag to the host receive; a datagram socket ignores it, as a record
is delivered whole.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 15:12:33 +02:00
Dean 44e3389c88 Merge pull request #7807 from mazen320/fix/windows-stderr-dup2
fix(libkernel): keep host stderr off a guest dup2 onto descriptor 2
2026-10-21 01:45:30 +13:00
thuanquangandClaude b8beb80e54 docs(libkernel): say that an AMM command buffer may run after its submission returns
Co-Authored-By: Claude <[email protected]>
2026-10-20 19:27:33 +07:00
ionut27001andClaude Opus 5.5 dfa96f1fe6 fix(libkernel): return ENOENT for thirteen sysctl names, as measured on a PS5
In a payload process on a PS5 (firmware 12.70), sysctlbyname returns -1
with ENOENT for thirteen names that threw here, and leaves the buffer and
the length alone, for a read, a size query, a null length and a null
buffer with a null length. sysctl does the same for the fixed MIBs of
seven of them. sysctlnametomib gives those seven MIBs and returns ENOENT
for hw.cacheline_size and hw.usermem, which threw too.

machdep.cacheline_size already returned ENOENT and is now tested with
the others. A write to the new names and MIBs throws, as the console's
answer to a write was not tried. The hw.realmem and vm.overcommit debt
entries now say that a payload process gets ENOENT for them as well.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 13:46:29 +02:00
Queuze bbcce1736e fix(libkernel): support socket fcntl duplication 2026-10-20 13:40:22 +02:00
Adrià FranchandClaude Sonnet 5.5 99e56464a1 fix(libkernel): keep the PipeWrite full-pipe case off Windows and start its clock before the reader
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 13:35:07 +02:00
Alexej Szpevák bd8ee518c4 feat(libkernel): support EVFILT_WRITE on the write end of a pipe
kevent threw for EVFILT_WRITE on any descriptor that is not a socket. On the write end of a pipe it now follows FreeBSD 11's filt_pipewrite: data is the free buffer space, and once the read end is closed the event reports EV_EOF with data 0. Adding the event after the read end is closed fails with EPIPE, as in pipe_kqfilter. EVFILT_WRITE on the read end still throws, because FreeBSD's pipe ends are bidirectional and host pipes are not.
2026-10-20 13:34:50 +02:00
Adrià b9a097353c Merge pull request #7556 from MarcZX10/codex/libkernel-sysctl-mib-enoent
fix(libkernel): return ENOENT for measured absent sysctl MIBs
2026-10-20 13:23:08 +02:00
Adrià 437de6392f Merge pull request #7652 from billythemenace2/fix/kernel-raise-outside-host-code
fix(libkernel): redirect a raise only once the target leaves host code
2026-10-20 13:16:49 +02:00
Evrim Cicek ad7e1acdb6 fix(libkernel): append positioned writes on an O_APPEND descriptor on Windows
On Windows, sceKernelPwrite, pwrite, sceKernelPwritev, pwritev and the AIO
write commands wrote at the given offset on a descriptor opened with
O_APPEND. FreeBSD's vn_write sets IO_APPEND for an O_APPEND regular file
whether or not an offset is given, the filesystem then writes at the end of
the file, and the file offset is left unchanged. Write at Windows'
end-of-file offset in that case, and gather a multi-buffer pwritev into one
write as writev already does.
2026-10-20 13:55:58 +03:00
MarcZX100 7b05271abb fix(libkernel): support kern.rng_pseudo MIB access 2026-10-20 12:29:39 +02:00
Adrià 9299e6fd8a Merge pull request #7542 from ionut27001/fix/libkernel-rng-pseudo-block
fix(libkernel): return kern.rng_pseudo in 64-byte blocks as measured on a PS5
2026-10-20 12:24:51 +02:00
Adrià a0e0985288 Merge pull request #7551 from mazen320/fix/open-nofollow-junction
fix(libkernel): stop O_NOFOLLOW from opening a Windows directory junction
2026-10-20 12:20:01 +02:00
MarcZX10 e054c83eea Merge upstream main into measured absent sysctl MIBs 2026-10-20 10:12:56 +00:00
mazen c03168fb47 fix(libc): keep guest stdio on a dup2 of descriptors 1 and 2
Host logging opens its own FILE on the saved descriptor. The guest FILE stays on the replaced descriptor, so guest printf, puts and fprintf still reach the pipe.
2026-10-20 13:38:07 +04:00
mazen 715fe9ca26 fix(libkernel): keep host stdout off a guest dup2 onto descriptor 1
The same guest dup2 that fills the stderr pipe also replaces descriptor 1, so host stdout was still writing into the guest pipe.
2026-10-20 13:38:07 +04:00
mazen 2d1c18410f fix(libkernel): keep host stderr off a guest dup2 onto descriptor 2
Guest dup2 onto 2 replaces the CRT descriptor fprintf(stderr) still uses, so host logs fill the 4 KiB guest pipe.
2026-10-20 13:38:06 +04:00
Aryan SharmaandClaude Haiku 5.5 4313a703ec feat(libkernel): implement _umtx_op UMTX_OP_SEM_WAIT and UMTX_OP_SEM_WAKE
Follow FreeBSD 11's do_sem_wait and do_sem_wake (COMPAT_FREEBSD9/10) on
a struct _usem: a wait sets _has_waiters, returns at once while _count
is non-zero and otherwise sleeps on the semaphore's queue; a wake clears
_has_waiters when one waiter is left and releases one waiter.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-20 15:01:48 +05:30
SebastianandClaude Opus 5.5 cfdaf2dbb8 feat(libkernel): implement fchflags
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QnkpF2oEMofseVz9Z7WEAC
2026-10-20 07:28:54 +00:00
Dean bec309f4d4 Merge pull request #8057 from HQasper/feat/kernel-pipe-read-event
feat(libkernel): accept pipe read ends in sceKernelAddReadEvent
2026-10-20 18:31:06 +13:00
Dean 1ae9833228 Merge pull request #8035 from pushkarreddyy/feat/libkernel-pthread-mutexattr-getprotocol
feat(libkernel): implement pthread_mutexattr_getprotocol
2026-10-20 17:55:35 +13:00
Dean 564c75b289 Merge pull request #7956 from Lindamea1/fix/libkernel-ioctl-malformed-enotty
fix(libkernel): fail a malformed ioctl request with ENOTTY
2026-10-20 17:49:59 +13:00
Dean 2a04b63d1e Merge pull request #8176 from xXPBSXx/fix/ftruncate-no-zero-fill-fb
fix(libkernel): extend a file with ftruncate without writing zero bytes on Windows
2026-10-20 17:47:32 +13:00
Dean 49fd13a741 Merge pull request #7958 from Lindamea1/fix/libkernel-available-direct-memory-enomem
fix(libkernel): return ENOMEM from sceKernelAvailableDirectMemorySize when the range has no free block
2026-10-20 17:40:24 +13:00
Dean 56a0be39dd Merge pull request #7957 from Lindamea1/fix/libkernel-attrget-esrch-ended-thread
fix(libkernel): return ESRCH from scePthreadAttrGet for a thread that has ended
2026-10-20 17:40:20 +13:00
Dean cb3f18fda8 Merge pull request #7940 from pushkarreddyy/feat/libkernel-setgid
feat(libkernel): implement setgid
2026-10-20 17:05:47 +13:00
Adam Franke 9a027c0c0d Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into ps5-measured-1340
# Conflicts:
#	docs/dev/debt/shader.md
2026-10-20 00:03:49 -04:00
xXPBSXxandClaude Sonnet 5.5 bcbcf55b5b fix(libkernel): extend a file with ftruncate without writing zero bytes on Windows
ftruncate, truncate and sceKernelFtruncate extended a file through _chsize_s,
which writes the whole new length as zero bytes. FreeBSD extends the file
without writing data (kern_ftruncate -> ffs_truncate) and fails a length the
file system cannot hold with EFBIG. NativeFtruncate now sets the end of file
with SetFileInformationByHandle and maps ERROR_DISK_FULL to ENOSPC and
ERROR_FILE_TOO_LARGE/ERROR_INVALID_PARAMETER to EFBIG.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 05:58:22 +02:00
Dean 4405703fa6 Merge pull request #8186 from xXPBSXx/fix/socket-dontwait-windows-fb
fix(libkernel): honour MSG_DONTWAIT in the socket send and receive calls on Windows
2026-10-20 16:22:35 +13:00
xXPBSXxandClaude Sonnet 5.5 45940f27cc fix(libkernel): honour MSG_DONTWAIT in the socket send and receive calls on Windows
send, sendto, sendmsg, recv, recvfrom and recvmsg failed with EOPNOTSUPP for
MSG_DONTWAIT on Windows, where FreeBSD 11.4 sosend_generic and
soreceive_generic make the one call non-blocking and fail with EWOULDBLOCK
when it would wait. Winsock has no per-call flag, so the call now asks WSAPoll
with a zero timeout whether the socket is ready and fails with EAGAIN when it
is not. The Windows branches of the socket tests that expected EOPNOTSUPP now
run the same checks as the other hosts.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 03:43:59 +02:00
babyhuey b28198008c feat(libkernel): implement sceKernelOpenEventFlag
Return the handle of an event flag this process created under the
given name, or ENOENT. Twispero opens the shell's
SceShellCoreUtilAppFocus flag at start-up and treats a failed open as
unknown focus.
2026-10-19 20:52:47 -04:00
xXPBSXxandClaude Sonnet 5.5 cd09badb2b fix(libkernel): fail a short or long socket address like FreeBSD
bind, connect and sendto answered EFAULT for an address length below 2 and EAFNOSUPPORT for an AF_INET address below 16 or an AF_INET6 address below 28 bytes. FreeBSD 11.4's getsockaddr fails a length below 2 with EINVAL and above SOCK_MAXADDRLEN (255) with ENAMETOOLONG, and the protocols compare the length with sizeof(struct sockaddr_in) or sockaddr_in6 and fail with EINVAL.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 02:30:55 +02:00
Adrià 5253446882 Merge pull request #7543 from ionut27001/fix/libkernel-getrlimit-console
fix(libkernel): report the getrlimit values measured on a PS5 for RLIMIT_STACK, RSS, MEMLOCK and NPROC
2026-10-20 02:07:39 +02:00
Adrià 88fb5592c6 Merge pull request #7611 from Lindamea1/fix/kernel-pthread-attr-sched-getters
feat(libkernel): implement scePthreadAttrGetschedpolicy and scePthreadAttrGetinheritsched
2026-10-20 01:23:13 +02:00
Adrià 309ab11eaf Merge pull request #7539 from ionut27001/fix/libkernel-inet-ntop-pad
fix(libkernel): match inet_ntop and inet_pton padding and null pointers as measured on a PS5
2026-10-20 00:51:02 +02:00
Savvanis SpyrosandClaude Opus 5.5 1027bfbce1 feat(libs): declare sceGameLiveStreamingEnableLiveStreaming and sceKernelPrintBacktraceWithModuleInfo
PS4 titles import both and do not load without them; every call throws and
the debt files list them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 01:14:16 +03:00
Claude 25434db37d docs(libkernel): mark pipe read events as the exception to sockets-only
The entry before it still says sceKernelAddReadEvent and
sceKernelAddWriteEvent take only guest sockets. The pipe entry now says it
is the exception, without editing that entry, which an open change to the
shared-memory entry next to it would conflict with.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-19 21:41:26 +00:00
David 84746e14d8 Merge remote-tracking branch 'origin/main' into feat/libkernel-jit-shared-memory-macos
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-20 01:09:38 +04:00
mugurc 7701a9b9da feat(libkernel): UDP sockets and name resolution on macOS hosts
The guest socket layer relies on a few Linux calls:

- The equeue wait uses poll with the timeout rounded up to a millisecond;
  macOS has no ppoll.
- A readable stream socket whose peer closed is reported with POLLHUP by
  peeking one byte; macOS has no POLLRDHUP.
- FIONREAD on a datagram socket, and the byte count that fstat and kevent
  report for it, is SO_NREAD, the size of the next datagram; macOS adds the
  source address to FIONREAD.
- socketpair throws for SOCK_SEQPACKET, which has no AF_UNIX pair on macOS.
- gethostbyname replaces gethostbyname_r, which macOS lacks.

The UDP test sends on its connected socket without an address, as #7475
does, because macOS, like FreeBSD, fails sendto with an address on a
connected socket with EISCONN. The log test uses a datagram pair with
enlarged buffers instead of SOCK_SEQPACKET.
2026-10-19 23:36:56 +03:00
Dean 6b981a212c Merge pull request #7675 from valenciana-nc/fix/recvmsg-guest-validation
fix(libkernel): fail recvmsg with EFAULT on guest memory it cannot read or write
2026-10-20 09:21:54 +13:00