Repository navigation
docs(libSceAgcDriver): record the measured null argument answer of sceAgcDriverGetRegShadowInfo - #23451
Conversation
…eAgcDriverGetRegShadowInfo Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Probe source (built with ps5-payload-sdk; probe.c/* Probe: sceAgcDriverGetRegShadowInfo and sceAgcDriverGetRegShadowInfoAgr with a null argument only (debt libSceAgcDriver.md:66: a null argument returns 0x8A6D0003 before anything else is read, as the libSceAgcDriver of firmware 13.42 does (read in disassembly, not measured on a console); every other call throws; in the module the other path depends on the driver context that the module constructor fills at load, when its field at +8 is nonzero the call returns 0x8A6D0001, otherwise it copies a 0x28-byte register-shadow record). Payload process, firmware 11.60 (a title process may differ). The module is opened with dlopen("libSceAgcDriver.sprx") (its constructor runs, which the probe cannot influence), every name is looked up with dlsym first (both functions and the control name sceAgcDriverIsEsvmProcess, which is only looked up and never called). Each of the two functions is called exactly once, the first argument NULL and the others zero, never with a valid pointer, nothing in the driver state is changed. A fault is caught by a guard (one hit per case, more than eight end the probe with _exit(125)); a fault is a result and the calls stop after the first fault. Nothing is written to a file, nothing is sent, no service is initialised by the probe. */
#include <dlfcn.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ps5/kernel.h> /* only for kernel_get_fw_version() */
#ifndef PROBE_NAME
#define PROBE_NAME "unnamed"
#endif
#ifndef PROBE_BUILD
#define PROBE_BUILD "unbuilt"
#endif
/* Self limit: the runner can only close the connection, it cannot end the process on the console, so the probe ends
itself after PROBE_MAX_S seconds at the latest (set by the build script). */
#ifndef PROBE_MAX_S
#define PROBE_MAX_S 50
#endif
static volatile int g_handle = -1;
static int (*volatile g_setmargins)(int, int, int) = 0; /* unused here */
static void reset_rate(void) {
if (g_setmargins && g_handle >= 0) g_setmargins(g_handle, 0, 0);
}
static void probe_alarm(int sig) {
static const char msg[] = "TIMEOUT\tprobe self limit\n";
(void)sig;
(void)!write(1, msg, sizeof msg - 1);
reset_rate();
_exit(124);
}
/* Watchdog thread: alarm()/SIGALRM does not help when the main thread hangs in a blocking system call or IPC. The
thread sleeps PROBE_MAX_S seconds, writes TIMEOUT with write() and ends the process with _exit(124). alarm() stays
as a second safeguard. */
static void* probe_watchdog(void* arg) {
static const char msg[] = "TIMEOUT\tprobe watchdog thread\n";
unsigned left = PROBE_MAX_S;
(void)arg;
while (left) left = sleep(left);
(void)!write(1, msg, sizeof msg - 1);
reset_rate();
_exit(124);
return 0;
}
static void probe_watchdog_start(void) {
pthread_t t;
if (pthread_create(&t, 0, probe_watchdog, 0) == 0) pthread_detach(t);
}
static int cases = 0;
static void probe_header(void) {
char utc[32];
time_t now = time(0);
probe_watchdog_start();
struct tm tmv;
gmtime_r(&now, &tmv);
strftime(utc, sizeof utc, "%Y-%m-%dT%H:%M:%SZ", &tmv);
printf("PROBE\t%s\tfw=0x%08x\tbuild=%s\tpid=%d\tutc=%s\n", PROBE_NAME, kernel_get_fw_version(), PROBE_BUILD,
getpid(), utc);
fflush(stdout);
}
static void probe_case(const char* id, const char* call, long ret, int err, const char* extra) {
printf("CASE\t%s\t%s\t%ld\t%d\t%s\n", id, call, ret, err, extra ? extra : "-");
fflush(stdout);
cases++;
}
static void probe_end(void) {
printf("END\t%d\n", cases);
fflush(stdout);
}
#include <setjmp.h>
static sigjmp_buf guard_env;
static volatile int guard_sig = 0, guard_active = 0, guard_hits = 0;
static void guard_handler(int s) {
static const char msg[] = "FAULT" "\t" "guard" "\n";
guard_sig = s;
if (!guard_active || ++guard_hits > 8) { (void)!write(1, msg, sizeof msg - 1); _exit(125); }
guard_active = 0;
siglongjmp(guard_env, 1);
}
static int stopped = 0;
#define GUARDED(stmt) do { guard_sig = 0; if (sigsetjmp(guard_env, 1) == 0) { guard_active = 1; errno = 0; stmt; guard_active = 0; } else stopped = 1; } while (0)
static char extra[400];
typedef uint32_t (*fn_rs)(void*, void*, void*, void*);
int main(void) {
struct sigaction sa;
memset(&sa, 0, sizeof sa);
sa.sa_handler = guard_handler;
sigaction(SIGSEGV, &sa, 0);
sigaction(SIGBUS, &sa, 0);
signal(SIGALRM, probe_alarm);
alarm(PROBE_MAX_S);
probe_header();
errno = 0;
void* dr = dlopen("libSceAgcDriver.sprx", RTLD_LAZY);
snprintf(extra, sizeof extra, "libSceAgcDriver=%d", dr != 0);
probe_case("0", "load libSceAgcDriver.sprx", dr ? 0 : -1, errno, extra);
if (!dr) { probe_end(); return 0; }
fn_rs f1 = (fn_rs)dlsym(dr, "sceAgcDriverGetRegShadowInfo");
fn_rs f2 = (fn_rs)dlsym(dr, "sceAgcDriverGetRegShadowInfoAgr");
void* ctl = dlsym(dr, "sceAgcDriverIsEsvmProcess");
snprintf(extra, sizeof extra, "sceAgcDriverGetRegShadowInfo=%d sceAgcDriverGetRegShadowInfoAgr=%d control_IsEsvmProcess_not_called=%d", f1 != 0, f2 != 0, ctl != 0);
probe_case("0b", "dlsym of the functions", 0, 0, extra);
uint32_t rc = 0xDEADBEEFu;
if (f1) {
GUARDED(rc = f1(0, 0, 0, 0));
snprintf(extra, sizeof extra, "rc=0x%08x fault_signal=%d", rc, (int)guard_sig);
probe_case("1", "sceAgcDriverGetRegShadowInfo(NULL)", (long)rc, 0, extra);
}
if (f2 && !stopped) {
rc = 0xDEADBEEFu;
GUARDED(rc = f2(0, 0, 0, 0));
snprintf(extra, sizeof extra, "rc=0x%08x fault_signal=%d", rc, (int)guard_sig);
probe_case("2", "sceAgcDriverGetRegShadowInfoAgr(NULL)", (long)rc, 0, extra);
}
if (stopped) probe_case("3", "calls stopped after the first fault", 0, 0, "remaining calls skipped by design");
probe_end();
return 0;
}raw output (stdout) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The documentation fragment matches the measured null-call results and the implementation; no blocking defect was verified.
What I ran
Reviewed head d04a7283b4794fc1255137484e49c9a273c37e4c. Read the PR description, commit message, manifest, diff, changed fragment, and relevant technical-debt entry and export implementation through repo_read.py. No commands or tests were run; the check results in the description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Changed-line review | passed | All four added lines read |
| Documentation checks | not run | Reported by author only |
| Tests | not applicable | Documentation-only change |
Negative control
Not run; this documentation-only change adds no test.
Findings
Blocking
None.
Non-blocking
None.
Sources
The fragment records the two null-call results and explicitly limits the measurement to firmware 11.60 in a payload process. The implementation returns 0x8A6D0003 for null in both functions and sends non-null calls to NotImplemented_nid_no_patch (core/libs/prx/libSceAgcDriver/Export.cpp, lines 36–43). The existing debt entry it updates is docs/dev/debt/libSceAgcDriver.md, line 66.
Not verified
No excluded changed files; the manifest lists one changed file and it was read in full. I did not independently verify the console probe, the author's reported convention and debt-fold checks, title-process behavior, non-null console behavior, or behavior on other firmware versions.
To get this to a good state
Nothing is required. The console measurement and check results are author-reported, not independently verified.
What
The
sceAgcDriverGetRegShadowInfoandsceAgcDriverGetRegShadowInfoAgrentry indocs/dev/debt/libSceAgcDriver.md(line 66) says that a null argument returns0x8A6D0003before anything else is read, as firmware 13.42's module does, "read to the return, disassembly only, not measured on a console". A probe on a PS5 with firmware 11.60, from a payload process, called both functions with a null argument and each returned0x8A6D0003without a fault (cases 1 and 2, lines 5 and 6 of the raw output). The entry now says that for firmware 11.60. The rest of the entry, the path that depends on the driver context (0x8A6D0001when its field at +8 is nonzero, otherwise a 0x28-byte record) and the throwing of every other call, is not measured: the probe passes no other argument. LoadinglibSceAgcDriver.sprxruns the module's constructor, which the probe cannot influence, and the raw output shows[AgcDriver] Info - Initialized, submit.mode= 1.(line 2). Only this one entry changes, as a new fragment indocs/dev/debt/changes/; no code does.AnyPS5 returns the same: both functions return
0x8A6D0003for a null argument (core/libs/prx/libSceAgcDriver/Export.cpplines 36 and 37 and 41 and 42).Tested
Measured on a PS5 with firmware 11.60 (
kernel_get_fw_version0x11600005, line 1 of the raw output), from a homebrew payload process, on 2026-11-19 at 00:34 UTC (the console's own clock in thePROBEline reads 02:16:21Z, 1 h 42 min ahead of the runner's clock). A title process may differ. The cases are 0 to 2, lines 3 to 6 of the raw output in the first comment; the controlsceAgcDriverIsEsvmProcesswas looked up and not called (line 4).sceAgcDriverGetRegShadowInfo(NULL)0x8A6D0003, no fault (line 5)0x8A6D0003(Export.cpp line 37)sceAgcDriverGetRegShadowInfoAgr(NULL)0x8A6D0003, no fault (line 6)0x8A6D0003(Export.cpp line 42)The line numbers of
Export.cppare those ofmainat f7f560c.tools/check_conventions.pyreports no error on the branch anddebt_fold --checkreturns 0; the changed entry is 990 characters without the list marker. This is a documentation change, so no test was added or run. Not tested: Linux, macOS, the CI runner, a title process, a non-null argument, and firmware other than 11.60.Overlap: counted on 2026-11-19 at 02:09 UTC from the 2003 open pull requests (file lists from the GitHub API; the ten with 100 or more files were read in full through the files API; the patches of the 1091 pull requests that change a file under
docs/dev/debt/or the cited source file were searched forsceAgcDriverGetRegShadowInfoandsceAgcDriverGetRegShadowInfoAgr) againstmainat f7f560c. This pull request adds one file,docs/dev/debt/changes/docs-libsceagcdriver-regshadow-null-measured.md, and no code; no open pull request has a file of that name. No open pull request changescore/libs/prx/libSceAgcDriver/Export.cpp, and no patch of the open pull requests names the two functions. About a hundred open pull requests changedocs/dev/debt/libSceAgcDriver.md, and #20447, #20406, #20001 and #19999 addlibSceAgcDriverfragments about other output-pointer probes; none touches the entry of the two functions (line 66). A search of the open pull requests for the function names finds nothing. This pull request does not depend on any of them (Depends on: none).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)