topjohnwu c9eac0c438 Introduce new sepolicy strategy for legacy devices
The existing sepolicy patching strategy looks like this:

1. 2SI: use LD_PRELOAD to hijack `security_load_policy`
2. Split policy: devices using split policy implies it also needs to
   do early mount, which means fstab is stored in device tree.
   So we do the following:
   - Hijack the fstab node in the device tree in sysfs
   - Wait for init to mount selinuxfs for us
   - Hijack selinuxfs to intercept sepolicy loading
3. Monolithic policy: directly patch `/sepolicy`

Method #1 and #2 both has the magiskinit pre-init daemon handling
the sepolicy patching and loading process, while method #3 gives us
zero control over sepolicy loading process. Downsides:

a. Pre-init daemon bypasses the need to guess which sepolicy init
   will load, because the original init will literally send the stock
   sepolicy file directly to us with this approach.
b. If we want to add more features/functionalities during the sepolicy
   patching process, we will leave out devices using method #3

In order to solve these issues, we completely redesign the sepolicy
patching strategy for non-2SI devices. Instead of limiting usage of
pre-init daemon to early mount devices, we always intercept the
sepolicy loading process regardless of the Android version and device
setup. This will give us a unified implementation for sepolicy patching,
and will make it easier to develop further new features down the line.
2025-02-28 09:39:10 -08:00
2024-12-23 22:52:30 -08:00
2025-02-16 16:20:09 -08:00
2025-01-19 11:55:44 +08:00
2024-12-04 01:25:44 -08:00
2024-07-17 02:58:31 -07:00
2023-09-14 13:16:59 -07:00
2025-02-17 01:31:59 -08:00
2025-01-31 02:36:58 +08:00
2025-01-19 11:55:44 +08:00
2024-07-12 13:46:06 -07:00
2025-01-31 02:36:58 +08:00

Downloads

This is not an officially supported Google product

Introduction

Magisk is a suite of open source software for customizing Android, supporting devices higher than Android 6.0.
Some highlight features:

  • MagiskSU: Provide root access for applications
  • Magisk Modules: Modify read-only partitions by installing modules
  • MagiskBoot: The most complete tool for unpacking and repacking Android boot images
  • Zygisk: Run code in every Android applications' processes

Downloads

Github is the only source where you can get official Magisk information and downloads.

Click the icon below to download Magisk apk.

Bug Reports

Only bug reports from Debug builds will be accepted.

For installation issues, upload both boot image and install logs.
For Magisk issues, upload boot logcat or dmesg.
For Magisk app crashes, record and upload the logcat when the crash occurs.

Translation Contributions

Default string resources for the Magisk app and its stub APK are located here:

  • app/core/src/main/res/values/strings.xml
  • app/stub/src/main/res/values/strings.xml

Translate each and place them in the respective locations ([module]/src/main/res/values-[lang]/strings.xml).

License

Magisk, including all git submodules are free software:
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Description
The Magic Mask for Android
Readme GPL-3.0 106 MiB
Languages
C++ 36.6%
Kotlin 30.4%
Rust 16.4%
Java 9%
Shell 4.9%
Other 2.6%