Skip to content

Commit ce1a6a6

Browse files
committed
fs.mitm/loader: Fix crashes when launching too many processes.
1 parent cf510ad commit ce1a6a6

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

fusee/fusee-secondary/src/kernel_patches.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ void package2_patch_kernel(void *_kernel, size_t size, bool is_sd_kernel) {
522522
fatal_error("kernel_patcher: unable to identify kernel!\n");
523523
}
524524

525+
if (kernel_info == NULL && is_sd_kernel) {
526+
return;
527+
}
528+
525529
/* Apply hooks. */
526530
uint8_t *kernel = (uint8_t *)_kernel;
527531
size_t free_space_offset = kernel_info->free_code_space_offset;

stratosphere/libstratosphere

stratosphere/loader/source/ldr_process_manager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Result ProcessManagerService::CreateProcess(Out<MovedHandle> proc_h, u64 index,
3030

3131
fprintf(stderr, "CreateProcess(%016lx, %08x, %08x);\n", index, flags, reslimit_h.handle);
3232

33+
ON_SCOPE_EXIT {
34+
/* Loader doesn't persist the copied resource limit handle. */
35+
svcCloseHandle(reslimit_h.handle);
36+
};
37+
3338
rc = Registration::GetRegisteredTidSid(index, &tid_sid);
3439
if (R_FAILED(rc)) {
3540
return rc;

0 commit comments

Comments
 (0)