Commit Graph
240 Commits
Author SHA1 Message Date
Adrià 59776f2e6a Merge pull request #7841 from hypermoist/feat/libc-annex-k-remaining
feat(libc): implement the remaining C11 Annex K bounds-checking functions
2026-10-21 13:09:59 +02:00
Adrià eb4a7fee4e Merge pull request #7525 from AlexOfTheForest/feat/scanf-wide-linux
feat(libc): scan 16-bit wide conversions in the sscanf family on Linux
2026-10-21 13:09:54 +02:00
Dean f894ba69d3 Merge pull request #8479 from hypermoist/feat/libc-wide-stream-scanf
feat(libc): add the wide stream scanf family
2026-10-21 20:58:24 +13:00
Dean b77bd58806 Merge pull request #8226 from dantdmdarealguy/fix/libc-update-stream-read-windows
fix(libc): switch update streams to reading as FreeBSD does
2026-10-21 19:57:35 +13:00
Dean 5b5d2a8636 Merge pull request #8626 from xXPBSXx/carry/6226-relinker-stem
fix(libc): find a relinked module by stem when the exact name misses (carries #6226)
2026-10-21 19:52:46 +13:00
hypermistandClaude Opus 5.5 7b336bedac docs(libc): move the Annex K locale entry before wcsrtombs_s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 16:23:56 +13:00
Dean 2ea908a9ae Merge pull request #8841 from oneandonlydean/docs/host-write-rule
docs(dev): require a HostWrite bracket around host writes into guest memory
2026-10-21 15:44:14 +13:00
Dean 5d10ea9ea0 Merge pull request #8791 from JJenkx/windows/calltrace-faulting-thread
feat(libc): list the reporting thread's own calls in the call trace report
2026-10-21 15:40:39 +13:00
Dean Galvin 05d7bdb088 docs(dev): require a HostWrite bracket around host writes into guest memory
Kernel and native-library writes into guest pages the write watch left read-only fail with EFAULT on macOS and ERROR_NOACCESS on Windows (#7473). State the rule where contributors look and point the macOS write-watch debt entry at it.
2026-10-21 14:57:32 +13:00
Dean GalvinandxXPBSXx 8cb7251b2e Merge origin/main into PR 8626
Co-authored-by: xXPBSXx <20614131+xXPBSXx@users.noreply.github.com>
2026-10-21 14:56:22 +13:00
Dean b13183e59e Merge pull request #7473 from Dripl1x/codex/skip-clean-resident-write-watch
perf(libc): skip write-watch queries for proven clean resident ranges
2026-10-21 14:55:09 +13:00
Dean 6c12024f7d Merge pull request #8741 from Queuse/fix/libc-freopen-share-delete
fix(libc): share delete on standard stream reopen
2026-10-21 14:47:29 +13:00
Dean 994829e44b Merge pull request #8733 from p3n1cillin/codex/libc-unlocked-status-20261020
feat(libc): implement unlocked stream status queries
2026-10-21 14:24:31 +13:00
JJenkxandClaude Opus 5.5 3316ca3b24 feat(libc): list the reporting thread's own calls in the call trace report
The crash and abort reports printed the last 64 traced calls of the whole
process, so a thread that loops on a traced import (a mutex lock/unlock
pair, a profiler marker) pushes the calls of the faulting thread out of the
report. The ring already keeps the last 65536 calls with their thread.

CopyThreadCallTrace_nid_no_patch returns the most recent calls of one
thread from that ring, oldest first, and both reports (Windows crash and
abort, Linux abort) list up to 32 of them for the reporting thread after
the process-wide list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 20:25:31 -04:00
Dean b56cfb3817 Merge pull request #8444 from SwetabhSingh17/feat/libc-mem-utilities
feat(libc): implement memmem and memccpy
2026-10-21 13:24:46 +13:00
Dean 70c497739e Merge pull request #8636 from cadenasynyster/fix/libc-thrd-detach
feat(libc): implement _Thrd_detach
2026-10-21 13:11:55 +13:00
hypermist 8baefcf14c Merge remote-tracking branch 'upstream/main' into feat/libc-annex-k-remaining 2026-10-21 12:43:56 +13:00
hypermistandClaude Opus 5.5 6f77c09bd7 docs(libc): record the single-byte locale gap of the Annex K conversions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 12:23:51 +13:00
Dean 273b1b87f4 Merge pull request #8388 from SwetabhSingh17/feat/libc-paf-mspace-posix-memalign
feat(libc): implement sceLibcPafMspacePosixMemalign
2026-10-21 12:20:57 +13:00
Queuze 3916eeaf6f fix(libc): share delete on standard stream reopen 2026-10-20 20:07:16 -03:00
Dean c8301bbca5 Merge pull request #8137 from hamb3r/feat/libc-backtrace-windows
feat(libc): implement sceLibcBacktraceSelf and GetBufferSize on Windows
2026-10-21 11:45:25 +13:00
p3nicillin dde6b34d37 feat(libc): implement unlocked stream status queries 2026-10-20 23:41:22 +01:00
Ethan Barr 4f6a37d790 fix(libc): share delete access when freopen reopens a stream onto a file on Windows
On Windows, freopen reopened a stream through _wfreopen, which opens the file without FILE_SHARE_DELETE, so remove or rename of the file failed while the stream was open, unlike fopen streams and POSIX unlink/rename of an open file. freopen now closes the previous stream and opens the new file through the same CreateFileW path fopen uses, so the reopened stream shares delete access. Host standard streams and an empty filename keep the _wfreopen path. Reference: FreeBSD 11 unlink(2) and rename(2) succeed on a file that is open.
2026-10-20 17:07:21 -04:00
Dean 29e4c46b4d Merge pull request #7417 from IshmamDC217/feat/relinker-trace-imports-linux
feat(relinker): support --trace-imports for Linux output
2026-10-21 09:03:29 +13:00
Evgeniy Kazarin 7898b5bd3a fix(libc): avoid repeated resident write faults 2026-10-21 03:55:51 +08:00
cadenasynyster 9e6544fbab docs(libc): shorten the _Thrd_detach debt entry 2026-10-20 21:43:57 +02:00
cadenasynysterandClaude Sonnet 5.5 a8b6d1c411 feat(libc): implement _Thrd_detach
Animal Well (PPSA22520) imports _Thrd_detach (L7f7zYwBvZA) from libc.prx and nothing exports it, so the Windows loader stops at startup. Register libkernel's pthread_detach with libc like pthread_create and pthread_join, and return _Thrd_error (4) when it fails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01GtXavMkgCTCdmRpweviHcQ
2026-10-20 21:31:16 +02:00
hamb3r 50a4d5bfb3 chore(libc): merge main into feat/libc-backtrace-windows 2026-10-20 22:04:09 +03:00
bfd1d5b568 fix(libc): compare the relinked module stem without the last extension only
The stem of a request and of a relinked module name was cut at the first dot,
so a request for Engine.Render.prx that missed could load Engine.Core.prx.guest.prx.
Only the last extension is removed now, as the review of the stem lookup asked,
and the variant-names test requests a dotted name that must not load the sibling
fixture module.

Co-Authored-By: lendinglibrary <340867775+lendinglibrary@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 20:50:03 +02:00
lendinglibrary a3c4cdcdbb fix(libc): find a relinked module by stem when the exact name misses
A title asks for a module by its console name and the relinker names the
converted module after the ELF it was built from: Unity IL2CPP titles load
Media/Modules/<name>.prx and Media/Plugins/<name>.prx while the dump holds
<name>.elf.guest.prx, so sceKernelLoadStartModule failed with 0x80020002
and the title stopped 3 s after start. After the exact and the
case-insensitive <name>.guest.prx lookups miss, take the sibling whose stem
matches the request and ends with .guest.prx, shortest name first.
2026-10-20 20:42:59 +02:00
Dean b85d972f42 Merge pull request #7897 from babyhuey/fix/libc-adopt-guest-heap-only-when-replaced
fix(libc): adopt the guest SDK allocator only when the title replaces the heap
2026-10-21 07:20:48 +13:00
Dean Galvin 143ed02750 Merge branch 'main' into #7417
Resolve docs/dev/debt/libc.md: keep main's _Throw_Cpp_error entry and this branch's call tracing entry.
2026-10-21 06:33:59 +13:00
Dean 542c65d74c Merge pull request #8023 from Ondra97/codex/fix-scaled-hyperbolic
fix(libc): avoid premature scaled hyperbolic overflow
2026-10-21 06:26:06 +13:00
Dean 0b1d678fe5 Merge pull request #8148 from hamb3r/feat/libc-dinkumware-threads
feat(libc): export Dinkumware thread primitives from libc.prx
2026-10-21 06:21:49 +13:00
dantdmdarealguy a7e6e597d3 fix(libc): switch update streams to reading as FreeBSD does
On Windows the UCRT does not switch an r+, w+ or a+ stream from writing
to reading without fflush or fseek: fread after fwrite returned bytes of
the write buffer and the next flush wrote them over the file, and ungetc
failed on an update stream that was not already reading. On Linux glibc
does not switch either for ungetc, which pushes the byte back over the
pending write, drops the write and can corrupt the heap on the next read,
or for an fread of at least the buffer size, which drops the write and
reads from the old offset.

fread, fgetc, getc_unlocked, fgets, ungetc, ungetwc and fscanf now flush
pending output and mark the stream as reading first, as FreeBSD 11.4's
__srefill and __ungetc do, through _IO_switch_to_get_mode on glibc.
Writes directly after reads still go through the UCRT on Windows; the
gap is recorded in the libc technical debt.
2026-10-20 11:28:19 -05:00
Dean 77e31219c8 Merge pull request #8116 from dantdmdarealguy/fix/libc-readdir-fileno-windows
fix(libc): report the file number of each readdir entry on Windows
2026-10-21 04:55:57 +13:00
Adrià 1a48337f13 Merge pull request #7634 from imellag/fix/macos-guest-arena-walk-test
test(libc): check that the macOS guest arena keeps free space beside host regions
2026-10-20 17:47:19 +02:00
hypermistandClaude Opus 5.5 b5e9882630 feat(libc): add the wide stream scanf family
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 02:25:08 +13:00
Swetabh Singh f3dec86695 feat(libc): implement memmem and memccpy 2026-10-20 18:12:52 +05:30
hamb3r 2693c44569 docs(libc): document Windows backtrace stop at PE unwind handlers 2026-10-20 15:22:50 +03:00
Swetabh Singh b67e2a3f2f feat(libc): implement sceLibcPafMspacePosixMemalign 2026-10-20 17:22:52 +05:30
Adrià 6bd02dd915 Merge pull request #7545 from ionut27001/fix/libc-strtod-nan-payload
fix(libc): parse NaN payloads in strtod as measured on a PS5
2026-10-20 12:25:58 +02:00
dantdmdarealguy 251ca1c100 fix(libc): report the file number of each readdir entry on Windows
readdir and readdir_r returned d_fileno 0 for every entry on Windows,
because MinGW's _wreaddir reports no inode. FreeBSD 11.4's
_readdir_unlocked (lib/libc/gen/readdir.c) never returns an entry whose
d_ino is 0, and d_fileno is the number lstat reports as st_ino.

The Windows directory stream now reads the listing from the directory
handle with GetFileInformationByHandleEx(FileIdBothDirectoryInfo), so
each entry carries the file ID of the entry itself, symbolic links
included, without opening it. The ID is folded as stat and lstat fold
nFileIndexHigh:nFileIndexLow; the fold moves to WindowsDescriptor.hpp so
both libraries use it. rewinddir restarts the scan, telldir and seekdir
count entries as _wtelldir and _wseekdir did, and opendir fails with the
open error of the directory. A file system that lists no file ID gets a
nonzero number hashed from the name. Linux truncates the host inode to
32 bits as stat does instead of reporting 0 above 2^32.

guest_directory checks that every entry has a nonzero file number, that
the numbers of a file, a subdirectory and symbolic links to both equal
lstat's st_ino, that an entry created or removed while the directory is
open shows up after rewinddir, that a delete-pending entry no lstat can
open is still listed, and that seekdir returns the same number.
2026-10-20 03:52:39 -05:00
hamb3r 57c8c01183 Merge branch 'main' into feat/libc-backtrace-windows 2026-10-20 10:15:56 +03:00
Dean 4a10f5f167 Merge pull request #8037 from MarrasFederico/feat/libc-strtonum
feat(libc): implement bounded decimal parsing with strtonum
2026-10-20 20:07:26 +13:00
Dean 8972f8ae3c Merge pull request #8129 from Th3EvilGod/codex/libc-precise-thread-sleep
fix(libc): use precise Windows thread sleep
2026-10-20 18:31:11 +13:00
Dean 329b9aa1a7 Merge pull request #7988 from MarrasFederico/feat/libc-getifaddrs-link-entries
feat(libc): list each interface's AF_LINK entry in getifaddrs on Linux
2026-10-20 17:51:27 +13:00
Dean bae00fad0a Merge pull request #7998 from priyanshrv-netizen/feat/libc-bessel
feat(libc): implement j0, j1, jn, y0, y1 and yn
2026-10-20 17:50:11 +13:00
Dean Galvin 20f75e94e0 Merge main into pr-8037
# Conflicts:
#	core/libs/tests/GuestStrings.cpp
2026-10-20 17:40:21 +13:00
Dean 1ae92bb7c9 Merge pull request #8174 from xXPBSXx/fix/rename-dot-component-fb
fix(libc): fail a rename of a path that ends in a dot component with EINVAL
2026-10-20 16:23:33 +13:00