Skip to content

[Bug] Zygote crash due to missing SELinux rules (enchilada, LOS, Magisk) #128

@droserasprout

Description

@droserasprout

Steps to reproduce/复现步骤

Setup

  • OnePlus 6 (enchilada)
  • Official LineageOS (lineage-22.2-20260408-nightly-enchilada-signed.zip)
  • Magisk 30.7 (30700)
  • NeoZygisk v2.3 (282-de38c62-debug, latest debug build)
  • Vector 2.0 (3021)

Problem

Zygote crash-loops when NeoZygisk tries to load Vector Xposed.

Root Cause

A two-part failure:

  1. SELinux blocks Vector's injection. NeoZygisk injects code that runs in the original u:r:zygote:s0 context (unlike Magisk's Zygisk, which uses a privileged context). Zygote lacks permission to write lspd.dex into /system/framework/, so it crashes on every restart.

  2. Preinit sepolicy rules aren't being applied. The rules in /data/unencrypted/magisk/sepolicy.rule — including NeoZygisk's own allow zygote adb_data_file dir search — are never loaded by magiskinit on this device. Likely a Magisk 30.7 regression or device-specific bug.

Additionally, Magisk 30+ hard-ignores any module with a zygisk/ directory when its built-in Zygisk is off, skipping that module's scripts, overlays, and sepolicy rules entirely.

Fix

Live-patch SELinux in NeoZygisk's post-fs-data.sh before the ptrace monitor starts:

# 1. Apply NeoZygisk's own rules (fixes zygote crash)
magiskpolicy --live --apply "$MODDIR/sepolicy.rule"

# 2. Apply rules from all Magisk-ignored zygisk modules (fixes Vector's missing types)
for file in ../*; do
  if [ -d "$file" ] && [ -d "$file/zygisk" ] && ! [ -f "$file/disable" ]; then
    [ -f "$file/sepolicy.rule" ] && magiskpolicy --live --apply "$(realpath $file/sepolicy.rule)"
  fi
done

Missing SELinux rules that had to be added:

allow zygote system_file dir { write add_name create }
allow zygote system_file file { write create open append }

Result

After reboot: zygote injected, zero crashes, zero SELinux denials, Vector fully operational.

Expected behaviour/预期行为

  • NeoZygisk: monitor: 😋 tracing
  • Vector: Activated

Actual behaviour/实际行为

  • NeoZygisk: monitor: ❌ stopped(zygote crashed)
  • Vector: manager warns about SELinux issues

Root implementation/Root 方案

Magisk 30.7

System Module List/系统模块列表

- audio-misc-settings
- callrecorder-skvalex
- compatible-magisk-mirroring
- microg_installer
- zygisk_shamiko (was uninstalled later, not the cause)
- zygisksu
- zygisk_vector

NeoZygisk version/NeoZygisk 版本

282-de38c62-debug

Android version/Android 版本

Android 15 (LineageOS 22.2 build 20260408)

Version requirement/版本要求

Logs/日志

LSPosed_2026-04-12T18_07_00.689641.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions