- Extract the signing certificate from keyStore via keytool in
dump_flags_native() and emit TRUSTED_CERT in flags.rs (or an empty
slice when keyStore is not configured).
- Replace dynamic certificate extraction from stub.apk in
preserve_stub_apk() with the static TRUSTED_CERT constant.
- Move get_package_uid() out of MagiskD into a standalone function.
Assisted-by: Gemini 4 Argon
- Bump minSdk to 24 in Setup.kt, APP_PLATFORM to android-24 in
Application.mk, and update CI AVD matrices and scripts.
- Unify SePatchStrategy::Legacy with SePatchStrategy::SelinuxFs in
magiskinit to use MOCK_ENFORCE FIFO blocking and remove MOCK_REQPROT.
- Make APP_DATA_DIR a compile-time "/data/user_de" constant and remove
pre-API 24 /data/user and /data/adb fallbacks.
- Remove Android 6.0 Samsung forkAndSpecialize JNI hook signature.
- Remove pre-API 24 device-protected storage wrappers, Api23Impl in
LocaleSetting, AndroidManifest.xml stub resource workaround, and
ServiceCompat/ProcessCompat/InlinedApi workarounds in the app.
Assisted-by: Gemini 4 Argon
With reactive su request prompts removed and superuser permissions
granted explicitly ahead of time in the app, the legacy 4-way superuser
access mode (Disabled, Apps only, ADB only, Apps & ADB) and pre-O
reauthentication after upgrade settings are no longer applicable.
ADB shell (com.android.shell) is now an explicit policy entry managed
directly in the Superuser tab, making global access filters redundant
and prone to conflicting state. Furthermore, revoking policy on package
upgrade without reactive prompting silently breaks root for upgraded
apps.
- Remove RootAccess enum and root_access checks from magiskd.
- Remove su access mode and reauthenticate settings from Manager app.
- Drop ACTION_PACKAGE_REPLACED from Receiver and manifests.
- Purge obsolete string resources across all translations.
Assisted-by: Gemini 3.8 Flash
With reactive su prompting removed, root requests from UIDs without
an existing policy in the database are rejected immediately. Previously,
RootSettings defaulted log and notify to true, causing the daemon to
notify the manager app whenever an unconfigured UID attempted to run
su.
Derive Default for RootSettings so that policy defaults to Deny with
log and notify initialized to false, preventing unwanted notifications
to the app when no database policy exists. Also simplify SuInfo::allow
and SuInfo::deny to leverage Default.
Assisted-by: Gemini 3.8 Flash
SQLite returns a null pointer for SQL NULL. Passing it to rust::Str
crashes the daemon when a query result contains a NULL column.
Return an empty Rust string for NULL while leaving the raw C++ getter
unchanged, so callers that distinguish NULL can keep doing so.
Fixes: #10131
Assisted-by: GPT-6
On Headless System User Mode (HSUM) devices, user 0 is headless while
human users operate under secondary user IDs. Eliminate residual
assumptions in core native components where user 0 was presumed to be
the sole or active manager user:
- In setup_magisk_env, scan all existing users via get_users() to check
if the app-local binary install directory exists.
- In ensure_manager, check all users before falling back to stub install
so an already-installed manager on a secondary user is recognized.
- Pass --user all to pm install, pm uninstall, and appops set in package
management scripts to handle manager lifecycle device-wide.
Assisted-by: Gemini 3.8 Flash
Consolidate su notification and logging IPC calls into a single notify
action on the native side, passing all logging parameters along with an
explicit "log" boolean key.
On the application side, retain the existing "log" action entry point
for backwards compatibility with older daemons, and update the "notify"
handler to dispatch to either logging or notification based on the
boolean values.
Assisted-by: Gemini 3.8 Flash
On Headless System User Mode (HSUM) devices (e.g. Android Automotive
OS and shared tablets), user 0 is strictly a non-interactive background
system user while human users operate as secondary users (user 10+).
- Check ro.fw.mu.headless_system_user in daemon_entry and store it on
MagiskD.
- Enforce MultiuserMode::User on HSUM devices and seed the setting in
magisk.db during post-fs-data, avoiding duplicate override logic.
- For non-app UIDs (< AID_APP_START), scan all discovered users from
/data/user_de to resolve the manager package/UID and broadcast su
usage notifications across all users.
- Include system UIDs (< 10000) in PolicyDao.fetchAll() so ADB shell
(UID 2000) policies can be loaded on secondary users.
- Hide the Multiuser Mode setting in the app on HSUM devices.
Assisted-by: Gemini 3.8 Flash
Historically, magiskd fell back to `am start` when notifying the app
if `content call` failed. With interactive su prompts removed and
SuRequestActivity slated for removal, this fallback is obsolete.
Rely exclusively on ContentProvider calls for su logging and notify
events, log content call errors directly, and remove Extra::add_intent.
Assisted-by: Gemini 3.8 Flash
With the ability to explicitly grant superuser access in the app,
reactive su prompting and waiting for user response via an interactive
dialog is no longer needed.
- Remove app_request and the associated FIFO / poll waiting logic.
- Change the default SuPolicy and RootSettings from Query to Deny.
- Make SuInfo immutable by removing the internal Mutex<AccessInfo>,
flattening settings into SuInfo, and refreshing with an updated
clone on cache hits.
- Remove SuAppContext and convert notification and logging logic into
private MagiskD methods.
Assisted-by: Gemini 3.8 Flash
Remove reliance on /proc/self/fd symlink resolution across base and core
components:
- Add top-level pre_order_walk and post_order_walk that track entry
paths via an internal buffer, and unify Directory walk methods to
support path-tracking and pathless traversals without extra overhead.
- Add DirEntry::get_stat using fstatat(AT_SYMLINK_NOFOLLOW) directly on
directory file descriptors.
- Update Directory::copy_into and link_into to operate directly on file
descriptors with fd_get_attr/fd_set_attr, passing paths only for
symlink attribute updates.
- Refactor find_apk_path and restore_tmpcon to use pre_order_walk, and
update get_app_no_list to use DirEntry::get_stat.
- Remove DirEntry::resolve_path, Directory::path_at,
Directory::resolve_path, and fd_path.
- Replace remaining consumers of xrealpath and canonical_path (in su
and magiskinit) with standard realpath or partition matching, allowing
removal of Utf8CStr::realpath and its C FFI exports.
Assisted-by: Gemini 3.8 Flash
Move utilities that are exclusively used by the daemon (core module)
from base to core:
- fork_dont_care, fork_no_orphan, new_daemon_thread, init_argv0,
set_nice_name, and switch_mnt_ns into utils.cpp
- exec_command* functions and exec_t into scripting.cpp as static
functions, as scripting is their sole consumer
Also remove the unused exec_command_sync overload.
Assisted-by: Gemini 3.8 Flash
When a UID makes a root request for the first time, no row exists in
the policies table. Previously, RootSettings derived Default, which
initialized log and notify to false. As a result, connect_app() skipped
calling app_log() or app_notify() immediately after user approval on
the initial su request.
Explicitly implement Default for RootSettings with log and notify set
to true by default.
Assisted-by: Gemini 3.7 Flash
Meta Quest (Horizon OS) does not start the zygote the normal way: ro.zygote=
zygote64_stub32 launches /system/bin/stub_zygote, which forks a separate
app_process64 zygote PER security partition (system/trusted vs untrusted-app),
driven by hzos_security_zygote_partitioning_policy. The untrusted-app partition
zygote -- the one that forks 3rd-party apps and the Magisk manager -- is spawned
LAZILY, after boot-complete.
magiskd sets ro.dalvik.vm.native.bridge=libzygisk.so during boot but clears it
again at boot-complete (ZygiskState::reset). On a normal device every zygote has
already started by then, so clearing it is harmless. On Quest the untrusted-app
partition zygote reads the (now cleared) property when it finally execve's
app_process64, never loads libzygisk.so, so 3rd-party apps + the Magisk manager
are never injected -> "Zygisk: N/A".
Fix (daemon.rs): on the boot-complete reset(restore=true) path, reset the crash
counter but KEEP native.bridge set (set_prop) instead of clearing it
(restore_prop); only the >3-crash rollback path still clears. The lazily-spawned
partition zygotes then load the loader when they start.
Also (hook.cpp), robustness fixes the loader needs on this device:
- Wrap hook_zygote_jni()'s JNI locals in PushLocalFrame(64)/PopLocalFrame so
leaking locals can't trip ART's "non-empty local reference table" abort, and
bail if GetEnv returns no env.
- Make the strdup(ZygoteInit) trigger a substring match + add an idempotency
guard so the zygote hooks install exactly once per process.
Verified on Quest 3 (Android 14): system_server + every app fork is intercepted
and LSPosed loads end-to-end.
Address clippy warnings including collapsible match statements in
bootstages, daemon, su daemon, and db modules, as well as iterator
loops in files.rs.
Assisted-by: Gemini 3.6 Flash
* Use major number check to filter out device-mapper devices while preserving virtio-blk compatibility.
* Introduce `klogdump` partition support for Smartisan devices as a valid preinit target.
- Old behavior: Switching to a non-zero UID was implicitly interpreted as a request to drop capabilities, thereby preventing subsequent reacquisition via `su`.
- New behavior: Switching to a non-zero UID now requires the `--drop-cap` argument to explicitly prevent the reacquisition of capabilities.