20.0: fixup exec spawning toggle and also default disable it like 42c9d22d

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2022-10-22 18:03:37 -04:00
parent 1338c24d9b
commit 94d7ea9bb3
No known key found for this signature in database
GPG Key ID: B286E9F57A07424B
5 changed files with 8 additions and 8 deletions

View File

@ -161,7 +161,7 @@ index 993e4e7b4b3d..756547706f60 100644
} }
- if (parsedArgs.mInvokeWith != null || parsedArgs.mStartChildZygote - if (parsedArgs.mInvokeWith != null || parsedArgs.mStartChildZygote
+ if (parsedArgs.mInvokeWith != null || SystemProperties.getBoolean("sys.spawn.exec", true) || parsedArgs.mStartChildZygote + if (parsedArgs.mInvokeWith != null || SystemProperties.getBoolean("sys.spawn.exec", false) || parsedArgs.mStartChildZygote
|| !multipleOK || peer.getUid() != Process.SYSTEM_UID) { || !multipleOK || peer.getUid() != Process.SYSTEM_UID) {
// Continue using old code for now. TODO: Handle these cases in the other path. // Continue using old code for now. TODO: Handle these cases in the other path.
pid = Zygote.forkAndSpecialize(parsedArgs.mUid, parsedArgs.mGid, pid = Zygote.forkAndSpecialize(parsedArgs.mUid, parsedArgs.mGid,
@ -169,7 +169,7 @@ index 993e4e7b4b3d..756547706f60 100644
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned"); throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
} else { } else {
if (!isZygote) { if (!isZygote) {
+ if (SystemProperties.getBoolean("sys.spawn.exec", true)) { + if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
+ ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion, + ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs); + VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
+ +

View File

@ -82,7 +82,7 @@ index 27518dd4cdce..a8d9400c7992 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java --- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -539,7 +539,7 @@ class ZygoteConnection { @@ -539,7 +539,7 @@ class ZygoteConnection {
if (SystemProperties.getBoolean("sys.spawn.exec", true) && if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
(parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) { (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion, ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
- VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs); - VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);

View File

@ -17,8 +17,8 @@ index 756547706f60..27518dd4cdce 100644
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned"); throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
} else { } else {
if (!isZygote) { if (!isZygote) {
- if (SystemProperties.getBoolean("sys.spawn.exec", true)) { - if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
+ if (SystemProperties.getBoolean("sys.spawn.exec", true) && + if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
+ (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) { + (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion, ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs); VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);

View File

@ -89,7 +89,7 @@ index 0000000000..78f021210a
+public class ExecSpawnPreferenceController extends AbstractPreferenceController +public class ExecSpawnPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener { + implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener {
+ +
+ private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn"; + private static final String SYS_KEY_EXEC_SPAWN = "persist.security.exec_spawn_new";
+ private static final String PREF_KEY_EXEC_SPAWN = "exec_spawn"; + private static final String PREF_KEY_EXEC_SPAWN = "exec_spawn";
+ private static final String PREF_KEY_SECURITY_CATEGORY = "security_category"; + private static final String PREF_KEY_SECURITY_CATEGORY = "security_category";
+ +
@ -129,7 +129,7 @@ index 0000000000..78f021210a
+ +
+ if (mIsAdmin) { + if (mIsAdmin) {
+ mExecSpawn = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN); + mExecSpawn = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN);
+ mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, true)); + mExecSpawn.setChecked(SystemProperties.getBoolean(SYS_KEY_EXEC_SPAWN, false));
+ } else { + } else {
+ mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN)); + mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_EXEC_SPAWN));
+ } + }

@ -1 +1 @@
Subproject commit e5fd92d14e918cf4db2a2b5f9284474914d0d353 Subproject commit 073a081f055e3ef0e5a9153417b3bf0fd35d7105