Files
ps5upload/payload/third_party/sdk-crt/patch.c
T
phantomptrandClaude Opus 5.5 0d254e5433 6.5.0: Collection, Move to, Android on Android 17, helper on FW 5.50, web UI pairing
New:
- Collection: every game in your folders (local or on a NAS, scanned in
  place), grouped with updates and DLC, what each PS5 has, one-click
  installs, install links, organize / de-duplicate / clean up. Replaces PS
  Game Library (with an importer).
- Send a game folder as one image (.ffpfsc / .ffpkg / .exfat); Convert
  writes .ffpkg and .ffpfs too.
- Files: Move to... (instant or cross-drive, with a fit check) and Set
  permissions (777).
- Offline PSN sign-in from Profile.

Fixed:
- Android 17: local network permission (6.x could not connect).
- FW 5.50: own build of the SDK startup code, so the helper, installer and
  elfldr start.
- Web UI: Send helper (pairs it); no "ready" while unpaired.
- Screenshots decode in a child process (Linux crash loop).
- Installs no longer start queued uploads.
- Cross-drive moves check the copy before removing the original.
- Finished installs show as done after a reload; engine-unreachable
  explained with Restart engine; Health starts the installer.
- Dev: make run-client renders on macOS 27.

Better: "declined" installs explain Sony's code and how far it got;
0x80B21104 explained; Connection failures readable; keep-awake for all
installs; Games cards. Translations, FAQ, README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VM5Gzyt1uxKyJiWZAgd1w9
2026-10-08 09:31:54 -07:00

102 lines
2.1 KiB
C

/* Copyright (C) 2024 John Törnblom
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>. */
#include "kernel.h"
#include "klog.h"
#include "payload.h"
#include "syscall.h"
/**
* Patch syscall permissions of the currently running process.
**/
static int
patch_syscall_permissions(void) {
int pid = __crt_syscall(SYS_getpid);
unsigned long kproc;
unsigned long kaddr;
unsigned long uaddr;
if(!(kproc=kernel_get_proc(pid))) {
return -1;
}
if(kernel_copyout(kproc + 0x3e8, &kaddr, sizeof(kaddr)) < 0) {
return -1;
}
// set lowest address allowed to make syscalls
uaddr = 0;
if(kernel_copyin(&uaddr, kaddr + 0xf0, sizeof(uaddr)) < 0) {
return -1;
}
// set highest address allowed to make syscalls
uaddr = -1;
if(kernel_copyin(&uaddr, kaddr + 0xf8, sizeof(uaddr)) < 0) {
return -1;
}
return 0;
}
/**
* Patch the credentials of the currently running process.
**/
static int
patch_kernel_ucred(void) {
int pid = __crt_syscall(SYS_getpid);
unsigned char attrs[32];
unsigned char caps[16];
if(kernel_get_ucred_caps(pid, caps)) {
return -1;
}
if(kernel_get_ucred_attrs(pid, attrs)) {
return -1;
}
caps[5] = 0x1c; // ??
caps[7] = 0x40; // jail related?
caps[15] |= 0x40; // jitshm
attrs[3] |= 0x80; // ptrace
if(kernel_set_ucred_caps(pid, caps)) {
return -1;
}
if(kernel_set_ucred_attrs(pid, attrs)) {
return -1;
}
return 0;
}
int
__patch_init(void) {
int error;
if((error=patch_kernel_ucred())) {
return error;
}
if((error=patch_syscall_permissions())) {
return error;
}
return 0;
}