From eb095314c971a1f8cb191b2260a832f0d41d16e8 Mon Sep 17 00:00:00 2001 From: SirHumza <204067870+SirHumza@users.noreply.github.com> Date: Fri, 25 Sep 2026 17:24:22 +0200 Subject: [PATCH] fix: use sceKernelLoadStartModule for eviction (kill blocked by sandbox) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - kill() returns EPERM in sandbox, so replaced with sceKernelLoadStartModule to launch evict.elf as a module — it reads daemon.lock and kills the daemon - Copy evict.elf first, then load+start it via LoadStartModule - Wait 500ms for evict.elf to run, then continue to copy orbisrpc.bin - Removed dead kill() SIGTERM/SIGKILL code - Verified: no kill references in binary, all tests pass, EBOOT matches --- installer/installer.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/installer/installer.c b/installer/installer.c index 23f7223..e858691 100644 --- a/installer/installer.c +++ b/installer/installer.c @@ -221,32 +221,18 @@ static int step_files(void){ mkdir(INST_DIR, 0777); mkdirs("/data/payloads"); /* Evict any running orbisRPC daemon before copying new payload. - * Read PID from daemon.lock and send SIGTERM then SIGKILL. */ + * kill() is blocked by the sandbox (EPERM), so use + * sceKernelLoadStartModule to launch evict.elf as a module. + * evict.elf reads daemon.lock, kills the daemon, exits. */ { - FILE *lf = fopen("/data/orbisRPC/daemon.lock", "rb"); - if(lf){ - int pid = 0; - if(fscanf(lf, "%d", &pid) == 1 && pid > 0){ - if(kill(pid, SIGTERM) == 0){ - ilog("evict-sigterm", 0, pid, 0); - sceKernelUsleep(500000); - if(kill(pid, SIGKILL) == 0){ - ilog("evict-sigkill", 0, pid, 0); - } else { - ilog("evict-sigkill-fail", errno, pid, 0); - } - } else { - ilog("evict-sigterm-fail", errno, pid, 0); - } - } - fclose(lf); - } else { - ilog("evict-nolock", errno, 0, 0); + evict_ok = copy_file(EVICT_ELF, EVICT_BIN); + ilog("evict-copy", evict_ok, 0, 0); + if(evict_ok == 0){ + uint32_t rv = sceKernelLoadStartModule(EVICT_BIN, 0, NULL, 0, NULL, NULL); + ilog("evict-launch", rv, 0, 0); + sceKernelUsleep(500000); } } - /* Copy evict payload to payload folder for future manual use. */ - evict_ok = copy_file(EVICT_ELF, EVICT_BIN); - ilog("evict-copy", evict_ok, 0, 0); /* Copy daemon payload. */ ok = copy_file(DAEMON_ELF, PAYLOAD_BIN); ilog("daemon-copy", ok, 0, 0);