From f38b610732673eda047f6cf25e1b48983f334c56 Mon Sep 17 00:00:00 2001 From: misson20000 Date: Thu, 20 Dec 2018 15:08:29 -0800 Subject: [PATCH] sm: add permissive unregistration compile-time option --- stratosphere/sm/Makefile | 2 +- stratosphere/sm/source/sm_registration.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/stratosphere/sm/Makefile b/stratosphere/sm/Makefile index b73b78a53..247cc5043 100644 --- a/stratosphere/sm/Makefile +++ b/stratosphere/sm/Makefile @@ -41,7 +41,7 @@ ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE CFLAGS := -g -Wall -O2 -ffunction-sections \ $(ARCH) $(DEFINES) -CFLAGS += $(INCLUDE) -D__SWITCH__ -DSM_ENABLE_MITM -DSM_ENABLE_INIT_DEFERS -DSM_MINIMUM_SESSION_LIMIT=8 +CFLAGS += $(INCLUDE) -D__SWITCH__ -DSM_ENABLE_MITM -DSM_ENABLE_INIT_DEFERS -DSM_MINIMUM_SESSION_LIMIT=8 -DSM_ENABLE_PERMISSIVE_UNREGISTER CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17 diff --git a/stratosphere/sm/source/sm_registration.cpp b/stratosphere/sm/source/sm_registration.cpp index 3401f800f..1e501ca0a 100644 --- a/stratosphere/sm/source/sm_registration.cpp +++ b/stratosphere/sm/source/sm_registration.cpp @@ -428,9 +428,11 @@ Result Registration::UnregisterServiceForPid(u64 pid, u64 service) { return 0xE15; } +#ifndef SM_ENABLE_PERMISSIVE_UNREGISTER if (!IsInitialProcess(pid) && target_service->owner_pid != pid) { return 0x1015; } +#endif svcCloseHandle(target_service->port_h); svcCloseHandle(target_service->mitm_port_h);