libSceAmpr: three locale data NIDs are exported as throwing functions #8875

Closed
opened 2026-10-21 03:55:14 +00:00 by UnhealthyKraken · 2 comments
UnhealthyKraken commented 2026-10-21 03:55:14 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-21T03:55:14Z.


Problem

Three locale data NIDs are currently exported by libSceAmpr as int(void) functions calling NotImplemented. The public SDK labels the corresponding symbols as objects in libSceLibcInternal. Resolving an object's address to a throwing function does not provide an unsupported-object trap: a data consumer reads code bytes instead of calling that function.

NID SDK symbol
-mLzBSk-VGs _ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE
a54t8+k7KpY _ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE
KfcTPbeaOqg _ZTVSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE

Evidence

  • The pinned public SDK symbol table declares the two IDs with @object (time_get at line10126), and the vtable entry is also @object. The Itanium ABI identifies the TV special name as a virtual table, whose contents are data describing the class.
  • Current Ampr source implements all three as no-argument functions. The vtable placeholder is at line863 and time_get ID at873. No corresponding source change between the tested head and inspected main7ab4b2e561.
  • #545 explicitly left num_get/time_get/vtables unresolved after the CRT re-export work. This report records the data-versus-function ABI problem in that remaining work. Fresh num_get/time_get issue/PR searches and the all-state title/body index found no correction; open #8384 concerns _Sto*x conversions in DinkumwareInternals.cpp, not these objects. Historical #268/#272 mention these NIDs but do not implement them.

Independent Windows validation

Own-source build at8e1f4f802eb0e0df550c39df9c9ee20cf2e8ff43 (base4f24b6a64c plus unrelated feholdexcept), GCC15.2 Release, Windows x86-64. No games, proprietary modules or captures.

Parsed the built PE export tables and section characteristics. All three providers are only libSceAmpr, with RVAs0x50b0,0x5100,0x50e0 respectively, in .text. Loaded the isolated built modules and used GetProcAddress/VirtualQuery: each resolved address is PAGE_EXECUTE_READ (0x20). GetProcAddress returns null for all three NIDs in libSceLibcInternal and libc. No guest function was invoked and no purported object was dereferenced. This validates the bindings and their representation; it does not establish correct object contents or console layouts.

Minimal binding probe (pass the absolute directory of locally built patched libraries; include compiler runtime DLLs there):

import ctypes, pathlib, sys
k = ctypes.WinDLL('kernel32', use_last_error=True)
k.LoadLibraryExW.argtypes = (ctypes.c_wchar_p, ctypes.c_void_p, ctypes.c_uint32)
k.LoadLibraryExW.restype = ctypes.c_void_p
k.GetProcAddress.argtypes = (ctypes.c_void_p, ctypes.c_char_p)
k.GetProcAddress.restype = ctypes.c_void_p
k.FreeLibrary.argtypes = (ctypes.c_void_p,)
for module in ('libSceAmpr.prx', 'libSceLibcInternal.prx', 'libc.prx'):
    handle = k.LoadLibraryExW(str(pathlib.Path(sys.argv[1]) / module), None, 0x1100)
    if not handle:
        raise ctypes.WinError(ctypes.get_last_error())
    try:
        for nid in (b'-mLzBSk-VGs', b'a54t8+k7KpY', b'KfcTPbeaOqg'):
            print(module, nid.decode(), bool(k.GetProcAddress(handle, nid)))
    finally:
        k.FreeLibrary(handle)

The first module prints true for all three; the other two print false. objdump -p on the patched PE plus objdump -d on the unpatched Ampr identify the code targets; source confirms they are functions.

Remaining implementation questions

The two ID objects need verified size/alignment, initialization, assignment/guard synchronization, identity sharing across re-export modules and integration with locale facet registration. The vtable needs the correct Dinkumware facet layout, RTTI/address point and method ABI. SDK object labels and C++ mangled names do not establish those details or module/library versions. I have not replaced these functions with guessed storage, invented facet methods or a success stub.

AI-assisted investigation and reproduction.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5954030887 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8875). Originally posted by [UnhealthyKraken](https://github.com/UnhealthyKraken) on 2026-10-21T03:55:14Z. --- ### Problem Three locale data NIDs are currently exported by libSceAmpr as `int(void)` functions calling NotImplemented. The public SDK labels the corresponding symbols as objects in libSceLibcInternal. Resolving an object's address to a throwing function does not provide an unsupported-object trap: a data consumer reads code bytes instead of calling that function. | NID | SDK symbol | | --- | --- | | `-mLzBSk-VGs` | `_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE` | | `a54t8+k7KpY` | `_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE` | | `KfcTPbeaOqg` | `_ZTVSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE` | ### Evidence - The pinned public [SDK symbol table](https://github.com/ps5-payload-dev/sdk/blob/a7685ce8e97ce1f8a4f38253a41d54241c9124f1/sce_stubs/libSceLibcInternal.c#L10082) declares the two IDs with `@object` (time_get at line10126), and the [vtable entry](https://github.com/ps5-payload-dev/sdk/blob/a7685ce8e97ce1f8a4f38253a41d54241c9124f1/sce_stubs/libSceLibcInternal.c#L11818) is also `@object`. The [Itanium ABI](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-special) identifies the TV special name as a virtual table, whose contents are data describing the class. - Current [Ampr source](https://github.com/boykopovar/AnyPS5/blob/7ab4b2e5610c3d4328c83566cba488eb82972c9c/core/libs/prx/libSceAmpr/Export.cpp#L850) implements all three as no-argument functions. The vtable placeholder is at line863 and time_get ID at873. No corresponding source change between the tested head and inspected main7ab4b2e561. - #545 explicitly left num_get/time_get/vtables unresolved after the CRT re-export work. This report records the data-versus-function ABI problem in that remaining work. Fresh num_get/time_get issue/PR searches and the all-state title/body index found no correction; open #8384 concerns _Sto*x conversions in DinkumwareInternals.cpp, not these objects. Historical #268/#272 mention these NIDs but do not implement them. ### Independent Windows validation Own-source build at8e1f4f802eb0e0df550c39df9c9ee20cf2e8ff43 (base4f24b6a64c plus unrelated feholdexcept), GCC15.2 Release, Windows x86-64. No games, proprietary modules or captures. Parsed the built PE export tables and section characteristics. All three providers are only libSceAmpr, with RVAs0x50b0,0x5100,0x50e0 respectively, in `.text`. Loaded the isolated built modules and used GetProcAddress/VirtualQuery: each resolved address is PAGE_EXECUTE_READ (0x20). GetProcAddress returns null for all three NIDs in libSceLibcInternal and libc. No guest function was invoked and no purported object was dereferenced. This validates the bindings and their representation; it does not establish correct object contents or console layouts. Minimal binding probe (pass the absolute directory of locally built patched libraries; include compiler runtime DLLs there): ```python import ctypes, pathlib, sys k = ctypes.WinDLL('kernel32', use_last_error=True) k.LoadLibraryExW.argtypes = (ctypes.c_wchar_p, ctypes.c_void_p, ctypes.c_uint32) k.LoadLibraryExW.restype = ctypes.c_void_p k.GetProcAddress.argtypes = (ctypes.c_void_p, ctypes.c_char_p) k.GetProcAddress.restype = ctypes.c_void_p k.FreeLibrary.argtypes = (ctypes.c_void_p,) for module in ('libSceAmpr.prx', 'libSceLibcInternal.prx', 'libc.prx'): handle = k.LoadLibraryExW(str(pathlib.Path(sys.argv[1]) / module), None, 0x1100) if not handle: raise ctypes.WinError(ctypes.get_last_error()) try: for nid in (b'-mLzBSk-VGs', b'a54t8+k7KpY', b'KfcTPbeaOqg'): print(module, nid.decode(), bool(k.GetProcAddress(handle, nid))) finally: k.FreeLibrary(handle) ``` The first module prints true for all three; the other two print false. `objdump -p` on the patched PE plus `objdump -d` on the unpatched Ampr identify the code targets; source confirms they are functions. ### Remaining implementation questions The two ID objects need verified size/alignment, initialization, assignment/guard synchronization, identity sharing across re-export modules and integration with locale facet registration. The vtable needs the correct Dinkumware facet layout, RTTI/address point and method ABI. SDK object labels and C++ mangled names do not establish those details or module/library versions. I have not replaced these functions with guessed storage, invented facet methods or a success stub. AI-assisted investigation and reproduction.
mazen320 commented 2026-10-21 20:39:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T20:39:22Z.


Console measurement (jailbroken PS5 FTP 192.168.0.144, libSceLibcInternal.sprx SHA-256 a2d70cc64c3abc3927662cbe0c3765b74b2385b4b2ad80eb7b942a891f9259fb, parsed with the module's own DT_SYMTAB / DT_STRTAB; no Ghidra).

NID Symbol (SDK) st_info bind st_size storage
-mLzBSk-VGs num_get<char>::id STT_OBJECT STB_WEAK 8 BSS (zero-init; not in file)
a54t8+k7KpY time_get<char>::id STT_OBJECT STB_WEAK 8 BSS (zero-init)
KfcTPbeaOqg num_get<char> vtable STT_OBJECT STB_WEAK 136 file-backed, all zeros (17×8)

libSceAmpr.sprx from the same console has no dynsym entries for these three NIDs (Ampr is 152 STT_FUNC + 2 unrelated STT_OBJECT). That matches moving the providers into libc and dropping the Ampr int(void) stubs.

Mismatch with this PR head: the vtable is exported as 15 uintptr_t slots (120 bytes). On the console the symbol size is 136 (17 slots). Ids of size 8 and zero-init match what you already have. Suggest sizing _ZTVSt7num_get... to [17] so st_size matches the console export; a 15-slot object is short by two pointers relative to the firmware symbol.

REA: Ghidra/Hopper not usable for these ELF SPRX on Windows here; sizes come from the ELF symbol table only. No title run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326047521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8875#issuecomment-6326047521). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-21T20:39:22Z. --- Console measurement (jailbroken PS5 FTP `192.168.0.144`, `libSceLibcInternal.sprx` SHA-256 `a2d70cc64c3abc3927662cbe0c3765b74b2385b4b2ad80eb7b942a891f9259fb`, parsed with the module's own `DT_SYMTAB` / `DT_STRTAB`; no Ghidra). | NID | Symbol (SDK) | `st_info` | bind | `st_size` | storage | | --- | --- | --- | --- | --- | --- | | `-mLzBSk-VGs` | `num_get<char>::id` | `STT_OBJECT` | `STB_WEAK` | **8** | BSS (zero-init; not in file) | | `a54t8+k7KpY` | `time_get<char>::id` | `STT_OBJECT` | `STB_WEAK` | **8** | BSS (zero-init) | | `KfcTPbeaOqg` | `num_get<char>` vtable | `STT_OBJECT` | `STB_WEAK` | **136** | file-backed, **all zeros** (17×8) | `libSceAmpr.sprx` from the same console has **no** dynsym entries for these three NIDs (Ampr is 152 `STT_FUNC` + 2 unrelated `STT_OBJECT`). That matches moving the providers into libc and dropping the Ampr `int(void)` stubs. Mismatch with this PR head: the vtable is exported as **15** `uintptr_t` slots (120 bytes). On the console the symbol size is **136** (17 slots). Ids of size 8 and zero-init match what you already have. Suggest sizing `_ZTVSt7num_get...` to `[17]` so `st_size` matches the console export; a 15-slot object is short by two pointers relative to the firmware symbol. REA: Ghidra/Hopper not usable for these ELF SPRX on Windows here; sizes come from the ELF symbol table only. No title run.
UnhealthyKraken commented 2026-10-22 03:16:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-22T03:16:29Z.


I checked the current #8880 source at 2a796cb4473db98e1df827fe137d32dcea39880c: the proposed num_get vtable is now [17], and the tests declare the same extent. The earlier 15-slot mismatch is therefore addressed in that proposal. It also removes the three Ampr function-shaped providers and defines the objects in libc.

Your reported symbol-table measurements corroborate the object kinds and 8/8/136-byte extents; I am recording them as attributed contributor evidence, not an independently repeated console measurement. The current proposal still uses zeroed vtable storage and documents that facet calls are unsupported. Object binding/extent and working facet behavior remain distinct claims. #8880 is still open, so the reported current-main ABI problem should stay open pending integration; no duplicate implementation is needed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331807865 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8875#issuecomment-6331807865). Originally posted by [UnhealthyKraken](https://github.com/UnhealthyKraken) on 2026-10-22T03:16:29Z. --- I checked the current #8880 source at `2a796cb4473db98e1df827fe137d32dcea39880c`: the proposed num_get vtable is now `[17]`, and the tests declare the same extent. The earlier 15-slot mismatch is therefore addressed in that proposal. It also removes the three Ampr function-shaped providers and defines the objects in libc. Your reported symbol-table measurements corroborate the object kinds and 8/8/136-byte extents; I am recording them as attributed contributor evidence, not an independently repeated console measurement. The current proposal still uses zeroed vtable storage and documents that facet calls are unsupported. Object binding/extent and working facet behavior remain distinct claims. #8880 is still open, so the reported current-main ABI problem should stay open pending integration; no duplicate implementation is needed.
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#8875
No description provided.