Commit Graph
534 Commits
Author SHA1 Message Date
Dean 95175b5acf Merge pull request #11298 from Gruzzberry/fix/dangling-link-prefix-enoent
fix(libkernel): fail with ENOENT for a path below a dangling Windows symbolic link
2026-11-02 23:27:36 +13:00
Dean 859db5cd22 Merge pull request #10979 from xXPBSXx/fix/pipe-efault
fix(libkernel): fail pipe with EFAULT and close both descriptors when the descriptor array is not writable guest memory
2026-11-02 23:26:26 +13:00
Dean fc3a5af62c Merge pull request #10755 from Ragbie/fix/windows-fclose-descriptor-state
fix(libc): drop the kernel state of a descriptor that fclose or freopen closes
2026-11-02 23:24:14 +13:00
Dean b07388b060 Merge pull request #10552 from krishalivaibhav/fix/macos-libkernel-six
fix(libkernel): build the file, module and rtld calls on macOS hosts
2026-11-02 20:54:13 +13:00
xXPBSXxandClaude Sonnet 5.5 66cac964ab Merge main (66e1f7f993) into fix/pipe-efault
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-02 01:08:41 +01:00
Adrià ac26e59d9a Merge pull request #13901 from DeveshB-1/fix/stat-archived-efault
fix(libkernel): return EFAULT from stat for an unwritable buffer
2026-11-01 15:13:30 +01:00
Dean c51c471250 Merge pull request #12922 from ntamas94/fix/ps4-dir-blksize
fix(libkernel): report a 64 KiB st_blksize for directories
2026-11-02 00:25:59 +13:00
Dean e56c5c99f3 Merge pull request #12474 from milescoviello/fix/fcntl-host-descriptor
fix(libkernel): report a host-only descriptor as not open to fcntl and ioctl
2026-11-01 23:38:28 +13:00
DeveshB-1 b5ffde4a0a fix(libkernel): return EFAULT from stat for an unwritable buffer 2026-11-01 14:18:08 +05:30
ntamas94 249d8cc371 Merge remote-tracking branch 'origin/main' into fix/ps4-dir-blksize 2026-11-01 07:53:32 +01:00
GruzzberryandClaude Sonnet 5.5 2d1342cf31 fix(libkernel): fail chflags and fchflags with EPERM when a system flag changes
FreeBSD 11.4 ufs_setattr refuses a change of any SF_* flag to a caller without PRIV_VFS_SYSFLAGS, which prison_priv_check denies a jailed root without allow.chflags. Under the credential model agreed on #11216 every SF_* flag now fails with EPERM, after the EOPNOTSUPP check for unknown bits, instead of throwing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-01 07:51:40 +01:00
Dean 9f6d3b910c Merge pull request #7202 from MarcZX10/codex/lstat-long-windows-path-7201
fix(libkernel): support lstat on long Windows paths
2026-11-01 19:19:37 +13:00
JJenkxandClaude Opus 5.5 b476f50b8e fix(libkernel): unlink a dangling Windows directory symbolic link
sceKernelUnlink takes its Windows directory-link path only when
std::filesystem::symlink_status reports a directory, but MinGW's
symlink_status follows the link. A directory symbolic link whose target
is missing therefore looked like a file, went to the file delete, and
failed with EACCES, because Windows removes a directory link only
through RemoveDirectoryW. guest_filesystem stops there on any Windows
host that may create symbolic links.

The directory path is now also taken when the link itself carries both
FILE_ATTRIBUTE_DIRECTORY and FILE_ATTRIBUTE_REPARSE_POINT, which
GetFileAttributesW reports without following the link.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 18:57:56 -04:00
GruzzberryandClaude Sonnet 5.5 bfef134a9a fix(libkernel): fail with ENOENT for a path below a dangling Windows symbolic link
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 10:16:00 +00:00
krishalivaibhavandClaude Opus 5.5 32d288095f fix(libkernel): drop leading slashes after a long-path split on macOS
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:32:54 +05:30
krishalivaibhavandClaude Opus 5.5 f58b1c4523 refactor(libkernel): resolve the macOS temporary directory once for shared memory
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
krishalivaibhavandClaude Opus 5.5 f374a777a2 fix(libkernel): read archived directories through getdirentries on macOS
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
krishalivaibhavandClaude Opus 5.5 787e08bb5c fix(libkernel): match macOS shared memory only in the temporary directory
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
krishalivaibhavandClaude Opus 5.5 fa9d3c8088 fix(libkernel): check the descriptor before an empty vector read or write on macOS
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
krishalivaibhavandClaude Opus 5.5 e95186ba55 fix(libkernel): treat only unnamed FIFOs as pipes on macOS
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
krishalivaibhavandClaude Sonnet 5.5 5200c2edd2 fix(libkernel): report named shm_open and shm_unlink as not implemented on macOS
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
Himansh Raj 559568f8d8 fix(libkernel): guard getdirentries guest outputs on macOS
The macOS sceKernelGetdirentries wrote *basep and the entry records into buf
without entering GuestArena::HostWrite, so the write-watch host-write path
never saw those writes. It now opens HostWrite guards for buf over nbytes and
for basep before it moves the descriptor offset, and holds them through every
write, as the Linux path does. It also rejects a non-directory with EINVAL
before the guards, matching Linux.
2026-10-31 14:32:53 +05:30
Himansh Raj ee34c291e1 fix(libkernel): open long-path stat prefixes with O_SEARCH on macOS
The long-path fallback in NativeStat opened each intermediate directory with
O_RDONLY | O_DIRECTORY, which needs read permission on it. stat and fstatat
only need search permission, so a path through an execute-only directory
failed with EACCES once it crossed PATH_MAX. O_SEARCH (O_EXEC | O_DIRECTORY
on Darwin) needs only search permission and still rejects a non-directory.
2026-10-31 14:32:53 +05:30
c5a398fb03 fix(libkernel): find a directory descriptor's path through F_GETPATH on macOS
Co-authored-by: Himansh Raj <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
0e145b86e1 fix(libkernel): build the file, module and rtld calls on macOS hosts
NativeStat, SharedMemory, Stdio, DynamicLoader, ModuleInfo and Rtld used
Linux-only APIs (st_atim, memfd_create, sys/vfs.h, link.h and dl_iterate_phdr),
so libkernel did not compile on macOS. Add macOS paths behind __APPLE__:
st_*timespec and a long-path fstatat walk, an unlinked temp file for shared
memory, statfs, dlopen/dladdr and Mach-O segment walks for module and rtld
queries. The Linux and Windows paths are unchanged.

Extracted from feat/macos-port (#8658).

Co-authored-by: Himansh Raj <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
DeveshB-1 5553cbd447 fix(libkernel): return EFAULT from sceKernelWriteThrottlingStatus for an unwritable store 2026-10-30 20:14:03 +05:30
Dean 5c0ee1bbf4 Merge pull request #11827 from oneandonlydean/carry/7268-cert-paths
feat(libkernel): provide system and common certificate list paths
2026-10-31 01:18:08 +13:00
Adrià 8304ccaedb Merge pull request #11341 from SteelCrab/review/emscripten-libraries
build(libs): support Emscripten memory64 compilation
2026-10-30 12:49:20 +01:00
Dean Galvin 462c4ec0aa Merge main into PR #11827 2026-10-30 23:07:47 +13:00
Adrià 0a2cda921d Merge pull request #12933 from heditrigui/feat/libc-dprintf
feat(libc): implement dprintf and vdprintf
2026-10-30 06:33:00 +01:00
pista d64e85164b build(libs): let the system libraries compile with Emscripten
Emscripten targets wasm64 without x86 assembly, Linux-only headers or the
x87 long double. These changes add __EMSCRIPTEN__ paths beside the host
ones; native builds compile the same code as before.

- libc: long doubles in guest varargs and scanf go through
  GuestLongDouble, a plain copy where long double is the x87 format;
  APS5_EXPORT emits no assembler alias; the guest arena is one aligned
  allocation that zeroes pages when they are committed again; getifaddrs
  keeps its link-level entries on Linux; /proc lookups and the host
  stderr duplicate are left out.
- libkernel: file-backed mmap, EVFILT_VNODE watches, getcontext and
  setcontext throw; getdents replaces the raw getdents64 syscall;
  getdtablesize takes the resource limit alone.
- VideoOut leaves SDL, the display window and the HDR probe out,
  Sysmodule asks libkernel for unwind information and Net includes
  sys/time.h.
2026-10-30 10:50:57 +09:00
Adrià 2485cdefa3 Merge pull request #12538 from babyhuey/fix/utimes-efault
fix(libkernel): return EFAULT from the utimes family for an unreadable times array
2026-10-30 02:31:43 +01:00
Adrià 96613bba67 Merge pull request #12060 from Ragbie/fix/windows-directory-flock
fix(libkernel): lock directories with flock on Windows as FreeBSD does
2026-10-30 01:04:03 +01:00
Adrià 788e5531a1 Merge pull request #12163 from slopgobblercobbler/fix/libkernel-windows-descriptor-socket-classification
fix(libkernel): classify guest sockets on Windows and align errno parity
2026-10-29 23:46:12 +01:00
Hedi Trigui 3dfc973fb8 fix(libc): address review feedback on vdprintf guest write path, short writes, ABI and test coverage 2026-10-29 17:30:21 +01:00
ntamas94andClaude Opus 5.5 da7581eec4 fix(libkernel): report a 64 KiB st_blksize for directories
A PS4 Pro (firmware 10.71) reports st_blksize 0x10000 from stat and fstat
for /app0, its subdirectories and the system library directory. Titles
size one getdents buffer from it: CUSA18659's CryPak reads st_blksize +
264 bytes once, so the 512 reported here cut its shader directory listing
short. Directories, app0.zar ones included, now report 0x10000; /data
directories (0x8000 on the console) and files are recorded as debt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:17:34 +01:00
Adrià 2257ffde7b Merge pull request #9473 from cadenasynyster/fix/windows-directory-link-rmdir-unlink
fix(libkernel): rmdir and unlink on a Windows directory link
2026-10-29 09:31:36 +01:00
Adrià c70c75ad13 Merge pull request #9284 from DavidSamir/feat/libkernel-sys-ksem-unnamed
feat(libkernel): implement the unnamed ksem semaphores
2026-10-29 08:48:19 +01:00
milescovielloandClaude Opus 5.5 f83a259550 fix(libkernel): keep the not-open answer for unknown descriptor kinds to Linux
On macOS a guest named shm_open descriptor reports S_IFMT 0 as well,
so the fallback there would hide a descriptor the guest owns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 05:21:02 +00:00
milescovielloandClaude Opus 5.5 4bfbea9351 fix(libkernel): report a host-only descriptor as not open to fcntl and ioctl
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 05:21:02 +00:00
DeveshB-1 1a47f9f0ee fix(libkernel): return EFAULT from ioctl FIONREAD for an unwritable argument 2026-10-29 09:15:45 +05:30
slopgobblercobbler 9d41d12f64 fix(libkernel): classify guest sockets on Windows and align errno parity 2026-10-29 00:45:11 +01:00
Dean 9412e47af6 Merge pull request #12579 from babyhuey/fix/fionbio-efault
fix(libkernel): return EFAULT from ioctl FIONBIO for an unreadable argument
2026-10-29 12:15:13 +13:00
Dean d775fc5958 Merge pull request #11403 from MarcZX10/marc/fix-libkernel-shm-anon-windows
fix(libkernel): recognize Windows anonymous shared memory descriptors
2026-10-29 11:49:22 +13:00
Dean 319621ba2e Merge pull request #12339 from medazizktata/fix/windows-exec-shared-mapping
fix(libkernel): map shared memory and files executable on Windows
2026-10-29 07:28:16 +13:00
babyhuey b4ae3afc61 fix(libkernel): return EFAULT from ioctl FIONBIO for an unreadable argument
ioctl(FIONBIO) read its int argument directly after the existing null
check, so a non-null pointer into unmapped memory crashed the host.
FIONBIO is an _IOW request, which FreeBSD copies in and fails with
EFAULT; the argument is now copied in with GuestCopyIn_nid_no_patch
before the status change.
2026-10-28 14:19:31 -04:00
babyhuey 55905af740 fix(libkernel): return EFAULT from the utimes family for an unreadable times array
utimes, lutimes, futimes, sceKernelUtimes and sceKernelFutimes read the
guest times array directly, so a non-null pointer into unmapped memory
crashed the host. Each now copies the two timevals in with
GuestCopyIn_nid_no_patch before anything else, as FreeBSD's getutimes
does before the path or descriptor lookup, and continues on the local
copy. A failed copy returns EFAULT, or 0x8002000e from the sceKernel
forms. A null times array still means the current time.
2026-10-28 13:37:12 -04:00
MarcZX10 436769c634 fix(libkernel): recognize Windows anonymous shared memory descriptors 2026-10-28 13:04:38 +00:00
cadenasynysterandClaude Sonnet 5.5 b28edaf954 fix(libkernel): rmdir and unlink on a Windows directory symbolic link
On Windows, std::filesystem::symlink_status and is_symlink report a directory symbolic link as a plain directory, so rmdir removed the link instead of failing with ENOTDIR (20) and unlink failed with EPERM (1) instead of removing it, unlike FreeBSD. Detect the symlink reparse tag with FindFirstFileW: rmdir returns ENOTDIR, unlink removes the link with RemoveDirectoryW. Junctions and volume mounts keep their previous behaviour. Enable the directory-link and dangling-link blocks of guest_filesystem on Windows (created with CreateSymbolicLinkW).

AI-assisted: yes

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GtXavMkgCTCdmRpweviHcQ
2026-10-28 13:41:23 +01:00
David fd6513d6ff refactor(libkernel): move the unnamed ksem calls into libkernel
The PS5 3.20 export lists have ksem_* in libkernel as well as
libkernel_sys, and on Windows a libkernel import never reaches
libkernel_sys, so titles importing them from libkernel did not find
them. Following pipe1os's review on #9284, also: ENOSPC from
ksem_init when no descriptor is left, the SEM_MAX limit of 30 with
ENOSPC, and dup/dup2 from a ksem id throwing as for a kqueue.
2026-10-28 12:57:04 +01:00