apply hardened_malloc opt-out to app process children; override value of /proc/self/attr/prev for exec spawning - #412
Merged
Conversation
Use ScopedFileDescriptor to avoid error-prone explicit close(cmd_fd) calls.
There's no compat zygote equivalent for the native zygote.
inthewaves
suggested changes
Jul 27, 2026
Comment on lines
+65
to
+67
| final boolean useHardenedMalloc = AswUseHardenedMalloc.I.get(ctx, userId, appInfo, ps); | ||
| final boolean useZygoteSpawning = !AswUseExecSpawning.I.get(ctx, userId, appInfo, ps) | ||
| && ((zygotePolicyFlags & ZYGOTE_POLICY_FLAG_NATIVE_PROCESS) == 0 || useHardenedMalloc); |
Member
There was a problem hiding this comment.
This adds a second reason for native processes to use exec spawning, but com.android.server.am.ActiveServices still uses only AswUseExecSpawning when deciding whether to create an app zygote and attach appInfoForPreloading. Should probably refactor
Comment on lines
+77
to
+79
| // The value of /proc/self/attr/prev is "u:r:zygote:s0" when exec spawning is used. | ||
| // Some apps expect the value to be "u:r:init:s0", as is the case under zygote spawning. | ||
| res.selinuxFlags |= SELinuxFlags.OVERRIDE_PREV_SELINUX_CTX_TO_INIT; |
Member
There was a problem hiding this comment.
we could also add this to createForWebviewProcess, though an app probably doesn't check this from a WebView
Member
Author
There was a problem hiding this comment.
WebView processes never run Java or native code from their client app AFAIK.
ZygoteExtraArgs and ActiveServices logic was mismatched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on:
GrapheneOS/platform_bionic#78
GrapheneOS/platform_external_selinux#7
GrapheneOS/kernel_common-6.1#15
GrapheneOS/kernel_common-6.6#21
GrapheneOS/kernel_common-6.12#27
Closes: GrapheneOS/os-issue-tracker#7833