Commit Graph

120 Commits

Author SHA1 Message Date
JingMatrix 1436f692fb
Refactor dex2oat wrapper to solve long-standing issues (#515)
Manual library path injection via LD_LIBRARY_PATH has become unreliable due to symbol mismatches in core libraries (e.g., `libc++`) between the system and APEX partitions. Recent updates to `liblog` and `libbase` (in Android 16) have resulted in missing symbols like `__hash_memory` or `fmt` when the ART APEX binaries are forced to load system-partition shims.

This commit switches the wrapper to execute the runtime APEX linker directly (e.g., `/apex/com.android.runtime/bin/linker64`). By passing the dex2oat binary to the linker via `/proc/self/fd/`, the linker can properly initialize internal namespaces and resolve dependencies from the correct APEX and bootstrap locations.

Moreover, for the OatHeader hook, a bug introduced in 6703b45350 is now fixed, where the target functions of PLT hooks are overwritten by the our helper functions.

Details of the refactored project are explained in README.
2026-01-25 10:13:57 +01:00
JingMatrix e893bb0f28
Add `--system-server-max-retry` argument in service mode (#511)
User reports that system server injection can still fail even when the daemon is started in service mode.

Hence, we add argument `--system-server-max-retry=3` to address this problem.
2026-01-21 23:24:38 +01:00
JingMatrix 0e457e3247 Start LSPosed daemon in `service.sh`
This reverts partially commit c622d0f1f9.

In my test device (Pixel 6, Android 16 qpr2, KernelSU), calling twice LSPosed daemon results a detection based on `mount_id` values. In `com.reveny.nativecheck` 7.6.1, it is named as `Detected Magic Mount`.
Of course, this naming is incorrect and misleading. We refer to https://github.com/JingMatrix/NeoZygisk/pull/39 for details of this detection point.
2025-12-04 23:59:55 +01:00
JingMatrix c622d0f1f9 Start service daemon in post-fs-data.sh (#429)
For trace cleaning modules to work properly, such as the DenyList feature of NeoZygisk, it is better to execute modules mount (`dex2oat` for the case of LSPosed) at post-fs-data.sh.

Moreover, the `logd` daemon of LSPosed should start as early as possible.

This reverts commit 92cbed418e (pull-request #57).

The original pull-request claimed a `PlayIntegrityFix` break, but was not reproducible on other devices.
2025-11-08 11:59:16 +01:00
JingMatrix 0044a36fcf Update dependencies
When upgrading to gradle 9 +, we remove several unused tasks for development to simplify the process.

Close #385, #441, #445, #448, #462 as merged.
2025-11-08 11:56:08 +01:00
Qing_Feng 108149b6b7
Remove WebUI integration (#345)
Having a WebUI simply duplicating the current function of the Action button is unnecessary.

Since most users are migrated to root implementations which realize the Action button feature, we revert commit f8409ad34b to remove the WebUI integration of LSPosed.
2025-07-21 07:37:52 +02:00
JingMatrix 5e040f97e8 Fix typo in update/zygisk.json
Close #347 as completed.
2025-07-13 23:56:24 +02:00
JingMatrix f081aa3899
Fix packaging bugs of LSPosed v1.10.2 (#341)
1. Magisk manager cuts off the full changelog, it is thus better to move my personal note to the end. Add emoji for easier understanding.
2. Fix locating the generated javascript file. In Parcel 2, this file now has prefix `generate`.
3. Fix the author name, use JingMatrix for accuracy.
2025-07-13 01:32:45 +02:00
JingMatrix 06abb8a7bc Release LSPosed v1.10.2 2025-07-12 11:30:46 +02:00
JingMatrix d625e00b6e Update dependencies
1. Parcel 1 is deprecated, see https://www.npmjs.com/package/parcel-bundler.
2. `com.android.application` 8.11.1 requires Gradle 8.13+
2025-07-12 08:07:01 +02:00
JingMatrix 209a5417ec
Allow dex2oat to access files received from sockets (#165)
On some devices `dex2oat` cannot access files (fd) received from sockets due to SELinux restrictions.
Hence, we add a new rule according to the avc logs, which showed that permissions `open` and `getattr` were needed.
2025-01-22 12:01:55 +01:00
JingMatrix c0478f593e
Hook dex2oat functions to remove LSPosed traces (#152)
We use the env LD_PRELOAD to hook the execution of `dex2oat`, which can be directly set to be a file descriptor.
2025-01-08 07:19:18 +01:00
JingMatrix 2bc0f0c716 Refine SELinux rules for Xposed files (#149)
1. The SELinux context label `magisk_file` is widely used by Zygisk implementation modules. It is improper for LSPosed to abuse this label for its own files. We replace it by `xposed_file`.
2. A new rule added according to the SELinux logs, which is needed to write to the mangaer's SharedPreference.
3. `xposed_data` is a new SELinux context label for XSharedPreference files, it is not meant to provide MAC restricted access but to conform with Android's rule: https://developer.android.com/about/versions/pie/android-9.0-changes-28#per-app-selinux.
4. We add attribute `mlstrustedobject` to ignore the `Multi-Level and Multi-Category Security` enforced on Android.
2025-01-06 16:31:17 +01:00
JingMatrix fba56a9927 Adjust debugging settings
1. Set log buffer size for system
2. Increase buffer size to 128 Kb
3. Record also logs for APatch, KernelSU and SELinux
4. Add installation tasks for APatch
2025-01-03 14:06:28 +01:00
JingMatrix 1d09934523 Remove redundant MapInfo::Scan function
With inline hook, we no longer need to scan process virtual maps.

Moreover, I can no longer justify the point 3 stated in commit
156c6ae855 by experiments, which is
mysterious given my previous experiments done for the commit
3c020a9cd7.

Currently, only one thing is sure: reading `/proc/self/map` can be
detected by Holmes. Hence, it is always a good practice to not inject
unnecessary codes during the preAppSpecialize API.
2024-12-11 17:02:38 +01:00
JingMatrix e7a5835d8f
Clear compilation warnings (#121)
* Fix warnings of CMake

To completely remove CMake version warnings, one may need to change the CMakeLists.txt file in the NDK installation.

* Add compiler flag -Wpedantic

Show compilation errors for the core subject, while ignore some of them
2024-12-09 22:15:18 +01:00
JingMatrix 6eb133b114 Fix incorrect initInfo parameter
Since we are using Dobby inline hook, the field `is_plt_hook` should be
the default value, i.e., false.

Close #113 as fixed.
2024-12-06 22:29:40 +01:00
JingMatrix c5ff4c0e3a Abandon PLT hook for LSPlant
See the previous commit for reasons.
2024-12-04 11:55:28 +01:00
JingMatrix cc26efe6d3 Fix pltHook parameters
Moreover, we may need to abandon PLT hooks in the future.
Currently, there aren't many symbols found in the section .dynsym that
are hooked targets of LSPlant, and more of them are found in the .symtab
section.

In Android 16 DP1, hooked art symbols in .dynsym (thus could be hooked
using the PLT hook) are:
1. _ZN3art6mirror5Class9SetStatusENS_6HandleIS1_EENS_11ClassStatusEPNS_6ThreadE
2. _ZN3art3jit12JitCodeCache12DoCollectionEPNS_6ThreadE
, while symbols in .symtab (must be hooked using inline hook) are:
1. _ZN3art11ClassLinker22FixupStaticTrampolinesEPNS_6ThreadENS_6ObjPtrINS_6mirror5ClassEEE
2. _ZN3art11ClassLinker14RegisterNativeEPNS_6ThreadEPNS_9ArtMethodEPKv
3. _ZN3art11ClassLinker16UnregisterNativeEPNS_6ThreadEPNS_9ArtMethodE
4. _ZN3art11ClassLinker26VisiblyInitializedCallback22MarkVisiblyInitializedEPNS_6ThreadE

Hence, PLT hooks no longer provide sufficient advantages over inline
hooks. Also, we may consider using shadowhook to replace Doddy for the
arm CPU archs.
2024-12-04 10:31:00 +01:00
JingMatrix 46cdc126bd Keep libart.so cache after HookBridge
The previous commit 5da38f60a2 is not
complete since `GetArt(true)` will destroy the static SandHook::ElfImg
object.

Since in the previous two commits we have postponed the initialization
of LSPlant, we can now keep the symbol cache of `libart` for the
InitArtHooker call in method `OnNativeForkSystemServerPost`. Symbol
cache works because we are using local static object in the function
`GetArt`, whose life-cycle is not constraint by the function block.
2024-12-02 17:11:28 +01:00
JingMatrix 3c020a9cd7 Partially revert the previous commit
Current commit will restore the modifications 1,4 in the previous
commit 156c6ae855. Thanks for people in
the community, @privacyguy123, @aviraxp and @HuskyDG, just to name a
few, to notice my sever mistakes.

Those mistakes are mainly caused by my inconsistent usage of testing
environments. I wrongly compared the detecting results with different
`Zygisk` implementations and was too assertive and careless to make those
changes. Here is the explanation for reverting the previous commit:
1. `system.prop` is not extracted for Android 1O+ devices in
   `customize.sh`;
2. mounting /data/resource-cache is still needed in some systems
   (ColorOS, to be confirmed), and it isn't a detection point.

To verify that modifications 2,3 are effective, I tested them with `Zygisk
Next` 1.2.4 (445-031a64c-release) and `Holmes` V1.5.1 Narcissus on
`Magisk` a34c04f9 280002.
2024-12-02 12:38:58 +01:00
JingMatrix 156c6ae855 Remove some traces left by LSPosed
1. Avoid changing `system.prop`: there is already no need to add
   system-wise `dex2oat` flags, since LSPosed provides a wrapper for it,
   see https://nullptr.icu/index.php/archives/53/ for detailed
   explanation;
2. Postpone initialization of LSPlant: initialization of `initInfo`
   during the `onLoad` Zygisk api will change the order of parsed files
   in memory, especially bring the item `libart.so` forward;
3. Close opened virtual map file: this should no longer be a problem
   after the second point is applied since it is no longer opened during
   `onLoad`, but let us close it as a good practice;
4. Remove /data/resource-cache mount: introduced in
   https://github.com/LSPosed/LSPosed/pull/1627, most likely designed to
   solve problems in early versions of root solutions and being reverted
   does not change the function of deamon since we will have to wait
   sufficient time in `waitSystemService` of `LSPosedService` manager.
   Of course, more tests are neeeded on different devices to see if
   parasitic notification manager will work as expected.
2024-12-02 10:15:44 +01:00
JingMatrix 466b3a4aee
Strip logs if verbose log is disabled (#101)
When the `Disable verbose log` option is toggled, more logs are stripped to avoid detections based on log entries.
2024-11-25 22:28:34 +01:00
JingMatrix 5da38f60a2 Avoid parsing libart for multiple times
Use GetArt instead of parsing the lib anew.
2024-11-21 09:29:53 +01:00
Keeperorowner be2342194c
Add action.sh to open LSPosed manager (#74)
* Update customize.sh

* Create action.sh

* Keep WebUI as fallback

---------

Co-authored-by: JingMatrix <jingmatrix@gmail.com>
2024-10-31 15:02:28 +01:00
JingMatrix ff04a68822
Fix CallBooleanMethodV hook of exec_transact (#71)
* Revert "use shared memory"

This reverts commit 44570c5ed0.

* Revert "fix manager not detected"

This reverts commit 9125b4b2f1.

Close #69 as fixed.
2024-10-17 18:46:01 +02:00
JingMatrix 5f20d7ab75 Android 15 is released 2024-10-16 11:06:16 +02:00
Captain Throwback 92cbed418e Start service daemon in late_start mode (#57)
1. Starting daemon during post-fs-data can cause Play Integrity detection
   for devices without the PlayIntegrityFix module.
2. Starting LSPosed service daemon in post-fs-data mode is redundant on
   many devices
2024-10-08 03:05:03 +02:00
JingMatrix bb869eac2d Fix implementation of UnhookPLT
Currently, inline_unhooker is not used in the code.
We still fix the logic to avoid confusion.

There is no feasible way to determinate if the parameter original is a
valid function pointer or a `const char` pointer.
We suppose it as a char pointer in the first step.
2024-09-23 15:58:40 +02:00
JingMatrix 534e3930ae Use PLT hook from Zygisk API(v4) 2024-09-23 11:10:37 +02:00
JingMatrix 4d8e01176f Remove Riru support
The repository RikkaApps/Riru is archived since Jan 8, 2024, which
recommends Zygisk as its alternative.
2024-09-23 11:10:25 +02:00
JingMatrix ea2e1c8518 Update to Zygisk API v4
Skip checking magisk version on KernelSU or APatch
Close #44 as completed
2024-09-23 11:10:03 +02:00
JingMatrix e28e194682 Indicate plt hook explicitly
The file magisk_loader.cpp is reformatted using clangd
2024-09-12 15:19:28 +02:00
JingMatrix 1d7de6c78e Avoid resolving `libart` symbols twice
LSPlt is only used to hook libart symbols.
The file `native_util.h` is reformatted by clangd.
Fallback to Dobby if LSPlt fails.
2024-09-12 11:30:15 +02:00
JingMatrix 42cf1c2fd5 [skip ci] Replace submodule Dobby by LSPlt
It remains to implement HookFunction and UnhookFunction with LSPlt
2024-08-31 05:36:57 +02:00
JingMatrix 16c09cefce Fix LSPosed-Bridge log TAG 2024-08-31 02:43:25 +02:00
JingMatrix f8409ad34b Open parasitic manager through WebUI
Open the parasitic manager using WebUI of KernelSU / APtach.
In the future the web page could become an alternative manager,
without parasitic manager at all.

See https://github.com/mywalkb/LSPosed_mod/issues/65 for details.

Co-authored-by: mywalk <66966897+mywalkb@users.noreply.github.com>
2024-08-31 02:43:25 +02:00
5ec1cff 201af3f165 use Theme_DeviceDefault_Settings 2024-08-31 02:43:25 +02:00
5ec1cff 571655dc0a support lower versions and fix activityInfo pollution 2024-08-31 02:43:25 +02:00
5ec1cff 8c0fb4f5eb temporary fix for A14 QPR3 2024-08-31 02:43:25 +02:00
5ec1cff 41eb1c63ad new parasitic manager 2024-08-31 02:43:25 +02:00
5ec1cff 44570c5ed0 use shared memory 2024-08-31 02:43:24 +02:00
5ec1cff c5d7b32cc0 ignore binder transactions flooding 2024-08-31 02:43:08 +02:00
JingMatrix 9df0af313f Update dobby dependency
Note that RS_SUCCESS = 0 is removed in the commit
f4643b8d14d7cc94516b446ca77d952d0b986d50
of https://github.com/jmpews/Dobby

The CMake option DOBBY_GENERATE_SHARED is removed, we use dobby_static
explicitly.
2024-08-27 01:50:17 +02:00
JingMatrix bdba029fe9 Update repo info 2024-07-27 10:40:27 +02:00
JingMatrix 4666b13013 Annonce support for Android 15 Beta 4 2024-07-24 01:41:02 +02:00
JingMatrix 17625a04d5 Fix CMake syntax error
Update cmake version
2024-07-24 01:23:05 +02:00
JingMatrix 2e0de88eca Apply patch da1daf of mywalkb/LSPosed_mod
From Android 14 QPR3 and forward, the classloader of injected app (com.android.shell)
does not contain the apk manager, so in hook getClassLoader there is a new check when
it got a negative response the apk manager is injected in classloader, so parasitic
manager can start correctly.

Co-authored-by: mywalk <66966897+mywalkb@users.noreply.github.com>
2024-07-24 01:22:43 +02:00
JingMatrix 8e96b8de21 Replace axml by WindySha/ManifestEditor 2024-05-18 23:48:50 +02:00
JingMatrix 0a935413fc Adjust proguard for Android R8
1. Use JDK 21
2. Update android plugins for JDK 21
3. Update gradle wrapper

The new R8 engine will change more class names than before, we thus
need to save those needed ones.
2024-05-18 23:48:43 +02:00