1282960dbf
commit 7d4155e4463eeadfe83a9475d69bca3de9000bcd Author: RikkaW <rikka@shizuku.moe> Date: Mon Jul 19 09:27:29 2021 +0800 Fix push task commit e76aa44cfb7c48ba6b875423d4cd6e175afd190c Author: RikkaW <rikka@shizuku.moe> Date: Mon Jul 19 00:06:20 2021 +0800 Update README commit 8fc3c0675e206380214b400f325f48c87bc2cd2c Author: RikkaW <rikka@shizuku.moe> Date: Sun Jul 18 17:14:18 2021 +0800 Changes for Riru v26 commit 8cf6eec5282c286c5b517bca6d102ba068617c95 Author: RikkaW <rikka@shizuku.moe> Date: Sat Jul 17 12:14:17 2021 +0800 Remove more pre-24 support commit 254ebfe8a7420aeb83e462cf4a4eb8aefd344bcf Author: RikkaW <rikka@shizuku.moe> Date: Sat Jul 17 11:28:31 2021 +0800 Add GitHub Actions commit a4840a9f53b6187789e8fdcd07379d1dff86db61 Author: RikkaW <rikka@shizuku.moe> Date: Sat Jul 17 11:24:14 2021 +0800 Strip .comment section commit 9faec484a8c3d516dd92d8d52c06c09033675a94 Author: RikkaW <rikka@shizuku.moe> Date: Sat Jul 17 11:21:34 2021 +0800 Use CMake configure_file commit 944fe620911af2c6dd5ec98a4a4c36ed3339627e Author: RikkaW <rikka@shizuku.moe> Date: Sat Jul 17 11:12:36 2021 +0800 Remove pre-24 support since next major version of Riru will do this as well commit af0c7759c2a2ab6d01b7e19ed7159dc7afdd8b1e Author: RikkaW <rikka@shizuku.moe> Date: Sat Jul 17 11:02:40 2021 +0800 Cleanup gradle codes commit e2a4ddabcd7ece769205c85c0c9f2e0017d0eb9a Author: Howard Wu <40033067+Howard20181@users.noreply.github.com> Date: Sat Jul 17 11:02:20 2021 +0800 Update update-binary & Fix typo (#10) * Update update-binary * Fix typo commit 3d3f92a4f561433cf2dc8f7188d1f6618e195b83 Author: RikkaW <rikka@shizuku.moe> Date: Fri May 21 18:42:05 2021 +0800 Refuse to install if Riru is disabled or will be removed commit f7e2af8cdf7b864e0cf47be727c466c4bef5c214 Author: RikkaW <rikka@shizuku.moe> Date: Fri May 21 18:22:20 2021 +0800 Fix check Riru commit 36b82ca3b5ee4b975a755b27461f634d933b73b6 Author: Rikka <rikka@shizuku.moe> Date: Fri Apr 16 13:00:06 2021 +0800 Fix typo commit 73c7588f75c9566bd43ebb830e5be4b7ef062bc5 Author: RikkaW <rikka@shizuku.moe> Date: Fri Apr 2 17:28:37 2021 +0800 Add note for module id commit a701bc9c2c7a2c2a220aa4a6cec2474011387882 Author: RikkaW <rikka@shizuku.moe> Date: Tue Mar 30 11:49:25 2021 +0800 Add empty new line to scripts commit ce576cc23ab16ad22182b7fb708407f9712e758f Author: RikkaW <rikka@shizuku.moe> Date: Mon Mar 29 20:40:26 2021 +0800 Update CMakeLists.txt commit b4b1ec5b3231cef7a0a46b93f10a9aa4c6195eac Author: RikkaW <rikka@shizuku.moe> Date: Mon Mar 29 11:41:41 2021 +0800 Change "equals to Release" to "not equals to Debug" since the latest canary AGP has different build type commit c6cacf4c13184fb8539ce4b52751373ed7f09687 Author: RikkaW <rikka@shizuku.moe> Date: Mon Mar 29 10:47:08 2021 +0800 Update tasks commit 78013af879c1515e681f69b639198f021b7f003e Author: RikkaW <rikka@shizuku.moe> Date: Mon Mar 29 10:37:00 2021 +0800 Don't extract riru.sh to MODPATH commit 1337d948efdae9190eb1fad0f4eb9a2682519a3d Author: RikkaW <rikka@shizuku.moe> Date: Sun Mar 28 13:33:11 2021 +0800 Delete out dir in clean task commit 17cb1eebc7ec734a263a263d9b73ccf64dcfd137 Author: RikkaW <rikka@shizuku.moe> Date: Sun Mar 28 12:39:58 2021 +0800 Update template commit 6cb995e9f8607eaf695d0fb468a2b46355c5686c Author: RikkaW <rikka@shizuku.moe> Date: Mon Mar 22 16:34:21 2021 +0800 Update build.gradle commit 3857b8b599027bfdc2df4c4dd8feb94c4b7e7011 Author: RikkaW <rikka@shizuku.moe> Date: Wed Mar 17 02:51:51 2021 +0800 Update main.cpp commit 49868e17dfcd8d4c292a4b9e35aa96279977952a Author: RikkaW <rikka@shizuku.moe> Date: Wed Mar 17 02:40:36 2021 +0800 Update README commit 00abd3beeeca97b814ca2afb0e78e62d9c2aeca3 Author: RikkaW <rikka@shizuku.moe> Date: Wed Mar 17 02:34:13 2021 +0800 Fix typo commit ce677f7de75fcd9d0a65a7839983c263a04a746f Author: RikkaW <rikka@shizuku.moe> Date: Tue Mar 16 17:56:51 2021 +0800 Changes for Riru v25 commit 443ab95c2333c6a5006a0a520a9a5b29aa10a9e6 Author: RikkaW <rikka@shizuku.moe> Date: Fri Mar 12 00:07:28 2021 +0800 Fix main.cpp commit 551b2e6189476ecffb2cfd6aeda08f5550deb15a Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 22:58:19 2021 +0800 Update riru.sh commit f9794cbe205d3c2b37a423bc723b1922589c26f7 Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 22:55:26 2021 +0800 Use magisk --path commit 90d7adc75a06f70978f24b8341e1e702de978422 Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 18:01:22 2021 +0800 Update README commit 81c1e564f83459bbf0024a52a45e77b5b860055c Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 17:44:28 2021 +0800 Fix typo commit ddd5fbf8db1a30d08a030f7048041a1453828cfc Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 17:44:08 2021 +0800 Update main.cpp commit f9999fd1a234fe8bd099a909dff07d3ba77f511d Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 17:13:49 2021 +0800 Minor changes commit a16bd42029bf61909893cef8d89451c82a827748 Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 11 03:21:47 2021 +0800 Changes for Riru v24 again commit ed2ee5d3e4238c34fe18774cbd21837756e47270 Author: RikkaW <rikka@shizuku.moe> Date: Wed Mar 10 12:56:46 2021 +0800 Changes for Riru v24 commit faf4fcc3c17d743a8aec303d666a266548c1ee3d Author: RikkaW <rikka@shizuku.moe> Date: Fri Mar 5 15:08:06 2021 +0800 Lib moved to maven central commit 56fdbe82840b3b1c2bbefea89403c5ff838068f7 Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 4 16:51:25 2021 +0800 Update .gitattributes commit 9ace98fc53fc5aac43d1f0c87a3097658503969f Author: RikkaW <rikka@shizuku.moe> Date: Thu Mar 4 14:15:15 2021 +0800 Change lib path commit cf186db98da1660c6dbebe07b001606e1c0fac77 Author: RikkaW <rikka@shizuku.moe> Date: Sat Feb 27 22:02:19 2021 +0800 Fix check_riru_version commit d96a11f03cfb59cf1c8ed6f5d4156c9f0e23ed1b Author: RikkaW <rikka@shizuku.moe> Date: Tue Feb 23 12:37:49 2021 +0800 Update comment for shouldSkipUid commit fbe327ea4fb94c9b4a9e68dbfada3b84e51ce3dd Author: RikkaW <rikka@shizuku.moe> Date: Tue Feb 23 12:32:41 2021 +0800 Remove "_" commit a4316fab79151f4488a8d50480f73b2a0260004f Author: RikkaW <rikka@shizuku.moe> Date: Tue Feb 23 12:25:03 2021 +0800 Fix typo commit cd03c4561b32b093d22b32ebbd8275f9e2f78799 Author: RikkaW <rikka@shizuku.moe> Date: Sun Jan 3 13:39:45 2021 +0800 Fix install on x86 commit 530e7bc4c2b1fd3da9d94fb884fd2ccfbeb765da Author: RikkaW <rikka@shizuku.moe> Date: Sat Jan 2 15:08:50 2021 +0800 Use /data/adb/riru/util_functions.sh commit 3bdc01c04311eb51ab8520f00b72b8196c0efe55 Author: RikkaW <rikka@xing.moe> Date: Wed Dec 2 21:55:44 2020 +0800 Add comment about prefab 1.1.2 commit a60279ee147f9e24c37df5da53ae7db5f33f9201 Author: RikkaW <rikka@xing.moe> Date: Tue Dec 1 17:05:46 2020 +0800 Update README commit cd6669ebe4dc7d9ca92562ede48cfeb066132d70 Author: RikkaW <rikka@xing.moe> Date: Tue Dec 1 16:44:02 2020 +0800 Update README commit d3f00eab36d1076b2cdd217a08c16a9931bea542 Author: RikkaW <rikka@xing.moe> Date: Tue Dec 1 16:39:36 2020 +0800 Update exmaple commit 853279e9bf47a0e98fbe5f21998fc8c98cf1a738 Author: RikkaW <rikka@xing.moe> Date: Tue Dec 1 15:51:24 2020 +0800 Update for readdir through rirud commit a73dde129b303074bc834b26e6f313348c6a32af Author: RikkaW <rikka@xing.moe> Date: Mon Nov 30 15:48:54 2020 +0800 Update README commit 0587881cfe3b3426b7e1ecfc27c71c8bce3806c5 Author: RikkaW <rikka@xing.moe> Date: Mon Nov 30 15:47:45 2020 +0800 Update riru.h location commit 8a485e19e37358523ae7e97e0869cfc7c41a4f0b Author: RikkaW <rikka@xing.moe> Date: Mon Nov 30 15:41:31 2020 +0800 Update for API v10 commit 1561b5c6a9ba84504b0966a90c2c2a5d1c2d03c7 Author: RikkaW <rikka@xing.moe> Date: Sun Nov 15 15:54:51 2020 +0800 Update module.example.gradle commit 4c9579c3a90c31e092ade77fe54e438688ad1222 Author: RikkaW <rikka@xing.moe> Date: Sat Nov 14 21:04:23 2020 +0800 Update AGP to 4.1.1 commit 7e3ee55957680ab75b0b5c3af2fa42b582665ffe Author: RikkaW <rikka@xing.moe> Date: Sat Nov 14 21:04:03 2020 +0800 Min SDK version should be 23 commit 6f11ef88befeca5ca61b3e36bbd3e0d64be91e3e Author: RikkaW <rikka@xing.moe> Date: Sat Nov 14 14:32:58 2020 +0800 Change check riru version text commit 8f72889ffb9eff6ea30ca576446f0a30d4cd7505 Author: RikkaW <rikka@xing.moe> Date: Wed Oct 28 16:54:19 2020 +0800 Use u:object_r:magisk_file:s0 commit 899dbabe978dfa5a45a375e868514191c2893eb3 Author: RikkaW <rikka@xing.moe> Date: Sat Oct 24 22:05:53 2020 +0800 Update README commit 4e0ffdfe04cb23f89e6117ac690395c00fae1fcf Author: RikkaW <rikka@xing.moe> Date: Sat Oct 24 18:57:03 2020 +0800 Update README commit 36b254fd5c409b4d137f3dddd0b5875df94363bf Author: RikkaW <rikka@xing.moe> Date: Sat Oct 24 18:39:31 2020 +0800 Update README commit 7858d6d543073c5db66136aa3480a661a64ea9b7 Author: RikkaW <rikka@xing.moe> Date: Sat Oct 24 17:18:53 2020 +0800 use stable version AGP commit 18fed7b26067ab76017ed900f47438ffbeb47264 Author: Rikka <rikka@xing.moe> Date: Sat Oct 24 14:45:18 2020 +0800 Add LICENSE commit 52d4966bea7dea293559f72dd6d85af391fe32a8 Author: RikkaW <rikka@xing.moe> Date: Tue Oct 13 14:21:34 2020 +0800 update dependency commit 69d0e07f7f5e2ab9d6af680cfe7da87f80f910cd Author: RikkaW <rikka@xing.moe> Date: Sun Oct 11 22:15:18 2020 +0800 add missing supportHide commit 4e108b0d0fe52e6460cb235bd18b141b5cb41af4 Author: RikkaW <rikka@xing.moe> Date: Sun Oct 11 22:14:48 2020 +0800 add missing version/versionName commit 4a98de054a9a3b54550562be7c3e2d443d514567 Author: RikkaW <rikka@xing.moe> Date: Sun Oct 11 21:55:48 2020 +0800 pass api version from gradle commit b0143d1e7ab9a80a60671e69f7bd78056b4ba536 Author: RikkaW <rikka@xing.moe> Date: Sun Oct 11 20:56:28 2020 +0800 update for api 9 commit bc19061bb0b205ec879e75cb4286e98b8a622bd2 Author: RikkaW <rikka@xing.moe> Date: Fri Oct 9 23:26:16 2020 +0800 update AGP to make prefab happy commit 890f50f643b607ede1303dc54057fe2d0639519a Author: RikkaW <rikka@xing.moe> Date: Fri Oct 9 23:21:53 2020 +0800 update for api 8 commit 044de559aac06fb312ea52c6625fda62f03f7c87 Author: RikkaW <rikka@shizuku.moe> Date: Mon May 11 12:59:04 2020 +0800 remove "abort_clean" commit 1efe42f60aab6536a8d85ebc272dd4ad34f299e2 Author: RikkaW <rikka@shizuku.moe> Date: Sat May 9 11:05:31 2020 +0800 update for api 7 commit 155d2ed8af52838da9153df7b375059393b3e153 Author: RikkaW <rikka@shizuku.moe> Date: Fri Apr 24 14:02:35 2020 +0800 show required Riru version name commit 989b733ff52b5f052f33bbdafe1eb1543aff3a4a Author: RikkaW <rikka@shizuku.moe> Date: Fri Apr 24 13:29:46 2020 +0800 update for api 6 commit 65afd5a278c93b3828c48984092ed6ffa1d82202 Author: RikkaW <rikka@shizuku.moe> Date: Sun Apr 19 16:27:09 2020 +0800 update for api 5 commit a1c359f2ac374c74a2be63e36aa8351972838ae0 Author: RikkaW <rikka@shizuku.moe> Date: Wed Mar 18 16:35:03 2020 +0800 move module info to a stand-alone file fix #3 commit d768c52ec0740ad423508447fc5ddb1afab84e5b Author: RikkaW <rikka@shizuku.moe> Date: Fri Feb 28 01:17:47 2020 +0800 allow installed after new installation of Riru fix RikkaApps/Riru#86 commit 77bc46c73b130b42da24c498e44080b54e185fa5 Author: RikkaW <rikka@shizuku.moe> Date: Wed Feb 26 16:44:55 2020 +0800 update installation scripts commit 322576c630974fadbf73cc7e95fe7e0ce405534b Author: RikkaW <rikka@shizuku.moe> Date: Mon Feb 24 18:44:50 2020 +0800 fix bug commit 4638ccd2434e412a633ceae1c57289e1820074a5 Author: RikkaW <rikka@shizuku.moe> Date: Wed Feb 5 23:40:05 2020 +0800 fix #2 commit 85a565c0788339b393da347847eb6896e7b4f5bc Author: RikkaW <rikka@shizuku.moe> Date: Wed Feb 5 20:02:01 2020 +0800 no longer requires to modify the name "template" everywhere commit a2ae8d3f1a76c2aa7a3ecbedee51e3e8d9cdac9a Author: RikkaW <rikka@shizuku.moe> Date: Sat Jan 25 22:07:52 2020 +0800 update installation scripts commit 9729cd9b48e6d2d1940a340eaddec7bc0373c152 Author: RikkaW <rikka@shizuku.moe> Date: Sat Jan 25 00:30:00 2020 +0800 fix .gitattributes commit 1cb568d8d0f00fa580a325e1b9e9b4fdbd2f8538 Author: RikkaW <rikka@shizuku.moe> Date: Tue Jan 21 22:38:24 2020 +0800 format changes commit 9f362b94c17423c63ef373bceac635fb05085c08 Author: RikkaW <rikka@shizuku.moe> Date: Tue Jan 21 22:36:38 2020 +0800 format changes commit 09478e75cde4a0fe5af44495e5a530abfaa0ced6 Author: RikkaW <rikka@shizuku.moe> Date: Tue Jan 21 22:36:32 2020 +0800 fix bug commit 4e543b9e13bf8980f308410a3a2d533722ca6f94 Author: RikkaW <rikka@shizuku.moe> Date: Sun Jan 19 12:52:46 2020 +0800 add missing settings.gradle close #1 commit 96eb129abe88b940a9c9e3a774023729673da788 Author: RikkaW <rikka@shizuku.moe> Date: Fri Jan 10 17:17:46 2020 +0800 remove zip verification commit 4072c60339b56865a59a72e33acf497d52a5824a Author: RikkaW <rikka@shizuku.moe> Date: Wed Jan 8 15:37:07 2020 +0800 add missing uninstall.sh commit d99fd3a4413b0de2029a7a2b0e34c7563094613e Author: RikkaW <rikka@shizuku.moe> Date: Wed Jan 8 00:24:07 2020 +0800 initial commit |
||
---|---|---|
.. | ||
gradle/wrapper | ||
module | ||
template/magisk_module | ||
.gitattributes | ||
.gitignore | ||
build.gradle | ||
gradle.properties | ||
gradlew | ||
gradlew.bat | ||
LICENSE | ||
module.example.gradle | ||
README.md | ||
settings.gradle |
Riru - Template
Riru module template.
Build
- Rename
module.example.gradle
tomodule.gradle
- Replace module info in
module.gradle
(all lines end with "replace with yours") - Write your codes
- Run gradle task
:module:assembleRelease
task from Android Studio or command line, zip will be saved inout
.
File structure
A Riru module is a Magisk module, please read Magisk module document first.
If the folder $MODPATH/riru
exists, the module is considered as a Riru module. All files in $MODPATH/riru/lib(64)
will be loaded by Riru.
API changes
API 26 (Riru v26)
-
Remove the support of pre-24 modules
-
/data/adb/dev_random
is planned to be moved to another place in the next major version -
Libraries in
/dev
do not have stacktrace, developers have to put so file into/system
, Riru v26 makes this simplerCreate an empty file,
libxxx
(no.so
suffix), at$MODPATH/riru/lib(64)
, Riru will try to load/system/lib(64)/libxxx.so
API 25 (Riru v25)
- Modules can be unloaded (see
main.cpp
) shouldSkipUid
is removed for API 25 modules
API 24 (Riru v24)
- The Riru API version is unified with Riru version, now the API version is 24
- The
/data/adb/riru/modules/<name>
folder is deprecated, modules only need to place library files in$MODPATH/riru/lib(64)
(seecustomize.sh
post-fs-data.sh
) - The
init
function is called only once (seemain.cpp
) - It's recommended to place modules files in the Magisk module folder, zygote has permission read this folder directly (the path is passed through
init
function, seemain.cpp
)
API 10 (Riru v23)
Background of rirud:
Riru v22.0 move config files to /data/adb
, this makes patch SELinux rules a must. However Magisk's sepolicy.rule
actually not work for maybe lots of devices. As the release of Riru v22.0, these people "suddenly" appears.
sepolicy.rule
support was added from Magisk v20.2, a long time ago, no one report to Magisk 😒.
To workaround this "problem", "rirud" is introduced. It will be started by post-fs-data.sh
and run a socket runs under u:r:zygote:s0
context. All file operations can be done through this socket.
From Riru v23, "read file" and "read dir" function are added for "rirud". Modules can use this to read files that zygote itself has not permission to access. Note, for hide purpose, "rirud" socket is only available before system_server is started.
In order to give the module enough freedom (like how to allocate memory), there is no "API". The module needs to implement socket codes by itself.
Pseudocode of read file:
socket(PF_UNIX, SOCK_STREAM)
setup_sockaddr("rirud")
write(ACTION_READ_FILE /* 4 */, sizeof(uint32))
write(path_size, sizeof(uint32))
write(path, path_size)
errno = read(sizeof(int32_t)) // errno of "open" in "rirud"
if (errno != 0) return
bytes_count = read(sizeof(int32_t))
if (bytes_count > 0) {
// file has size
// read total "bytes_count" bytes
} else if (bytes_count == 0) {
// file has no size, read until 0
// read until 0
}
Pseudocode of read dir:
socket(PF_UNIX, SOCK_STREAM)
setup_sockaddr("rirud")
write(ACTION_READ_DIR /* 5 */, sizeof(uint32))
write(path_size, sizeof(uint32))
write(path, path_size)
errno = read(sizeof(int32_t)) // errno of "opendir" in "rirud"
if (errno != 0) return
while (true) {
write(1 /* continue */, sizeof(uint8))
reply = read(sizeof(int32))
if (reply == -1) break // end
if (reply != 0) continue // reply is errno of "readdir" in "rirud"
d_type = read(sizeof(uchar))
d_name = read(256)
}
Example implementation: https://github.com/RikkaApps/Riru-LocationReportEnabler/commit/89b2e396efcd928121ba3d254b96af1560cfaf4d
API 9 (Riru v22)
API
Functions like nativeForkAnd...
do not need to be exported directly. The only function to export is void *init(void *)
. See the comment of init
and template's implementation for more.
This has these advantages:
- Module can support different Riru versions
- Riru itself will not relay on ".prop" file (unreliable) to get module information
Riru
Starting v22.0, Riru has switched to "native bridge" (ro.dalvik.vm.native.bridge
) to inject zygote, this will lead Riru and modules be loaded later (LoadNativeBridge
vs __attribute__((constructor))
).
For most modules, this should have no problem, but modules like Xposed frameworks may have to make changes.
Magisk may provider Riru-like features in the far future, and of course, it will have more strict restrictions, module codes will not be run in zygote. Maybe Xposed framework modules should prepare for this?
Riru v22 also provides hide function to make the memory of the module to anonymous memory (see the implementation). This is an opt-in behavior (module->supportHide
) and Riru itself also has a global toggle (/data/adb/riru/enable_hide
).
Module installer
RIRU_PATH
has been changed to /data/adb/riru
for hide purpose. If you have other files in /data/misc/riru
, move them here (or anywhere else if you want).
Note /data/adb/riru
have the same SELinux like other Magisk files (set by Riru in post-fs-data), u:object_r:magisk_file:s0
. DO NOT reset the context to something else.