Skip to content

fix(libkernel): refuse the title workaround bits above 0x78 in IsEnabled and IsEnabled2 as the console does - #22365

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
xXPBSXx:fix/kernel-sys-title-workaround-bit-limit
Nov 17, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
xXPBSXx:fix/kernel-sys-title-workaround-bit-limit

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What

sceKernelTitleWorkaroundIsEnabled and sceKernelTitleWorkaroundIsEnabled2 in libkernel_sys/Export.cpp accepted the bits 0 to 0x7F of the 128-bit workaround block and returned 0x80020016 (EINVAL) above that, following a reading of the firmware 13.42 disassembly. A PS5 payload process on firmware 11.60 called both console functions (libkernel.sprx) for every bit from 0 to 127 on a block of zeros and on a block of ones. IsEnabled: in both sweeps 121 bits were accepted (return 0), the first refused bit was 121 (0x79) and the refused range was 121 to 127 (cases 1 and 2, lines 4 and 5 of the first raw output). IsEnabled2 with the selectors 0 and 0x28: the same in all four sweeps, 121 bits accepted and 121 to 127 refused (cases 1.0 to 2.1, lines 4 to 7 of the second raw output). On the blocks of ones every accepted bit returned 1, on the blocks of zeros none did, and no value other than 0 or 1 was returned (odd_values=0). The probes count a bit as refused when the return value is not 0 and do not print the code; an earlier probe of IsEnabled had seen 0x80020016 (EINVAL) for the bit 127, with the output unchanged. Both functions now refuse the bits above 0x78 with 0x80020016 (EINVAL, the code seen for the bit 127) and leave the output unchanged; the misspelled export sceKernelTitleWorkdaroundIsEnabled calls IsEnabled and follows the new limit.

In the code, a shared helper QueryTitleWorkaround holds the old logic (a null workaround or output returns 0x8002000E first, a bit above 0x78 returns 0x80020016, and the host-safety fallback for unreadable memory), IsEnabled calls it, and IsEnabled2 keeps its own check of the selector (0x29 or more returns 0x80020016, as the 13.42 reading says and as an earlier probe measured for 0x29 and the largest value) and then calls it.

The entries in docs/dev/debt/libkernel_sys.md said that the layout, the bit test and the limit follow a firmware 13.42 reading and are not measured on a console. The fragment adds what 11.60 did for both functions and keeps the 13.42 reading named; it does not call the reading wrong, since a different firmware or a misreading could explain the difference. For IsEnabled2 it also says that the error code was not printed, so EINVAL there follows the 13.42 reading.

The test commit extends the workaround block of CheckProcessQueries in GuestKernelSys.cpp by the bit 120 and checks, for both spellings of IsEnabled and for IsEnabled2 with the selectors 0 and 0x28, that bit 0x77 reads 0, bit 0x78 reads 1, and the bits 0x79, 0x7E and 0x7F return 0x80020016 with the output unchanged. The old checks that accepted 0x7E and 0x7F are replaced.

Not measured on the console: the code returned for the refused bits of IsEnabled2 and for 0x79 to 0x7E of IsEnabled, the misspelled export sceKernelTitleWorkdaroundIsEnabled on 11.60 (the entry says it runs the same code, from the 13.42 reading), selectors other than 0 and 0x28 with high bits, a title process, and which workaround bits a title tests. No title is shown to call either function with a bit between 0x79 and 0x7F.

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 function with dlsym: IsEnabled on 2026-11-17 at 09:05 UTC and IsEnabled2 at 11:04 UTC, two probes with the same sweep. A title process may differ. The cases are 0 to 2, lines 2 to 5 of the first raw output and 0 to 2.1, lines 2 to 7 of the second, both in the first comment (line 3 of each shows that the function was found).

Check PS5 payload process, firmware 11.60 AnyPS5 main before (test commit only) here (test and fix)
IsEnabled, bits 0 to 120 121 accepted, ones block all 1, zeros block none (first output, lines 4, 5) accepted up to 0x7F accepted up to 0x78
IsEnabled, bits 121 to 127 refused: non-zero return, code not printed (EINVAL seen for 127 in an earlier run) accepted refused with EINVAL
IsEnabled2, selectors 0 and 0x28, bits 0 to 120 121 accepted in each sweep, ones block all 1 (second output, lines 4 to 7) accepted up to 0x7F accepted up to 0x78
IsEnabled2, selectors 0 and 0x28, bits 121 to 127 refused: non-zero return, code not printed (lines 4 to 7) accepted refused with EINVAL

On main, with the test commit alone, one test, guest_kernel_sys, fails; it contains the checks of the table. Windows 10 Pro 10.0.19045 and Linux (WSL), one build per commit, on base upstream/main e798a424c71, on 2026-11-17 between 11:25 and 11:29 UTC. Windows: the test commit alone built with ninja returning 0 and ctest returned 8 (the test ended with exit code 0xc0000409); the head of this pull request built with ninja returning 0 and ctest returned 0. Linux: on commits whose trees equal the three commits of this pull request, ninja returned 0 for all three, the test commit alone aborted guest_kernel_sys (1 of 1 tests failed), and the fix commit and the documentation commit passed it in three runs each; tools/check_conventions.py passed for each commit.

tools/check_conventions.py --base upstream/main passes with no error and no warning (the changed sceKernelTitleWorkaroundIsEnabled entry is 993 characters, up from 900, and the sceKernelTitleWorkaroundIsEnabled2 entry 894, up from 637, both counted without the leading '- '). The change is 3 files, +30/-8, with no new comments in code. Not tested: macOS, the CI runner, a title process, other firmware, and the cases listed above as not measured.

Overlap: the other open pull requests that change one of the files of this branch (core/libs/prx/libkernel_sys/Export.cpp, core/libs/tests/GuestKernelSys.cpp) or the debt fragment, found by reading the changed files of all 1679 open pull requests at about 12:07 UTC, by reading what they change in docs/dev/debt/libkernel_sys.md and in the fragments under docs/dev/debt/changes/ for sceKernelTitleWorkaroundIsEnabled and sceKernelTitleWorkaroundIsEnabled2, and by searching their titles and branch names for the same names (no hit), were test-merged on 2026-11-17 at about 12:13 UTC against main 0859a63ae9f together with this head; the branch is based on e798a424c71, an ancestor of it, merges into main without a conflict, and tools/debt_fold.py --check applies the fragment to the libkernel_sys debt file of main without an error (checked without the fragment libressl3-20171-inventory.md, which already conflicts with feat-libressl3-evp-pkey-new-mac-key-v2.md on main and is not part of this change), the text each change names occurs in exactly one entry, and no other fragment changes those entries. Eleven pull requests list one of the files. Three of them conflict only with this change: #17908 (feat(libkernel): implement sceKernelSetProcessProperty), #17897 (feat(libkernel): implement the sceKernel*ToolMemory exports) and #17885 (feat(libkernel): export the kernel functions libkernel_sys provided alone) belong to one series that removes the definition of sceKernelTitleWorkaroundIsEnabled from libkernel_sys/Export.cpp (22 lines) and forwards the old name to a version in libkernel; they merge cleanly with main and conflict with main plus this head in Export.cpp, and #17885 also edits the sceKernelTitleWorkaroundIsEnabled line of the libkernel_sys debt file. Whichever lands second has to carry the limit of 0x78 into the moved function, because this change adds it to the definition they delete. #12315 and #9389 already conflict with main and conflict in the same files with this head merged first, and #22219, #21984, #18190, #17936, #15037 and #6918 merge cleanly with main and with this head. No open pull request changes the two debt entries this fragment changes in another way. The merged result was not built or run.

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 (no graphics change)
  • AI-assisted: yes

xXPBSXx and others added 3 commits November 17, 2026 12:22
…on the console

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nelTitleWorkaroundIsEnabled and IsEnabled2 as the console does

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

xXPBSXx commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Probe sources (built with ps5-payload-sdk v0.45; PROBE_BUILD is the first 12 hex digits of each source's SHA-256) and their raw outputs. The first probe, e07ea952f766, ran on 2026-11-17 at 09:05 UTC and tests sceKernelTitleWorkaroundIsEnabled; the second, 5ce1efcc1ae7, ran at 11:04 UTC and tests sceKernelTitleWorkaroundIsEnabled2 with the selectors 0 and 0x28. The clock in the PROBE lines is the console's own clock. Each probe loads libkernel.sprx, takes the function with dlsym and calls it for every bit from 0 to 127 on a block of zeros and on a block of ones, counting the accepted bits, the first refused bit, the bits that returned 1 and any value other than 0 or 1, and listing the refused ranges; a signal ends the probe. An internal probe number and case reference in the header comments were removed; the code is unchanged, and the build IDs are the hashes of the original files.

probe 1 (IsEnabled): probe.c
/* sceKernelTitleWorkaroundIsEnabled, the bit limit, payload process, firmware 11.60 (follow-up of an earlier run in
   which bit 127 returned 0x80020016 although the debt libkernel_sys.md sceKernelTitleWorkaroundIsEnabled entry, read from the
   13.42 disassembly, says bits 0 to 0x7F are accepted). The probe looks the function up with dlsym in libkernel.sprx and
   calls it once for every bit from 0 to 127 on a block of its own (version 1, align 0, ids = {0, 0}; the output word is
   filled with 0x5a5a5a5a before each call), 128 calls in all, no loop beyond that. It prints the first bit that is rejected,
   the number of accepted bits, the list of rejected bits below 128 as ranges, and whether an accepted bit ever returned
   enabled other than 0 (it must not, the block is zero). Then the same for the block ids = {0xffffffffffffffff,
   0xffffffffffffffff}: the number of accepted bits and how many returned 1. Only a block of its own is used. A fault ends
   the probe at once with _exit. Nothing is written, 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);
}

typedef struct { int32_t version; int32_t align; uint64_t ids[2]; } Workaround;
typedef int (*fn_w)(const Workaround*, int32_t, int32_t*);

static void fault(int sig) {
  static const char msg[] = "FAULT\tsignal in the call\n";
  (void)sig;
  (void)!write(1, msg, sizeof msg - 1);
  _exit(125);
}

static void sweep(const char* id, const char* label, fn_w f, const Workaround* w) {
  char ranges[160];
  int accepted = 0, ones = 0, first_bad = -1, nonzero_when_zero = 0, n = 0;
  int in_range = 0, start = 0;
  ranges[0] = 0;
  for (int bit = 0; bit < 128; ++bit) {
    int32_t en = 0x5a5a5a5a;
    int r = f(w, bit, &en);
    if (r == 0) {
      accepted++;
      if (en == 1) ones++;
      if (en != 0 && en != 1) nonzero_when_zero++;
      if (in_range && n < (int)sizeof ranges - 16) { n += snprintf(ranges + n, sizeof ranges - n, "%d-%d,", start, bit - 1); in_range = 0; }
    } else {
      if (first_bad < 0) first_bad = bit;
      if (!in_range) { in_range = 1; start = bit; }
    }
  }
  if (in_range && n < (int)sizeof ranges - 16) n += snprintf(ranges + n, sizeof ranges - n, "%d-127,", start);
  char extra[260];
  snprintf(extra, sizeof extra, "accepted=%d first_rejected=%d returned_one=%d odd_values=%d rejected_ranges=%s", accepted, first_bad, ones, nonzero_when_zero, ranges);
  probe_case(id, label, accepted, 0, extra);
}

int main(void) {
  signal(SIGALRM, probe_alarm);
  signal(SIGSEGV, fault);
  signal(SIGBUS, fault);
  alarm(PROBE_MAX_S);
  probe_header();
  char extra[96];

  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_w f = (fn_w)dlsym(lk, "sceKernelTitleWorkaroundIsEnabled");
  snprintf(extra, sizeof extra, "IsEnabled=%d", f != 0);
  probe_case("0b", "dlsym of the function", f ? 0 : -1, 0, extra);
  if (!f) { probe_end(); return 0; }

  Workaround zero = {1, 0, {0, 0}};
  Workaround ones = {1, 0, {0xffffffffffffffffULL, 0xffffffffffffffffULL}};
  sweep("1", "bits 0..127 on an all-zero block", f, &zero);
  sweep("2", "bits 0..127 on an all-ones block", f, &ones);

  probe_end();
  return 0;
}
probe 1 (IsEnabled): stdout
PROBE	libkernel_sys_titleworkaround_limit	fw=0x11600005	build=e07ea952f766	pid=215	utc=2026-11-17T10:47:08Z
CASE	0	load libkernel.sprx	0	2	loaded
CASE	0b	dlsym of the function	0	0	IsEnabled=1
CASE	1	bits 0..127 on an all-zero block	121	0	accepted=121 first_rejected=121 returned_one=0 odd_values=0 rejected_ranges=121-127,
CASE	2	bits 0..127 on an all-ones block	121	0	accepted=121 first_rejected=121 returned_one=121 odd_values=0 rejected_ranges=121-127,
END	4
probe 2 (IsEnabled2): probe.c
/* sceKernelTitleWorkaroundIsEnabled2, the bit limit, payload process, firmware 11.60 (follow-up of an earlier run in
   which bit 127 returned 0x80020016 although the debt libkernel_sys.md sceKernelTitleWorkaroundIsEnabled entry, read from the
   13.42 disassembly, says bits 0 to 0x7F are accepted). The probe looks the function up with dlsym in libkernel.sprx and
   calls it once for every bit from 0 to 127 on a block of its own (version 1, align 0, ids = {0, 0} or all ones; the output word is
   filled with 0x5a5a5a5a before each call), 128 calls per sweep and four sweeps (selector 0 and 0x28, an all-zero and an all-ones block), 512 calls in all. It prints the first bit that is rejected,
   the number of accepted bits, the list of rejected bits below 128 as ranges, and whether an accepted bit ever returned
   enabled other than 0 (it must not, the block is zero). Then the same for the block ids = {0xffffffffffffffff,
   0xffffffffffffffff}: the number of accepted bits and how many returned 1. Only a block of its own is used. A fault ends
   the probe at once with _exit. Nothing is written, 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);
}

typedef struct { int32_t version; int32_t align; uint64_t ids[2]; } Workaround;
typedef int (*fn_w)(const Workaround*, uint64_t, uint32_t, int32_t*);

static void fault(int sig) {
  static const char msg[] = "FAULT\tsignal in the call\n";
  (void)sig;
  (void)!write(1, msg, sizeof msg - 1);
  _exit(125);
}

static void sweep(const char* id, const char* label, fn_w f, const Workaround* w, uint64_t sel) {
  char ranges[160];
  int accepted = 0, ones = 0, first_bad = -1, nonzero_when_zero = 0, n = 0;
  int in_range = 0, start = 0;
  ranges[0] = 0;
  for (int bit = 0; bit < 128; ++bit) {
    int32_t en = 0x5a5a5a5a;
    int r = f(w, sel, (uint32_t)bit, &en);
    if (r == 0) {
      accepted++;
      if (en == 1) ones++;
      if (en != 0 && en != 1) nonzero_when_zero++;
      if (in_range && n < (int)sizeof ranges - 16) { n += snprintf(ranges + n, sizeof ranges - n, "%d-%d,", start, bit - 1); in_range = 0; }
    } else {
      if (first_bad < 0) first_bad = bit;
      if (!in_range) { in_range = 1; start = bit; }
    }
  }
  if (in_range && n < (int)sizeof ranges - 16) n += snprintf(ranges + n, sizeof ranges - n, "%d-127,", start);
  char extra[260];
  snprintf(extra, sizeof extra, "accepted=%d first_rejected=%d returned_one=%d odd_values=%d rejected_ranges=%s", accepted, first_bad, ones, nonzero_when_zero, ranges);
  probe_case(id, label, accepted, 0, extra);
}

int main(void) {
  signal(SIGALRM, probe_alarm);
  signal(SIGSEGV, fault);
  signal(SIGBUS, fault);
  alarm(PROBE_MAX_S);
  probe_header();
  char extra[96];

  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_w f = (fn_w)dlsym(lk, "sceKernelTitleWorkaroundIsEnabled2");
  snprintf(extra, sizeof extra, "IsEnabled2=%d", f != 0);
  probe_case("0b", "dlsym of the function", f ? 0 : -1, 0, extra);
  if (!f) { probe_end(); return 0; }

  Workaround zero = {1, 0, {0, 0}};
  Workaround ones = {1, 0, {0xffffffffffffffffULL, 0xffffffffffffffffULL}};
  sweep("1.0", "IsEnabled2 selector 0, bits 0..127, all-zero block", f, &zero, 0);
  sweep("1.1", "IsEnabled2 selector 0, bits 0..127, all-ones block", f, &ones, 0); sweep("2.0", "IsEnabled2 selector 0x28, bits 0..127, all-zero block", f, &zero, 0x28); sweep("2.1", "IsEnabled2 selector 0x28, bits 0..127, all-ones block", f, &ones, 0x28);

  probe_end();
  return 0;
}
probe 2 (IsEnabled2): stdout
PROBE	libkernel_sys_titleworkaround2_limit	fw=0x11600005	build=5ce1efcc1ae7	pid=217	utc=2026-11-17T12:46:48Z
CASE	0	load libkernel.sprx	0	2	loaded
CASE	0b	dlsym of the function	0	0	IsEnabled2=1
CASE	1.0	IsEnabled2 selector 0, bits 0..127, all-zero block	121	0	accepted=121 first_rejected=121 returned_one=0 odd_values=0 rejected_ranges=121-127,
CASE	1.1	IsEnabled2 selector 0, bits 0..127, all-ones block	121	0	accepted=121 first_rejected=121 returned_one=121 odd_values=0 rejected_ranges=121-127,
CASE	2.0	IsEnabled2 selector 0x28, bits 0..127, all-zero block	121	0	accepted=121 first_rejected=121 returned_one=0 odd_values=0 rejected_ranges=121-127,
CASE	2.1	IsEnabled2 selector 0x28, bits 0..127, all-ones block	121	0	accepted=121 first_rejected=121 returned_one=121 odd_values=0 rejected_ranges=121-127,
END	6

AI-assisted (Claude Code).

@PrivacyOnion PrivacyOnion 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.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against cc24ac6624:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_kernel_sys_tests built cleanly.
  • CTest (guest_kernel_sys):
    1/1 Test #864: guest_kernel_sys .................   Passed    0.22 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libkernel_sys/Export.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #864: guest_kernel_sys .................Subprocess aborted***Exception:   0.37 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified bit limit boundary checks in QueryTitleWorkaround (static_caststd::uint32_t(bit) > 0x78) returning 0x80020016 (EINVAL) matching probe measurements on PS5 firmware 11.60.
    • Verified null pointer checks for workaround and enabled pointers in QueryTitleWorkaround and sceKernelTitleWorkaroundIsEnabled2 returning 0x8002000E (EFAULT).
    • Verified selector validation in sceKernelTitleWorkaroundIsEnabled2 (selector >= 0x29) returning 0x80020016 (EINVAL) before calling QueryTitleWorkaround.
    • Verified GuestCopyIn_nid_no_patch and GuestCopyOut_nid_no_patch error handling and errno restoration on copy failure.
    • Verified debt fragment docs/dev/debt/changes/fix-kernel-sys-title-workaround-bit-limit.md conforms to repository conventions for technical debt changes.
    • Verified test suite in GuestKernelSys.cpp covers boundary values (0x77, 0x78, 0x79, 0x7E, 0x7F) and selectors for IsEnabled, IsEnabled2, and the typo alias sceKernelTitleWorkdaroundIsEnabled.

Looks Good To Me

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants