Skip to content

docs(debt): record that a PS5 does not check the key pointer of pthread_key_create - #27934

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs/pthread-key-create-console
Dec 6, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs/pthread-key-create-console

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What

The debt entry for pthread_key_create (docs/dev/debt/libkernel.md:435 on main ea49f32e8982), as the pending fragment docs/dev/debt/changes/fix-libkernel-pthread-key-create-guest-copy.md (added by #21577, merged on 2026-11-16) changes it, calls the EFAULT result for an unwritable key pointer a host-safety fallback with unmeasured console behaviour. A probe on a PS5 (firmware 11.60, payload process; a title process may differ) called pthread_key_create with a pointer to its own variable and a NULL destructor: it returned 0 (case 5.1, line 9 of the raw output in the first comment). The calls with a NULL key pointer (case 5.2, line 23), a pointer to a PROT_NONE page (case 5.3, line 24) and a pointer to an unmapped page (case 5.4, line 25) each ended in a fault: the probe's handler, installed for SIGSEGV, SIGBUS and SIGABRT (probe.c:89 to :91), stored the signal number (probe.c:81) and each CASE line shows signal=11, a segmentation fault. The run was made once (END 24, line 26); the pointer cases ran last. So the console checked none of the three pointers. scePthreadKeyCreate was not in that run (it is not among the functions the probe looked up, line 2).

On main pthread_key_create returns EINVAL for a NULL key pointer (core/libs/prx/libkernel/Pthread/Posix/Tsd.cpp:19) and, when it cannot write the key it created, frees that key and returns EFAULT (:22 to :25); scePthreadKeyCreate throws for a NULL key (core/libs/prx/libkernel/Pthread/src/Tsd.cpp:92). Both results are host-side checks and not what the console does.

This pull request changes the one entry in the existing fragment (1 line added and 1 removed, no new file): the entry grows from 610 to 946 characters with its list marker. It keeps the account of the EFAULT and the freed key, replaces This is a host-safety fallback with unmeasured console behaviour. by the measurement (a writable pointer returned 0; a NULL pointer, a pointer to a PROT_NONE page and a pointer to an unmapped page each took SIGSEGV, in one run), says that the EFAULT here is a host-safety result and not the console's, and that the EINVAL for a NULL key pointer is a host-safety result too, and adds that scePthreadKeyCreate was not run there. No code changes.

Not measured: scePthreadKeyCreate, a read-only key pointer, a title process, other firmware.

Tested

Measured on a PS5 with firmware 11.60 from a homebrew payload process, one run at about 04:24 UTC on 2026-11-09 (probe build d4c9e3099d50, END 24). This is a documentation change; no test was added or run.

On the head merged into main at ea49f32 (2026-11-27 20:14 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 changes one line of an existing fragment (mode 100644).

Overlap: counted on 2026-11-27 from the 2088 open pull requests (file lists from the GitHub API, the pull requests 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 1268 pull requests that change a file under docs/dev/debt/, Tsd.cpp, Strings.cpp or Math.cpp, or have pthread, key, div or tsd in the title or branch name, were searched for pthread_key_create, scePthreadKeyCreate, PthreadKeyCreate, ldiv, lldiv, imaxdiv, INT_MIN, INT64_MIN and the two fragment names, from 18:16 to 19:57 UTC). No open pull request changes the fragment docs/dev/debt/changes/fix-libkernel-pthread-key-create-guest-copy.md or the entry for pthread_key_create at docs/dev/debt/libkernel.md:435, and no commit on main since 13bf980d9659 (the base of this branch; 124 commits, up to ea49f32e8982) changed the fragment, the two entries at libkernel.md:435 and libc.md:431, core/libs/prx/libkernel/Pthread/Posix/Tsd.cpp, core/libs/prx/libc/src/Strings.cpp or core/libs/prx/libc/src/Math.cpp; the fragment is still pending (the entry in libkernel.md has the text from before #21577). A search of the open pull requests for pthread_key_create finds #18190 and #18112 (feat(libs): mirror libkernel exports through libkernel_sys and ... libkernel_web), and for scePthreadKeyCreate none: #18190 moves pthread_key_create_nid_postfix out of Tsd.cpp into provider files and changes only docs/dev/debt/libkernel_sys.md among the debt files, #18112 changes libkernel_web.md; neither changes the entry :435 or the fragment (the entry's link to Tsd.cpp stays as it is until that pull request merges). One more patch names scePthreadKeyCreate: #9938 (fix(libkernel): honor caller-provided pthread stacks, a test call, and other entries of libkernel.md). The merges of this head with each of the 96 pull requests that change libc.md, libkernel.md, Math.cpp, Strings.cpp or Tsd.cpp or have a searched name, or have 100 or more files or an old base, were made with git merge-tree from 18:16 to 19:57 UTC (main at 9f12ec0e3840 at the start): 57 are clean; the other 39 (among them #18190 in 2 files and #9938 in 3 files) 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 613 pull requests that were opened or updated since 18:16 UTC (of the 2083 open pull requests, listed from 19:58 to 20:12 UTC; 394 of them were patch-scanned for the same names): no new hit beyond the ones named, and the 8 that change a searched file merge cleanly with this head. A merge of this head into main at ea49f32 was checked the same way at 19:59 UTC and is clean, and it merges with the second head of this series (docs-libc-div-int-min-console-1160.md, a new file of its own) 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 PS5 firmware 11.60 observations for pthread_key_create, including results for writable and invalid key pointers. Clarified that host-safety error results are not confirmed console behavior and that results may vary by process.

…ad_key_create

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 04:24 UTC on 2026-11-09. The probe calls, among others, pthread_key_create with a pointer to its own variable, and then, last, with a NULL pointer, a pointer to its own page set to PROT_NONE and a pointer to its own page that was mapped and unmapped again; the pointer cases run last because a fault inside a pthread call may leave an internal lock taken. Every call is under a fault guard that reports the signal. The other cases of the same run (sceKernelMmap, pthread_getcpuclockid, pthread_mutex_init and pthread_mutex_destroy) are not part of this pull request. The utc in the PROBE line is the console's own clock, about 1 h 42 min ahead of real UTC. 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 reported with signal= and the number of the signal that the probe's handler caught. The source is posted verbatim except that an internal label at the start of its first comment was removed; the code is unchanged, and the build ID is the hash of the original file.

Run: probe.c (build d4c9e3099d50)
#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: 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);
}

/* Watchdog thread: alarm()/SIGALRM does not help when the main thread cannot be scheduled (a CPU mask without a usable
   core) or hangs in a blocking call. The thread is created before any mask is changed, 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);
  _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);
}

/* 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 <stdarg.h>
#include <stdlib.h>

static sigjmp_buf guard_env;
static volatile int guard_sig = 0;
static void guard_handler(int s) {
  guard_sig = s;
  siglongjmp(guard_env, 1);
}

static void setup_guard(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 RUN(stmt)                         do {                                      errno = 0;                              guard_sig = 0;                          if (sigsetjmp(guard_env, 1) == 0) {       stmt;                                 }                                       e = errno;                            } while (0)

#define KB 1024UL
#define MB (1024UL * 1024UL)

/* One CASE line: the extra text is formatted here and always ends with the signal caught by the guard (0 = none). */
static void C(const char* id, const char* call, long r, int e, const char* fmt, ...) {
  char x[300];
  va_list ap;
  va_start(ap, fmt);
  vsnprintf(x, sizeof x - 24, fmt, ap);
  va_end(ap);
  size_t n = strlen(x);
  snprintf(x + n, sizeof x - n, " signal=%d", (int)guard_sig);
  probe_case(id, call, r, e, x);
}


/* what the console does when a call is given a pointer it cannot write or read, for the entries
   of libkernel.md that name host-safety EFAULT fallbacks with unmeasured console behaviour: sceKernelMmap (null or unwritable
   res), pthread_getcpuclockid (unwritable clock id), pthread_key_create (unwritable key), pthread_mutex_init and
   pthread_mutex_destroy (unreadable mutex or attribute pointer) and scePthreadMutexDestroy; plus __progname / getprogname.
   Unusable pointers are an own page set to PROT_NONE and an own page that was mapped and unmapped again. Reference calls with
   good pointers run first; the faulting cases run last (a fault inside a pthread call may leave an internal lock taken, so
   nothing that needs a pthread lock runs after them). Every call is under the fault guard (a fault is reported as signal=);
   the watchdog thread was started before any case. Prototypes: int sceKernelMmap(void*, size_t, int, int, int, long,
   void** res), int pthread_getcpuclockid(pthread_t, clockid_t*), int pthread_key_create(pthread_key_t*, void(*)(void*)),
   int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*), int pthread_mutex_destroy(pthread_mutex_t*). */

typedef int (*mmap_fn)(void*, size_t, int, int, int, long, void**);
typedef int (*unmap_fn)(void*, size_t);
typedef int (*cpuclk_fn)(void*, int*);
typedef int (*keyc_fn)(unsigned*, void (*)(void*));
typedef int (*keyd_fn)(unsigned);
typedef int (*mxinit_fn)(void*, const void*);
typedef int (*mxdest_fn)(void*);
typedef int (*mxattr_fn)(void*);
typedef int (*sce_mxinit_fn)(void*, const void*, const char*);
typedef void* (*self_fn)(void);
typedef const char* (*getprogname_fn)(void);
typedef long (*dmsize_fn)(void);
typedef int (*alloc_fn)(long, long, size_t, size_t, int, long*);
typedef int (*map_fn)(void**, size_t, int, int, long, size_t);
typedef int (*prot_fn)(void*, size_t, int);
typedef int (*rel_fn)(long, size_t);

int main(void) {
  signal(SIGALRM, probe_alarm);
  alarm(PROBE_MAX_S);
  probe_header();
  setup_guard();

  mmap_fn f_mmap = (mmap_fn)dlsym(RTLD_DEFAULT, "sceKernelMmap");
  unmap_fn f_unmap = (unmap_fn)dlsym(RTLD_DEFAULT, "sceKernelMunmap");
  cpuclk_fn f_cpuclk = (cpuclk_fn)dlsym(RTLD_DEFAULT, "pthread_getcpuclockid");
  keyc_fn f_keyc = (keyc_fn)dlsym(RTLD_DEFAULT, "pthread_key_create");
  keyd_fn f_keyd = (keyd_fn)dlsym(RTLD_DEFAULT, "pthread_key_delete");
  mxinit_fn f_mxi = (mxinit_fn)dlsym(RTLD_DEFAULT, "pthread_mutex_init");
  mxdest_fn f_mxd = (mxdest_fn)dlsym(RTLD_DEFAULT, "pthread_mutex_destroy");
  mxattr_fn f_mai = (mxattr_fn)dlsym(RTLD_DEFAULT, "pthread_mutexattr_init");
  mxdest_fn f_sce_mxd = (mxdest_fn)dlsym(RTLD_DEFAULT, "scePthreadMutexDestroy");
  self_fn f_self = (self_fn)dlsym(RTLD_DEFAULT, "scePthreadSelf");
  getprogname_fn f_gpn = (getprogname_fn)dlsym(RTLD_DEFAULT, "getprogname");
  void** pn = (void**)dlsym(RTLD_DEFAULT, "__progname");
  dmsize_fn f_size = (dmsize_fn)dlsym(RTLD_DEFAULT, "sceKernelGetDirectMemorySize");
  alloc_fn f_alloc = (alloc_fn)dlsym(RTLD_DEFAULT, "sceKernelAllocateDirectMemory");
  map_fn f_map = (map_fn)dlsym(RTLD_DEFAULT, "sceKernelMapDirectMemory");
  prot_fn f_prot = (prot_fn)dlsym(RTLD_DEFAULT, "sceKernelMprotect");
  rel_fn f_rel = (rel_fn)dlsym(RTLD_DEFAULT, "sceKernelReleaseDirectMemory");
  char line[240];
  snprintf(line, sizeof line, "mmap=%d munmap=%d cpuclockid=%d keycreate=%d keydelete=%d mutexinit=%d mutexdestroy=%d mutexattrinit=%d sce_mutexdestroy=%d self=%d getprogname=%d __progname=%d dmem=%d%d%d%d%d", !!f_mmap, !!f_unmap, !!f_cpuclk, !!f_keyc, !!f_keyd, !!f_mxi, !!f_mxd, !!f_mai, !!f_sce_mxd, !!f_self, !!f_gpn, !!pn, !!f_size, !!f_alloc, !!f_map, !!f_prot, !!f_rel);
  probe_case("0", "dlsym exported (1 yes, 0 no)", 0, 0, line);

  int r, e;
  char nm[64];
  if (pn || f_gpn) {
    const char* a = (pn && *pn) ? (const char*)*pn : "(null)";
    const char* g = f_gpn ? f_gpn() : "(none)";
    snprintf(nm, sizeof nm, "%.40s", a);
    char x[160];
    snprintf(x, sizeof x, "__progname=%s getprogname=%.40s equal=%d", nm, g, strcmp(a, g) == 0);
    probe_case("1.1", "__progname and getprogname() of this process", 0, 0, x);
  }

  /* own bad pointers: a PROT_NONE page and a hole, from one own 64 KiB direct-memory mapping */
  void* none = 0;
  void* hole = 0;
  long ph = -1;
  if (f_alloc && f_map && f_prot && f_unmap && f_rel) {
    long total = f_size ? f_size() : 0x100000000L;
    RUN(r = f_alloc(0, total, 1 * MB, 16 * KB, 3, &ph));
    if (r == 0 && ph != -1) {
      void* a = 0;
      RUN(r = f_map(&a, 64 * KB, 3, 0, ph, 0));
      if (a) {
        none = a;
        hole = (char*)a + 32 * KB;
        f_prot(none, 16 * KB, 0);
        f_unmap(hole, 16 * KB);
        probe_case("1.2", "own PROT_NONE page and own hole prepared", 0, 0, "ok");
      }
    }
  }

  /* references with good pointers */
  if (f_mmap && f_unmap) {
    void* res = 0;
    RUN(r = f_mmap(0, 64 * KB, 3, 0x1002, -1, 0, &res));
    char x[80];
    snprintf(x, sizeof x, "res_set=%d", res != 0);
    C("2.1", "sceKernelMmap(anon 64 KiB, prot 3, res = good pointer)", r, e, "%s", x);
    if (res) f_unmap(res, 64 * KB);
  }
  void* me = f_self ? f_self() : 0;
  if (f_cpuclk && me) {
    int clk = -77;
    RUN(r = f_cpuclk(me, &clk));
    C("3.1", "pthread_getcpuclockid(self, good pointer)", r, e, "clockid=%d", clk);
  }
  unsigned char mx[128];
  memset(mx, 0, sizeof mx);
  if (f_mxi && f_mxd) {
    RUN(r = f_mxi(mx, 0));
    C("4.1", "pthread_mutex_init(good mutex, NULL attr)", r, e, "-");
    RUN(r = f_mxd(mx));
    C("4.2", "pthread_mutex_destroy(good mutex)", r, e, "-");
  }
  unsigned key = 0;
  if (f_keyc) {
    RUN(r = f_keyc(&key, 0));
    C("5.1", "pthread_key_create(good pointer)", r, e, "key_set=%d", key != 0);
    if (r == 0 && f_keyd) f_keyd(key);
  }

  /* faulting cases last */
  if (f_mmap && f_unmap) {
    RUN(r = f_mmap(0, 64 * KB, 3, 0x1002, -1, 0, 0));
    C("2.2", "sceKernelMmap(anon 64 KiB, res = NULL)", r, e, "-");
    if (none) {
      RUN(r = f_mmap(0, 64 * KB, 3, 0x1002, -1, 0, (void**)none));
      C("2.3", "sceKernelMmap(anon 64 KiB, res = PROT_NONE page)", r, e, "-");
    }
    if (hole) {
      RUN(r = f_mmap(0, 64 * KB, 3, 0x1002, -1, 0, (void**)hole));
      C("2.4", "sceKernelMmap(anon 64 KiB, res = unmapped page)", r, e, "-");
    }
  }
  if (f_cpuclk && me) {
    RUN(r = f_cpuclk(me, 0));
    C("3.2", "pthread_getcpuclockid(self, NULL clock id)", r, e, "-");
    if (none) {
      RUN(r = f_cpuclk(me, (int*)none));
      C("3.3", "pthread_getcpuclockid(self, PROT_NONE page)", r, e, "-");
    }
    if (hole) {
      RUN(r = f_cpuclk(me, (int*)hole));
      C("3.4", "pthread_getcpuclockid(self, unmapped page)", r, e, "-");
    }
  }
  if (f_mxi && f_mxd && f_mai) {
    unsigned char at[64];
    memset(at, 0, sizeof at);
    f_mai(at);
    if (none) {
      RUN(r = f_mxi(mx, none));
      C("4.3", "pthread_mutex_init(good mutex, attribute = PROT_NONE page)", r, e, "-");
      RUN(r = f_mxi(none, 0));
      C("4.4", "pthread_mutex_init(mutex = PROT_NONE page, NULL attr)", r, e, "-");
      RUN(r = f_mxd(none));
      C("4.5", "pthread_mutex_destroy(PROT_NONE page)", r, e, "-");
    }
    if (hole) {
      RUN(r = f_mxi(mx, hole));
      C("4.6", "pthread_mutex_init(good mutex, attribute = unmapped page)", r, e, "-");
      RUN(r = f_mxi(hole, 0));
      C("4.7", "pthread_mutex_init(mutex = unmapped page, NULL attr)", r, e, "-");
      RUN(r = f_mxd(hole));
      C("4.8", "pthread_mutex_destroy(unmapped page)", r, e, "-");
    }
    if (f_sce_mxd && none) {
      RUN(r = f_sce_mxd(none));
      C("4.9", "scePthreadMutexDestroy(PROT_NONE page)", r, e, "-");
    }
  }
  if (f_keyc) {
    RUN(r = f_keyc(0, 0));
    C("5.2", "pthread_key_create(NULL pointer)", r, e, "-");
    if (none) {
      RUN(r = f_keyc((unsigned*)none, 0));
      C("5.3", "pthread_key_create(PROT_NONE page)", r, e, "-");
    }
    if (hole) {
      RUN(r = f_keyc((unsigned*)hole, 0));
      C("5.4", "pthread_key_create(unmapped page)", r, e, "-");
    }
  }
  if (ph != -1 && none) {
    if (f_prot) f_prot(none, 16 * KB, 3);
    f_unmap(none, 16 * KB);
    f_unmap((char*)none + 16 * KB, 16 * KB);
    f_rel(ph, 1 * MB);
  }
  probe_end();
  return 0;
}
Run: raw output (26 lines)
PROBE	neu2_ptr_validation	fw=0x11600005	build=d4c9e3099d50	pid=103	utc=2026-11-09T06:05:59Z
CASE	0	dlsym exported (1 yes, 0 no)	0	0	mmap=1 munmap=1 cpuclockid=1 keycreate=1 keydelete=1 mutexinit=1 mutexdestroy=1 mutexattrinit=1 sce_mutexdestroy=1 self=1 getprogname=1 __progname=1 dmem=11111
CASE	1.1	__progname and getprogname() of this process	0	0	__progname=payload.elf getprogname=payload.elf equal=1
CASE	1.2	own PROT_NONE page and own hole prepared	0	0	ok
CASE	2.1	sceKernelMmap(anon 64 KiB, prot 3, res = good pointer)	0	0	res_set=1 signal=0
CASE	3.1	pthread_getcpuclockid(self, good pointer)	0	0	clockid=14 signal=0
CASE	4.1	pthread_mutex_init(good mutex, NULL attr)	0	0	- signal=0
CASE	4.2	pthread_mutex_destroy(good mutex)	0	0	- signal=0
CASE	5.1	pthread_key_create(good pointer)	0	0	key_set=0 signal=0
CASE	2.2	sceKernelMmap(anon 64 KiB, res = NULL)	0	0	- signal=11
CASE	2.3	sceKernelMmap(anon 64 KiB, res = PROT_NONE page)	0	0	- signal=11
CASE	2.4	sceKernelMmap(anon 64 KiB, res = unmapped page)	0	0	- signal=11
CASE	3.2	pthread_getcpuclockid(self, NULL clock id)	0	0	- signal=11
CASE	3.3	pthread_getcpuclockid(self, PROT_NONE page)	0	0	- signal=11
CASE	3.4	pthread_getcpuclockid(self, unmapped page)	0	0	- signal=11
CASE	4.3	pthread_mutex_init(good mutex, attribute = PROT_NONE page)	0	0	- signal=11
CASE	4.4	pthread_mutex_init(mutex = PROT_NONE page, NULL attr)	0	0	- signal=11
CASE	4.5	pthread_mutex_destroy(PROT_NONE page)	0	0	- signal=11
CASE	4.6	pthread_mutex_init(good mutex, attribute = unmapped page)	0	0	- signal=11
CASE	4.7	pthread_mutex_init(mutex = unmapped page, NULL attr)	0	0	- signal=11
CASE	4.8	pthread_mutex_destroy(unmapped page)	0	0	- signal=11
CASE	4.9	scePthreadMutexDestroy(PROT_NONE page)	0	0	- signal=11
CASE	5.2	pthread_key_create(NULL pointer)	0	0	- signal=11
CASE	5.3	pthread_key_create(PROT_NONE page)	0	0	- signal=11
CASE	5.4	pthread_key_create(unmapped page)	0	0	- signal=11
END	24

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: pthread_key_create Documentation

Layer / File(s) Summary
Document console observations
docs/dev/debt/changes/fix-libkernel-pthread-key-create-guest-copy.md
The documentation records that writable pointers returned 0, while NULL, PROT_NONE, and unmapped pointers caused SIGSEGV in one payload-process run. It clarifies that EFAULT and EINVAL describe host-safety results, and that scePthreadKeyCreate was not tested on the console.

Suggested labels: docs

Suggested reviewers: milescoviello, marczx10, privacyonion

Change: Other

Merge Risk: Minimal · up to 48413

This documentation-only change records one PS5 probe run and separates console observations from host-side error handling. It does not change runtime behavior, so merge risk is minimal.

Architecture risk: Low · up to 48413

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/fix-libkernel-pthread-key-create-guest-copy.md: The documentation replaces the description of console behavior as unmeasured with PS5 firmware 11.60 payload-process observations: writable pointers returned 0, while NULL, PROT_NONE, and unmapped pointers caused SIGSEGV in one run. It qualifies the host-safety EFAULT and EINVAL results and notes that scePthreadKeyCreate was not tested on the console.
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: 33938328-bb2d-44f8-8772-0937d44851f9
Commits

Reviewing files that changed from the base of the PR and between 335fd46 and 4841367.

Files selected for processing: 1

  • docs/dev/debt/changes/fix-libkernel-pthread-key-create-guest-copy.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 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

Nothing blocks this documentation change; the points below are optional.

What I ran

Reviewed head 48413678fba28e403bdeaaa5bd49dbb46f45e09a. No commands or tests were run. I read description.md, commits.md, manifest.json, diff.patch, and the full changed file; I also searched the debt documentation for pthread_key_create.

Results

Check Result Note
Change review passed Wording matches the stated probe scope
Tests not run Documentation-only change

Findings

Blocking

None.

Non-blocking

None.

Not verified

The PS5 probe itself and the underlying implementations were not independently verified. The changed file was read; no files were excluded by manifest.json.

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.

debt_fold.py --check passes. The updated entry preserves the host EFAULT and key cleanup behavior while recording the console pointer cases and the firmware and process used for the measurements.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit 139226e 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