Skip to content

docs(debt): record the development mode and GetKqueueFromEqueue results on firmware 11.60 - #22821

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs/libkernel-sys-devmode-kq-console-1160
Nov 18, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs/libkernel-sys-devmode-kq-console-1160

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

What

The __sys_is_development_mode entry in docs/dev/debt/libkernel_sys.md says that AnyPS5 fixes development mode to disabled (0) and that "console return values and nonzero mode bits are unmeasured"; the sceKernelGetKqueueFromEqueue entry says that an unwritable kq returns EINVAL here as a host-safety fallback and that "console behaviour on unmapped memory is unmeasured". A probe has now called both in libkernel.sprx from a payload process on firmware 11.60. The pull request replaces those two sentences through a debt fragment, as the contribution rules ask; no code changes. The probe also measured __sys_namedobj_create and __sys_namedobj_delete; those results are in a separate pull request.

__sys_is_development_mode returned 0 in 100 calls and also 0 when called once with three bogus register arguments (case 1, line 4). sceKernelGetKqueueFromEqueue on an equeue made with sceKernelCreateEqueue returned 0 and a descriptor that is valid for fstat and the same on a second call (cases 4.1 and 4.2, lines 20 and 21); with a null kq it returned 0x80020016 (SCE_KERNEL_ERROR_EINVAL) with errno untouched and no fault (5.1, line 22); with the pointer 0x1 the process raised SIGSEGV (5.2, line 23), and the probe stopped its pointer cases there by design (line 24).

AnyPS5 agrees on the first two: __sys_is_development_mode returns 0 (libkernel_sys/AdditionalExports.cpp, lines 102 to 104, test GuestKernelSysDevelopmentMode, lines 20 to 22), and sceKernelGetKqueueFromEqueue returns SCE_KERNEL_ERROR_EINVAL for a null kq (libkernel_sys/Export.Discovery.cpp, line 924; test GuestKernelSys, line 1109). It differs on an unwritable pointer: the console faults with SIGSEGV, and AnyPS5 returns EINVAL and keeps errno (lines 925 to 929; test lines 1111 and 1112). That difference stays: the entry already calls it a host-safety fallback, and a fault would be the emulation of a crash. This pull request records it and changes no behaviour. The emulator itself was not run for this pull request.

Not measured: nonzero development mode bits (the payload ran with mode 0), which descriptor number the console returns for kq (only that it is valid and stable), the eq pointer cases and a stale equeue (not run after the first fault), and a title process.

Tested

Measured on a PS5 with firmware 11.60 (kernel_get_fw_version 0x11600005), from a homebrew payload process (ps5-payload-sdk v0.45, elfldr) that loads libkernel.sprx and takes the functions with dlsym (line 3 shows all six it uses were found), on 2026-11-18 at 07:06 UTC. A title process may differ. The cases for these two functions are 1, 4.1 to 5.2 (lines 4 and 20 to 24); the others in the raw output concern __sys_namedobj_create and __sys_namedobj_delete and are not used here.

Call PS5 payload process, firmware 11.60 AnyPS5 main (code read, not run) in the entry
__sys_is_development_mode() x100, and with bogus arguments 0 each time (line 4) 0 now stated
sceKernelGetKqueueFromEqueue(eq, &kq) twice 0, valid descriptor, the same twice (lines 20, 21) 0 (test line 1106) now stated
kq null 0x80020016, errno untouched (line 22) 0x80020016 now stated
kq 0x1 SIGSEGV (line 23) 0x80020016, errno kept now stated (differs)

tools/check_conventions.py --base upstream/main passes with no error and no warning (the two entries are now 901 and 465 characters, up from 815 and 359). This is a documentation change, so no test was added or run, and no GPU test applies. Not tested: the emulator against these calls, a title process, other firmware, and the cases listed above as not measured.

Overlap: the other open pull requests that change the file of this branch (the fragment docs/dev/debt/changes/docs-libkernel-sys-devmode-kq-console-1160.md, a new file), core/libs/prx/libkernel_sys/AdditionalExports.cpp, core/libs/prx/libkernel_sys/Export.Discovery.cpp or core/libs/tests/GuestKernelSys.cpp, which the entries and the text name, or the two debt entries __sys_is_development_mode and sceKernelGetKqueueFromEqueue, found by reading the changed files of all 1754 open pull requests at about 10:03 to 10:19 UTC, by reading what they change in docs/dev/debt/libkernel_sys.md and the fragments under docs/dev/debt/changes/ for __sys_is_development_mode and sceKernelGetKqueueFromEqueue, and by searching their titles and branch names for the same names (one hit, #21989), were checked on 2026-11-18 at about 10:33 UTC against main cb8ce41f775 together with this head; the branch is based on f8c535ab8c6, an ancestor of it, merges into main without a conflict, and tools/debt_fold.py --check applies the changed fragment together with every other fragment on main without an error. Twenty-five pull requests list one of the code files or libkernel_sys.md, most of them for other functions or entries; as this branch adds only a fragment, none of them conflicts only with this change. #21989 moves the body of __sys_is_development_mode into GuestIsDevelopmentMode_nid_no_patch in AdditionalExports.cpp (the line numbers cited here would change, not the value 0) and has a fragment for the libkernel_web entries; #21726 (refuse a stale equeue handle) has a fragment that changes the libkernel entry of sceKernelCreateEqueue and sceKernelGetKqueueFromEqueue, not the libkernel_sys entry of this branch; #15037 carries the __sys_is_development_mode entry as an unchanged context line. None of them changes a line of the two entries of this branch. The merged result was not built or run; this is a documentation change.

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
  • 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 (documentation only)
  • AI-assisted: yes

…ts on firmware 11.60

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

xXPBSXx commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Probe source (built with ps5-payload-sdk v0.45; PROBE_BUILD is the first 12 hex digits of the source's SHA-256, c1822e113ded) and its raw output from the run on 2026-11-18 at 07:06 UTC. The clock in the PROBE line is the console's own clock. The probe loads libkernel.sprx, takes __sys_namedobj_create, __sys_namedobj_delete, __sys_is_development_mode, sceKernelGetKqueueFromEqueue and two equeue functions with dlsym; it calls __sys_is_development_mode 100 times and once with three bogus register arguments, makes an equeue with sceKernelCreateEqueue, asks for its kqueue descriptor twice, and then calls sceKernelGetKqueueFromEqueue with a null kq and with the pointer 0x1, the latter last because it can fault. The named object cases in the output (__sys_namedobj_create and __sys_namedobj_delete) belong to another pull request. Every call is guarded against signals and by a self limit. An internal probe number in the header comment was removed; the code is unchanged, and the build ID is the hash of the original file.

probe.c
/* __sys_namedobj_create, __sys_namedobj_delete, __sys_is_development_mode and sceKernelGetKqueueFromEqueue, payload process, firmware 11.60 (debt
   libkernel_sys.md entries: __sys_namedobj_create is not measured on a console, it fails with EAGAIN once ids 1 to 65535 are live, released ids are reused
   lowest first (RPCSX), the name fails with EINVAL when null, ENAMETOOLONG from 32 characters and EFAULT when unreadable; __sys_namedobj_delete: deleting a
   live id with another type than it was created with throws in AnyPS5 (fpPS4 answers ESRCH, RPCSX deletes it), both compare the low 16 bits of the type and
   answer ESRCH for an id that is not live; __sys_is_development_mode fixes development mode to disabled (0), console return values and nonzero mode bits
   unmeasured; sceKernelGetKqueueFromEqueue writes the descriptor with GuestCopyOut, an unwritable kq returns EINVAL like a null one, console behaviour on
   unmapped memory unmeasured). Prototypes from the repo: int __sys_namedobj_create(const char* name, void* object, uint32_t type) returning an id above
   0 or -1 with errno, int __sys_namedobj_delete(uint32_t id, uint32_t type), uint64_t __sys_is_development_mode(void), int
   sceKernelGetKqueueFromEqueue(void* eq, int* kq), sceKernelCreateEqueue(void** eq, const char* name), sceKernelDeleteEqueue(void* eq). The names are looked up with
   dlsym in libkernel.sprx, then in the global scope; a missing export is the result for its cases. The 65535 limit is NOT measured and no sweep of many ids is
   made: at most 6 ids are made. __sys_is_development_mode is called 100 times (are all results equal, the result as hex) and once with three bogus register
   arguments through a differently typed pointer. Namedobj cases: create "n2_17_a" and "n2_17_b" with type 1 (the ids, whether the second is the first plus one), delete
   the first, create "n2_17_c" (is the lowest id reused), delete the second with the type 2 (return code and errno, whether it was deleted: a following delete with type 1
   answers), delete of id 0, 0x7fffffff and a never used id, the type compare of the low 16 bits (create with type 1, delete with type 0x10001), the name empty, of 31, 32
   and 255 characters (return code and errno), then single guarded calls with the name NULL and 0x1. Every id made is deleted at the end. Equeue cases:
   sceKernelCreateEqueue, sceKernelGetKqueueFromEqueue twice (the descriptor valid by fstat and fcntl F_GETFD, the same twice), the kq pointer NULL and 0x1, the eq pointer NULL and 0x1, and a
   stale equeue after sceKernelDeleteEqueue; the pointer cases last, single calls, only while the previous one did not fault. 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. Nothing is written to a file, nothing is sent. */
#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 <fcntl.h>
#include <setjmp.h>
#include <sys/stat.h>

typedef int (*fn_create)(const char*, void*, unsigned);
typedef int (*fn_delete)(unsigned, unsigned);
typedef unsigned long long (*fn_dev)(void);
typedef long (*fn_dev3)(long, long, long);
typedef int (*fn_getkq)(void*, int*);
typedef int (*fn_ceq)(void**, const char*);
typedef int (*fn_deq)(void*);

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\tguard\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 ids[8], idt[8], nid = 0;

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();
  char extra[260], id[16], label[100];

  errno = 0;
  void* lk = dlopen("libkernel.sprx", RTLD_LAZY);
  probe_case("0", "load libkernel.sprx", lk ? 0 : -1, errno, lk ? "loaded" : dlerror());
  if (!lk) { probe_end(); return 0; }
  fn_create f_cr = (fn_create)(dlsym(lk, "__sys_namedobj_create") ? dlsym(lk, "__sys_namedobj_create") : dlsym(RTLD_DEFAULT, "__sys_namedobj_create"));
  fn_delete f_del = (fn_delete)(dlsym(lk, "__sys_namedobj_delete") ? dlsym(lk, "__sys_namedobj_delete") : dlsym(RTLD_DEFAULT, "__sys_namedobj_delete"));
  fn_dev f_dev = (fn_dev)(dlsym(lk, "__sys_is_development_mode") ? dlsym(lk, "__sys_is_development_mode") : dlsym(RTLD_DEFAULT, "__sys_is_development_mode"));
  fn_getkq f_kq = (fn_getkq)(dlsym(lk, "sceKernelGetKqueueFromEqueue") ? dlsym(lk, "sceKernelGetKqueueFromEqueue") : dlsym(RTLD_DEFAULT, "sceKernelGetKqueueFromEqueue"));
  fn_ceq f_ceq = (fn_ceq)(dlsym(lk, "sceKernelCreateEqueue") ? dlsym(lk, "sceKernelCreateEqueue") : dlsym(RTLD_DEFAULT, "sceKernelCreateEqueue"));
  fn_deq f_deq = (fn_deq)(dlsym(lk, "sceKernelDeleteEqueue") ? dlsym(lk, "sceKernelDeleteEqueue") : dlsym(RTLD_DEFAULT, "sceKernelDeleteEqueue"));
  snprintf(extra, sizeof extra, "namedobj_create=%d namedobj_delete=%d is_development_mode=%d GetKqueueFromEqueue=%d CreateEqueue=%d DeleteEqueue=%d", f_cr != 0, f_del != 0,
           f_dev != 0, f_kq != 0, f_ceq != 0, f_deq != 0);
  probe_case("0b", "dlsym of the functions", 0, 0, extra);

  /* b) development mode */
  if (f_dev) {
    unsigned long long first = f_dev();
    int same = 1;
    for (int i = 0; i < 99; ++i) if (f_dev() != first) same = 0;
    fn_dev3 d3 = (fn_dev3)f_dev;
    long bogus = d3(1, 2, 3);
    snprintf(extra, sizeof extra, "value=0x%llx all_100_equal=%d with_bogus_arguments_equal=%d", first, same, (unsigned long long)bogus == first);
    probe_case("1", "__sys_is_development_mode() x100 and with three bogus arguments", 0, 0, extra);
  }

  /* c) namedobj */
  if (f_cr && f_del) {
    int a, b, c, r, e;
    errno = 0;
    a = f_cr("n2_17_a", 0, 1);
    e = errno;
    if (a > 0) { ids[nid] = a; idt[nid++] = 1; }
    snprintf(extra, sizeof extra, "id=%d errno=%d", a, a > 0 ? 0 : e);
    probe_case("2.1", "__sys_namedobj_create(\"n2_17_a\", NULL, 1)", a, e, extra);
    errno = 0;
    b = f_cr("n2_17_b", 0, 1);
    e = errno;
    if (b > 0) { ids[nid] = b; idt[nid++] = 1; }
    snprintf(extra, sizeof extra, "id=%d errno=%d second_is_first_plus_1=%d", b, b > 0 ? 0 : e, b == a + 1);
    probe_case("2.2", "__sys_namedobj_create(\"n2_17_b\", NULL, 1)", b, e, extra);
    errno = 0;
    r = f_del(a, 1);
    e = errno;
    if (r == 0) for (int i = 0; i < nid; ++i) if (ids[i] == a) ids[i] = 0;
    snprintf(extra, sizeof extra, "rc=%d errno=%d", r, e);
    probe_case("2.3", "__sys_namedobj_delete(first id, 1)", r, e, extra);
    errno = 0;
    c = f_cr("n2_17_c", 0, 1);
    e = errno;
    if (c > 0) { ids[nid] = c; idt[nid++] = 1; }
    snprintf(extra, sizeof extra, "id=%d errno=%d reused_lowest_id=%d", c, c > 0 ? 0 : e, c == a);
    probe_case("2.4", "__sys_namedobj_create(\"n2_17_c\", NULL, 1) after deleting the first", c, e, extra);
    errno = 0;
    r = f_del(b, 2);
    e = errno;
    snprintf(extra, sizeof extra, "rc=%d errno=%d", r, e);
    probe_case("2.5", "__sys_namedobj_delete(second id, type 2) wrong type", r, e, extra);
    errno = 0;
    int r2 = f_del(b, 1);
    int e2 = errno;
    if (r2 == 0) for (int i = 0; i < nid; ++i) if (ids[i] == b) ids[i] = 0;
    snprintf(extra, sizeof extra, "rc=%d errno=%d (rc 0 means the wrong-type delete before did not remove it)", r2, e2);
    probe_case("2.6", "__sys_namedobj_delete(second id, type 1) afterwards", r2, e2, extra);
    errno = 0;
    r = f_del(b, 1);
    snprintf(extra, sizeof extra, "rc=%d errno=%d", r, errno);
    probe_case("2.7", "__sys_namedobj_delete(second id, 1) again", r, errno, extra);
    unsigned dids[3] = {0, 0x7fffffff, 60000};
    for (int i = 0; i < 3; ++i) {
      errno = 0;
      r = f_del(dids[i], 1);
      snprintf(id, sizeof id, "2.%d", 8 + i);
      snprintf(label, sizeof label, "__sys_namedobj_delete(id %u, 1)", dids[i]);
      snprintf(extra, sizeof extra, "rc=%d errno=%d", r, errno);
      probe_case(id, label, r, errno, extra);
    }
    errno = 0;
    int t = f_cr("n2_17_t", 0, 1);
    e = errno;
    if (t > 0) { ids[nid] = t; idt[nid++] = 1; }
    errno = 0;
    r = t > 0 ? f_del(t, 0x10001) : -1;
    e = errno;
    if (r == 0) for (int i = 0; i < nid; ++i) if (ids[i] == t) ids[i] = 0;
    snprintf(extra, sizeof extra, "create_id=%d delete_rc=%d errno=%d (rc 0: the low 16 bits of the type are compared)", t, r, e);
    probe_case("2.11", "create with type 1, delete with type 0x10001", r, e, extra);

    /* d) names */
    char nm[260];
    int ln[4] = {0, 31, 32, 255};
    for (int i = 0; i < 4; ++i) {
      memset(nm, 'n', sizeof nm);
      nm[ln[i]] = 0;
      errno = 0;
      int x = f_cr(nm, 0, 1);
      e = errno;
      if (x > 0) { ids[nid] = x; idt[nid++] = 1; }
      snprintf(id, sizeof id, "3.%d", i + 1);
      snprintf(label, sizeof label, "__sys_namedobj_create(name of %d characters, NULL, 1)", ln[i]);
      snprintf(extra, sizeof extra, "id=%d errno=%d", x, x > 0 ? 0 : e);
      probe_case(id, label, x, e, extra);
    }
  }

  /* e) equeue */
  void* eq = 0;
  int have_eq = 0;
  if (f_ceq && f_kq) {
    errno = 0;
    int r = f_ceq(&eq, "n2_17");
    have_eq = r == 0 && eq != 0;
    snprintf(extra, sizeof extra, "rc=0x%08x equeue_made=%d", (unsigned)r, have_eq);
    probe_case("4.1", "sceKernelCreateEqueue", r, errno, extra);
  }
  if (have_eq) {
    int k1 = -12345, k2 = -12345;
    errno = 0;
    int r = f_kq(eq, &k1);
    int e = errno;
    int r2 = f_kq(eq, &k2);
    struct stat st;
    int fs = k1 >= 0 ? fstat(k1, &st) : -1;
    int fl = k1 >= 0 ? fcntl(k1, F_GETFD) : -1;
    snprintf(extra, sizeof extra, "rc=0x%08x errno=%d kq_ge_0=%d second_rc=0x%08x same_descriptor_twice=%d fstat_rc=%d F_GETFD=%d", (unsigned)r, e, k1 >= 0, (unsigned)r2, k1 == k2, fs, fl);
    probe_case("4.2", "sceKernelGetKqueueFromEqueue(eq, &kq) twice", r, e, extra);
  }
  if (f_kq) {
    struct { const char* tag; int kind; } pc[] = {{"kq NULL", 0}, {"kq 0x1", 1}, {"eq NULL", 2}, {"eq 0x1", 3}, {"stale eq after sceKernelDeleteEqueue", 4}};
    int stopped = 0;
    for (int i = 0; i < 5 && !stopped; ++i) {
      if (pc[i].kind == 0 || pc[i].kind == 1) { if (!have_eq) continue; }
      if (pc[i].kind == 4) {
        if (!have_eq || !f_deq) continue;
        f_deq(eq);
        have_eq = 0;
      }
      int k = -12345;
      guard_sig = 0;
      int r = -1, e = 0;
      if (sigsetjmp(guard_env, 1) == 0) {
        guard_active = 1;
        errno = 0;
        switch (pc[i].kind) {
          case 0: r = f_kq(eq, 0); break;
          case 1: r = f_kq(eq, (int*)0x1); break;
          case 2: r = f_kq(0, &k); break;
          case 3: r = f_kq((void*)0x1, &k); break;
          default: r = f_kq(eq, &k); break;
        }
        e = errno;
        guard_active = 0;
      } else {
        stopped = 1;
      }
      snprintf(id, sizeof id, "5.%d", i + 1);
      snprintf(label, sizeof label, "sceKernelGetKqueueFromEqueue(%s)", pc[i].tag);
      snprintf(extra, sizeof extra, "rc=0x%08x errno=%d fault_signal=%d", (unsigned)r, e, (int)guard_sig);
      probe_case(id, label, r, e, extra);
    }
    if (stopped) probe_case("5.9", "pointer cases stopped after the first fault", 0, 0, "remaining pointer cases skipped by design");
  }
  if (have_eq && f_deq) f_deq(eq);

  /* names NULL and 0x1, single guarded calls, last */
  if (f_cr) {
    int stopped = 0;
    const char* tn[2] = {"NULL", "0x1"};
    for (int i = 0; i < 2 && !stopped; ++i) {
      guard_sig = 0;
      int r = -1, e = 0;
      if (sigsetjmp(guard_env, 1) == 0) {
        guard_active = 1;
        errno = 0;
        r = f_cr(i == 0 ? (const char*)0 : (const char*)0x1, 0, 1);
        e = errno;
        guard_active = 0;
        if (r > 0) { ids[nid] = r; idt[nid++] = 1; }
      } else {
        stopped = 1;
      }
      snprintf(id, sizeof id, "6.%d", i + 1);
      snprintf(label, sizeof label, "__sys_namedobj_create(name %s, NULL, 1)", tn[i]);
      snprintf(extra, sizeof extra, "rc=%d errno=%d fault_signal=%d", r, e, (int)guard_sig);
      probe_case(id, label, r, e, extra);
    }
  }

  /* cleanup */
  if (f_del) {
    int removed = 0, tried = 0;
    for (int i = 0; i < nid; ++i) {
      if (ids[i] <= 0) continue;
      tried++;
      if (f_del((unsigned)ids[i], (unsigned)idt[i]) == 0) removed++;
    }
    snprintf(extra, sizeof extra, "ids_still_live_to_remove=%d removed=%d", tried, removed);
    probe_case("9", "cleanup: __sys_namedobj_delete of every id still live", removed == tried ? 0 : -1, 0, extra);
  }

  probe_end();
  return 0;
}
stdout
PROBE	namedobj_devmode_kq	fw=0x11600005	build=c1822e113ded	pid=286	utc=2026-11-18T08:48:05Z
CASE	0	load libkernel.sprx	0	2	loaded
CASE	0b	dlsym of the functions	0	0	namedobj_create=1 namedobj_delete=1 is_development_mode=1 GetKqueueFromEqueue=1 CreateEqueue=1 DeleteEqueue=1
CASE	1	__sys_is_development_mode() x100 and with three bogus arguments	0	0	value=0x0 all_100_equal=1 with_bogus_arguments_equal=1
CASE	2.1	__sys_namedobj_create("n2_17_a", NULL, 1)	32	0	id=32 errno=0
CASE	2.2	__sys_namedobj_create("n2_17_b", NULL, 1)	33	0	id=33 errno=0 second_is_first_plus_1=1
CASE	2.3	__sys_namedobj_delete(first id, 1)	0	0	rc=0 errno=0
CASE	2.4	__sys_namedobj_create("n2_17_c", NULL, 1) after deleting the first	8224	0	id=8224 errno=0 reused_lowest_id=0
CASE	2.5	__sys_namedobj_delete(second id, type 2) wrong type	-1	3	rc=-1 errno=3
CASE	2.6	__sys_namedobj_delete(second id, type 1) afterwards	0	0	rc=0 errno=0 (rc 0 means the wrong-type delete before did not remove it)
CASE	2.7	__sys_namedobj_delete(second id, 1) again	-1	3	rc=-1 errno=3
CASE	2.8	__sys_namedobj_delete(id 0, 1)	-1	3	rc=-1 errno=3
CASE	2.9	__sys_namedobj_delete(id 2147483647, 1)	-1	3	rc=-1 errno=3
CASE	2.10	__sys_namedobj_delete(id 60000, 1)	-1	3	rc=-1 errno=3
CASE	2.11	create with type 1, delete with type 0x10001	0	0	create_id=8225 delete_rc=0 errno=0 (rc 0: the low 16 bits of the type are compared)
CASE	3.1	__sys_namedobj_create(name of 0 characters, NULL, 1)	16417	0	id=16417 errno=0
CASE	3.2	__sys_namedobj_create(name of 31 characters, NULL, 1)	34	0	id=34 errno=0
CASE	3.3	__sys_namedobj_create(name of 32 characters, NULL, 1)	-1	63	id=-1 errno=63
CASE	3.4	__sys_namedobj_create(name of 255 characters, NULL, 1)	-1	63	id=-1 errno=63
CASE	4.1	sceKernelCreateEqueue	0	0	rc=0x00000000 equeue_made=1
CASE	4.2	sceKernelGetKqueueFromEqueue(eq, &kq) twice	0	0	rc=0x00000000 errno=0 kq_ge_0=1 second_rc=0x00000000 same_descriptor_twice=1 fstat_rc=0 F_GETFD=0
CASE	5.1	sceKernelGetKqueueFromEqueue(kq NULL)	-2147352554	0	rc=0x80020016 errno=0 fault_signal=0
CASE	5.2	sceKernelGetKqueueFromEqueue(kq 0x1)	-1	0	rc=0xffffffff errno=0 fault_signal=11
CASE	5.9	pointer cases stopped after the first fault	0	0	remaining pointer cases skipped by design
CASE	6.1	__sys_namedobj_create(name NULL, NULL, 1)	-1	22	rc=-1 errno=22 fault_signal=0
CASE	6.2	__sys_namedobj_create(name 0x1, NULL, 1)	-1	14	rc=-1 errno=14 fault_signal=0
CASE	9	cleanup: __sys_namedobj_delete of every id still live	0	0	ids_still_live_to_remove=3 removed=3
END	26

AI-assisted (Claude Code).

@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 fragment accurately records the stated firmware 11.60 observations and the existing host-safety behavior; the full changed file was read.

What I ran

Reviewed head 05a023a1196de28431e5f44e1497a9e71d07f094. Read the prepared description, commits, manifest, diff, README, the complete changed fragment, and the debt-fragment instructions in docs/dev/TechnicalDebt.md. No tests or commands were run.

Results

Check Result Note
Changed lines read passed All 9 added lines
Documentation claims not run Firmware observations supplied by author
Automated checks not run No checks run during this review

Findings

Blocking

None.

Non-blocking

None.

Not verified

The console measurements, emulator behavior, and claimed convention-check result were not independently verified. No other repository files were read; files.json was not available in the prepared folder listing. The only changed file is included in the manifest and was read in full.

To get this to a good state

Nothing is required.

@oneandonlydean
oneandonlydean merged commit 47bd2c6 into boykopovar:main Nov 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants