Skip to content

docs(libSceSystemService): record the valid-buffer and unmapped-pointer results of sceSystemServiceGetDisplaySafeAreaInfo on firmware 11.60 - #27880

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs/libscesystemservice-displaysafearea-unmapped
Dec 6, 2026

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What

The debt entry for sceSystemServiceGetDisplaySafeAreaInfo (docs/dev/debt/libSceSystemService.md:173 on main 13bf980d9659) says that whether the console faults or returns an argument error on unmapped memory is unmeasured. A probe on a PS5 (firmware 11.60, payload process; a title process may differ) called the function with an own 132-byte buffer filled with 0xAA: it returned 0 and changed only the first 4 bytes, to 0x3f800000, the float 1.0 (case a.1, line 10 of the raw output in the first comment), and the same again in a second call (case a.2, line 11). The call with the unmapped output pointer 0x10 did not return: the probe's handler (installed for SIGSEGV, SIGBUS and SIGABRT, probe.c:79 to :81) caught a signal and the CASE line shows signal=11 with the return value -1 (case z.1, line 13; probe.c:126). It ran once; line 14 says that the fault ended the calls, so a read-only buffer and NULL were not measured. The size of 132 bytes (a float and 128 reserved bytes) and the prototype (a pointer to it) are assumed from AnyPS5's own type SystemServiceDisplaySafeAreaInfo (core/libs/SceTypes.hpp:2209 to :2212); the probe did not measure how many bytes the console may write. Line 3 is a [SceLncUtil] ... getAppStatus: LNC_ISOK::0x80940004 message that the console printed during the run.

On main the function returns SYSTEM_SERVICE_ERROR_PARAMETER (-2136932349, core/libs/prx/libSceSystemService/SystemService.hpp:17) for a NULL pointer and for an output that cannot be written, and otherwise writes the whole 132-byte structure, the ratio 1.0 followed by zero bytes, and returns 0 (core/libs/prx/libSceSystemService/Export.cpp:419 to :430); the console changed only the first 4 bytes of the 0xAA-filled buffer. The entry states the measured answers; it does not change any code.

This pull request replaces the entry in a new fragment (docs/dev/debt/changes/docs-libscesystemservice-displaysafearea-unmapped.md, ## change [sceSystemServiceGetDisplaySafeAreaInfo guest output]); the entry grows from 325 to 586 characters with its list marker. It keeps that the PARAMETER answer is a host-safety fallback, states the valid-buffer answer 0 with only the first 4 bytes changed to the float 1.0 (the same in a second call) and the fault for an unmapped pointer (one run), and says that the prototype and the buffer layout are assumed. No code changes.

Not measured: a NULL output pointer, a read-only output buffer, the number of bytes the console may write beyond the 132 assumed, the values for a title process, other firmware.

Tested

Measured on a PS5 with firmware 11.60 from a homebrew payload process, one run at about 07:19 UTC on 2026-11-27 (probe build 19306b2522f2, END 8). This is a documentation change; no test was added or run.

On the head merged into main at 13bf980 (2026-11-27 17:30 UTC) I ran tools/check_conventions.py --base upstream/main with this title and description (All conventions checks passed, exit code 0) and tools/debt_fold.py --check (exit code 0, no message). The commit has one author, xXPBSXx with the noreply address, and adds one new file with the mode 100644.

Overlap: counted on 2026-11-27 from the 2168 open pull requests (file lists from the GitHub API, the 13 with 100 or more files read in full through the files API and, for those and for the pull requests with an old base, the real diff against the merge base; the patches of the 1299 pull requests that change a file under docs/dev/debt/ or a libSceSystemService file, or have SystemService, HdrToneMap, NoticeSkip, ParamGetInt or DisplaySafeArea in the title or branch name, were searched for sceSystemServiceGetHdrToneMapLuminance, sceSystemServiceGetNoticeScreenSkipFlag, sceSystemServiceParamGetInt, sceSystemServiceGetDisplaySafeAreaInfo, the short names HdrToneMap, NoticeScreenSkip and DisplaySafeArea and the four fragment names, from 15:15 to 15:35 UTC). No open pull request changes the fragment docs/dev/debt/changes/docs-libscesystemservice-displaysafearea-unmapped.md or the entry for sceSystemServiceGetDisplaySafeAreaInfo at docs/dev/debt/libSceSystemService.md:173. The base of this branch is 2b6c1b044528. The only pull requests whose patch names one of the four functions or short names are #20235 (fix(libSceVideoOut): clear the HDR report when the Windows window query fails, which rewrites the HDR output entry in docs/dev/debt/libSceVideoOut.md and names sceSystemServiceGetHdrToneMapLuminance there, a different entry in a different file), #24736 (feat(libSceWkFontConfig): look fonts up in the firmware font table, which calls sceSystemServiceParamGetInt(1, ...) and names it in its own fragment) and #12315 (feat(libSceLibreSsl3): implement numeric object identifier text parsing, an old base, whose patch adds SystemServiceParamGetInt as an export of the module libReactNative.Modules.Vsh.WebAppLauncher, a different function, and has other names that only end in ParamGetInt); none of them changes one of the four entries. The other open pull requests that change a libSceSystemService file (#27751, #27629, #27626, #27531, #25260, #25101, #20896, #17144, #17090, #15973, #15947, #14202; #25704 lists SystemService files only because of its old base, its own diff of 7 files has none) were searched in the real diff against the merge base for the same names and fragment names and do not contain them; #27531 is the fragment of sceSystemServiceGetStatus by the same author, a different entry (:178). The merges of this head with each of these pull requests and with the pull requests with 100 or more files or an old base (#25940, #22647, #20315, #14443, #14340, #13929, #13928, #12315, #10193, #9508, #7642, #6743) were made with git merge-tree from 15:15 to 15:39 UTC against main at b464859c1f83: #27751, #27629, #27626, #27531, #25260, #25101, #20896, #17144, #17090, #15947, #25940, #25704 and #6743 are clean; #15973 (6 files), #14202 (1 file), #22647, #20315, #14443, #14340, #13929, #13928, #12315, #10193, #9508 and #7642 already conflict with main alone, in at least as many files as with this head, so none of them conflicts because of this change. The count was repeated for the pull requests that were opened or updated since 15:15 UTC (147 of the 2111 open pull requests, listed from 17:22 to 17:28 UTC; the 91 of them with a debt file, a SystemService path or one of the names in the title or branch were patch-scanned for the same names and fragment names): no further pull request names one of the four functions or changes one of the four entries or fragments; the two that change a SystemService file, #27751 and #27626, merge cleanly with each of the four heads (git merge-tree of the head with the pull request head, compared with main at 13bf980). No commit on main since 2b6c1b044528 (268 commits) changed the four entries, core/libs/prx/libSceSystemService/Export.cpp or a SystemService fragment. A merge of this head into main at 13bf980 was checked the same way at 17:30 UTC and is clean, and the four heads of this series (hdrtonemap, noticeskip, paramgetint, displaysafearea, each a new file of its own) merge with each other without a conflict. This pull request does not depend on any of them (Depends on: none).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (no graphics change)
  • AI-assisted: yes

Summary by CodeRabbit

  • Documentation
    • Added developer-facing notes on display safe-area information requests, covering observed behavior, invalid output handling, and assumptions about expected inputs and returned data. No end-user-facing behavior changes are included in this update.

…er results of GetDisplaySafeAreaInfo

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

xXPBSXx commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Probe source (PROBE_BUILD is the first 12 hex digits of the SHA-256 of the original source) and the complete raw output of the run that this pull request cites by line number (line 1 is the PROBE line). The run started at about 07:19 UTC on 2026-11-27: it opens libSceSystemService.sprx with dlopen, takes sceSystemServiceGetDisplaySafeAreaInfo with dlsym, passes an own 132-byte buffer filled with 0xAA twice and then the unmapped pointer 0x10; the cases that follow in the source (a read-only buffer and NULL) did not run, because a fault ends the calls. The utc in a PROBE line is the console's own clock, about 1 h 42 min ahead of real UTC. Lines that start with [SceLncUtil] are messages that the console printed during the run; in each CASE line the columns are the case, the call, the return value, the errno and the details. A call that ended in a fault is printed with the return value -1, and signal=11 in the details is the signal number that the probe's handler caught. The sources are posted verbatim except that internal labels in their first comment were removed; the code is unchanged, and each build ID is the hash of the original file.

Run: probe.c (build 19306b2522f2)
#include <errno.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: on timeout the runner can only close the connection, not end the process on the console.
   The probe ends itself after at most PROBE_MAX_S seconds (the build script sets timeout - 10 s). */
#ifndef PROBE_MAX_S
#define PROBE_MAX_S 50
#endif

static void probe_alarm(int sig) {
  static const char msg[] = "TIMEOUT\tprobe self limit\n";
  (void)sig;
  (void)!write(1, msg, sizeof msg - 1);
  _exit(124);
}

static int cases = 0;

static void probe_header(void) {
  char utc[32];
  time_t now = time(0);
  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);
}

/* CASE: id, description of the call, return value as long, errno (0 if not set), extra (hex/bytes). */
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 <dlfcn.h>
#include <setjmp.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/mman.h>
#include <sys/types.h>

static sigjmp_buf guard_env;
static volatile int guard_sig = 0;
static volatile int guard_active = 0;
static volatile int guard_hits = 0;
static void guard_handler(int s) {
  static const char msg[] = "FAULT\tprobe guard: fault outside a guarded call or too many faults\n";
  if(!guard_active || ++guard_hits > 8) {
    (void)!write(1, msg, sizeof msg - 1);
    _exit(125);
  }
  guard_sig = s;
  guard_active = 0;
  siglongjmp(guard_env, 1);
}
static void guard_arm(void) {
  struct sigaction sa;
  memset(&sa, 0, sizeof sa);
  sa.sa_handler = guard_handler;
  sigaction(SIGSEGV, &sa, 0);
  sigaction(SIGBUS, &sa, 0);
  sigaction(SIGABRT, &sa, 0);
}
#define CALL(rvar, evar, expr) do { errno = 0; guard_sig = 0; rvar = -1; if(sigsetjmp(guard_env, 1) == 0) { guard_active = 1; rvar = (expr); } guard_active = 0; evar = errno; } while(0)
#include <time.h>

/* sceSystemServiceGetDisplaySafeAreaInfo in libSceSystemService.sprx on firmware 11.60 (payload process; a title process may differ), output buffer cases for debt entry libSceSystemService.md:173 (an unwritable output pointer: does the console fault or return an argument error; the valid output is not recorded anywhere either). dlopen first (result printed at once), controls, names. The prototype (info*) and the layout (a float ratio and 128 reserved bytes, 132 bytes) are ASSUMPTIONS from core/libs/SceTypes.hpp (SystemServiceDisplaySafeAreaInfo) and core/libs/prx/libSceSystemService/Export.cpp of AnyPS5 (upstream/main 37749b6cd567); the valid buffer is filled with 0xAA so that the written bytes show. Pointer cases (0x10, a read-only literal, NULL) are single calls and come last; a fault ends the calls. A watchdog thread ends the probe after PROBE_MAX_S. No state is set, read only. */

typedef long (*f4_t)(long, long, long, long);
static void* L;
static int stopped = 0;
static void note(const char* t) { printf("NOTE\t%s\n", t); fflush(stdout); }
static void report(const char* id, const char* what, const char* ex) { probe_case(id, what, 0, 0, ex); }
static void* wd_thread(void* arg) {
  static const char msg[] = "TIMEOUT\twatchdog thread\n";
  unsigned left = PROBE_MAX_S;
  (void)arg;
  while(left) left = sleep(left);
  (void)!write(1, msg, sizeof msg - 1);
  _exit(124);
  return 0;
}
static void wd_start(void) { pthread_t t; if(pthread_create(&t, 0, wd_thread, 0) == 0) pthread_detach(t); }
static int canary_ok(const unsigned char* p, int n) { for(int i = 0; i < n; i++) if(p[i] != 0xAA) return 0; return 1; }

static struct { unsigned char b[132]; unsigned char can[64]; } B;

static const char RO[32] = "read-only probe literal";
static f4_t fn;
static void run(const char* id, const char* what, long ptr, int own, int words) {
  if(stopped) return;
  if(own) { memset(B.b, 0xAA, sizeof B.b); memset(B.can, 0xAA, sizeof B.can); }
  long r = -1; int e = 0;
  CALL(r, e, fn(ptr, 0, 0, 0));
  char ex[520];
  if(own) {
    int ch = 0, last = -1;
    for(int i = 0; i < (int)sizeof B.b; i++) if(B.b[i] != 0xAA) { ch++; last = i; }
    unsigned w[4] = {0, 0, 0, 0};
    memcpy(w, B.b, 16);
    float f0; memcpy(&f0, B.b, 4);
    snprintf(ex, sizeof ex, "rc=0x%08x errno=%d changed=%d last_changed=%d word0=0x%08x word1=0x%08x word2=0x%08x word3=0x%08x float0=%g canaries_intact=%d signal=%d", (unsigned)r, e, ch, last, w[0], w[1], w[2], w[3], (double)f0, canary_ok(B.can, 64), (int)guard_sig);
  } else {
    snprintf(ex, sizeof ex, "rc=0x%08x errno=%d signal=%d", (unsigned)r, e, (int)guard_sig);
  }
  (void)words;
  probe_case(id, what, guard_sig ? -1 : (int)r, e, ex);
  if(guard_sig) stopped = 1;
}

int main(void) {
  signal(SIGALRM, probe_alarm);
  alarm(PROBE_MAX_S);
  probe_header();
  guard_arm();
  wd_start();
  note("0.pre: dlopen of libSceSystemService.sprx next");
  L = dlopen("libSceSystemService.sprx", RTLD_LAZY);
  { char ex[16]; snprintf(ex, sizeof ex, "%d", L != 0); report("0", "dlopen of the module (1 yes, 0 no)", ex); }
  if(!L) { probe_end(); return 0; }
  { void* k = dlopen("libkernel.sprx", RTLD_LAZY); char ex[80]; snprintf(ex, sizeof ex, "libkernel_opened=%d control_found=%d", k != 0, k ? dlsym(k, "sceKernelGetProcessTime") != 0 : 0); report("1", "control in libkernel.sprx: sceKernelGetProcessTime (dlsym, name only)", ex); }
  { char ex[40]; snprintf(ex, sizeof ex, "found=%d", dlsym(L, "sceSystemServiceParamGetInt") != 0); report("1b", "control in the same module: sceSystemServiceParamGetInt (dlsym, name only; resolved in earlier runs)", ex); }
  { char ex[40]; snprintf(ex, sizeof ex, "found=%d", dlsym(L, "probe_e_no_such_function_in_module") != 0); report("2", "negative control, a name that does not exist (expected found=0)", ex); }
  { char ex[40]; snprintf(ex, sizeof ex, "found=%d", dlsym(L, "sceSystemServiceGetDisplaySafeAreaInfo") != 0); report("3", "the function under test (dlsym, name only)", ex); }
  fn = (f4_t)dlsym(L, "sceSystemServiceGetDisplaySafeAreaInfo");
  if(!fn) { probe_end(); return 0; }
  note("next: GetDisplaySafeAreaInfo with an own 132 byte output buffer filled with 0xAA (assumed layout: a float ratio and 128 reserved bytes, from the AnyPS5 type), twice; assumed prototype (info*)");
  run("a.1", "GetDisplaySafeAreaInfo(own 132 byte buffer, 0xAA fill): rc, bytes changed, first words", (long)(void*)B.b, 1, 4);
  run("a.2", "the same call again (stable?)", (long)(void*)B.b, 1, 4);
  note("next: pointer cases, one call each, last, in this order; a fault ends the calls (hello2 after)");
  run("z.1", "GetDisplaySafeAreaInfo(output pointer 0x10, unmapped)", 0x10, 0, 0);
  run("z.2", "GetDisplaySafeAreaInfo(output pointer to a read-only literal: mapped but not writable)", (long)(void*)RO, 0, 0);
  run("z.3", "GetDisplaySafeAreaInfo(NULL output pointer)", 0, 0, 0);
  if(stopped) note("a fault ended the calls");
  probe_end();
  return 0;
}
Run: raw output (15 lines)
PROBE	libSceSystemService_displaysafearea_output	fw=0x11600005	build=19306b2522f2	pid=118	utc=2026-11-27T09:02:00Z
NOTE	0.pre: dlopen of libSceSystemService.sprx next
[SceLncUtil] W:\Build\J03675035\vsh\common_lib\lnc_util\src\lnc_util_ipc_client.cpp(382) getAppStatus: LNC_ISOK::0x80940004
CASE	0	dlopen of the module (1 yes, 0 no)	0	0	1
CASE	1	control in libkernel.sprx: sceKernelGetProcessTime (dlsym, name only)	0	0	libkernel_opened=1 control_found=1
CASE	1b	control in the same module: sceSystemServiceParamGetInt (dlsym, name only; resolved in earlier runs)	0	0	found=1
CASE	2	negative control, a name that does not exist (expected found=0)	0	0	found=0
CASE	3	the function under test (dlsym, name only)	0	0	found=1
NOTE	next: GetDisplaySafeAreaInfo with an own 132 byte output buffer filled with 0xAA (assumed layout: a float ratio and 128 reserved bytes, from the AnyPS5 type), twice; assumed prototype (info*)
CASE	a.1	GetDisplaySafeAreaInfo(own 132 byte buffer, 0xAA fill): rc, bytes changed, first words	0	0	rc=0x00000000 errno=0 changed=4 last_changed=3 word0=0x3f800000 word1=0xaaaaaaaa word2=0xaaaaaaaa word3=0xaaaaaaaa float0=1 canaries_intact=1 signal=0
CASE	a.2	the same call again (stable?)	0	0	rc=0x00000000 errno=0 changed=4 last_changed=3 word0=0x3f800000 word1=0xaaaaaaaa word2=0xaaaaaaaa word3=0xaaaaaaaa float0=1 canaries_intact=1 signal=0
NOTE	next: pointer cases, one call each, last, in this order; a fault ends the calls (hello2 after)
CASE	z.1	GetDisplaySafeAreaInfo(output pointer 0x10, unmapped)	-1	0	rc=0xffffffff errno=0 signal=11
NOTE	a fault ended the calls
END	8

AI-assisted (Claude Code).

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Display Safe Area Documentation

Layer / File(s) Summary
Document API observations
docs/dev/debt/changes/docs-libscesystemservice-displaysafearea-unmapped.md
Records that a valid 132-byte buffer returned 0 and had its first four bytes changed to float 1.0. Notes that an unmapped pointer caused a segmentation fault in one run, and describes returning SYSTEM_SERVICE_ERROR_PARAMETER for an unwritable output pointer as a host-safety fallback.

Suggested labels: docs

Suggested reviewers: marczx10, privacyonion

Change: Other

Merge Risk: Minimal · up to b4b2e

This change only adds documentation of observed behavior for a system service call. It does not alter runtime behavior, and no concrete merge-blocking risk was found.

Architecture risk: Low · up to b4b2e

The change affects 1 source area.

Changed areas: docs

Review details

Systems and components

  • observed — 1 changed file mapped to docs.

Before / after behavior

  • observed — Modified behavior in docs/dev/debt/changes/docs-libscesystemservice-displaysafearea-unmapped.md: Added documentation of observed sceSystemServiceGetDisplaySafeAreaInfo behavior, including the valid-buffer result, the unmapped-pointer fault, and the host-safety fallback description.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 75ea2146-291e-4bea-a06e-719727f12d60
Commits

Reviewing files that changed from the base of the PR and between 61426d5 and b4b2ee4.

Files selected for processing: 1

  • docs/dev/debt/changes/docs-libscesystemservice-displaysafearea-unmapped.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The documentation change accurately records the single-run firmware 11.60 observations and clearly states the limits of the probe; I found no blocking issue in the changed fragment.

What I ran

Reviewed head b4b2ee4482f4552c5540a65cd3372d723184dd2f. No commands or tests were run; the review bundle reports that no test was added or run. I read description.md, commits.md, manifest.json, diff.patch, the complete changed fragment, and the existing debt entry it replaces. The changed file is the only file listed in the manifest as reviewed; no exclusions were provided in the bundle.

Results

Check Result Note
Changed fragment passed Matches the stated observations and limitations
Repository checks not run Description reports author-run checks
Probe not run Hardware observation supplied by author

Findings

Blocking

None.

Non-blocking

None.

Not verified

The PS5 probe and reported firmware behavior were not independently verified. No tests or repository checks were run during this review. files.json was unavailable, so exclusions beyond the manifest could not be confirmed.

To get this to a good state

Nothing is required.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fragment folded into the intended safe-area output entry, and the linked host wrapper checks the output through the guest copy routine. The firmware 11.60 results, including the four bytes changed in the valid buffer and the fault in the unmapped case, are the author’s console measurements.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit 240fe8e into boykopovar:main Dec 6, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants