mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-25 02:55:33 +00:00
No need _orig to call backup
This commit is contained in:
parent
de7e5bdfe7
commit
f247759a6e
@ -54,7 +54,7 @@ class Method:
|
|||||||
args = ''.join(map(lambda x: x.type.jni, self.args))
|
args = ''.join(map(lambda x: x.type.jni, self.args))
|
||||||
return f'({args}){self.ret.type.jni}'
|
return f'({args}){self.ret.type.jni}'
|
||||||
|
|
||||||
def body(self):
|
def body(self, name, i):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
class JNIHook(Method):
|
class JNIHook(Method):
|
||||||
@ -65,8 +65,8 @@ class JNIHook(Method):
|
|||||||
def base_name(self):
|
def base_name(self):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def orig_method(self):
|
def orig_method(self, name, i):
|
||||||
return f'reinterpret_cast<decltype(&{self.name})>({self.base_name()}_orig)'
|
return f'reinterpret_cast<{self.ret.type.cpp}(*)(JNIEnv *env, jclass clazz, {self.cpp()})>({name}_methods[{i}].fnPtr)'
|
||||||
|
|
||||||
def ind(i):
|
def ind(i):
|
||||||
return '\n' + ' ' * i
|
return '\n' + ' ' * i
|
||||||
@ -89,18 +89,18 @@ class ForkAndSpec(JNIHook):
|
|||||||
def init_args(self):
|
def init_args(self):
|
||||||
return 'AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);'
|
return 'AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);'
|
||||||
|
|
||||||
def body(self):
|
def body(self, name, i):
|
||||||
decl = ''
|
decl = ''
|
||||||
decl += ind(1) + self.init_args()
|
decl += ind(3) + self.init_args()
|
||||||
for a in self.args:
|
for a in self.args:
|
||||||
if a.set_arg:
|
if a.set_arg:
|
||||||
decl += ind(1) + f'args.{a.name} = &{a.name};'
|
decl += ind(3) + f'args.{a.name} = &{a.name};'
|
||||||
decl += ind(1) + 'ZygiskContext ctx(env, &args);'
|
decl += ind(3) + 'ZygiskContext ctx(env, &args);'
|
||||||
decl += ind(1) + f'ctx.{self.base_name()}_pre();'
|
decl += ind(3) + f'ctx.{self.base_name()}_pre();'
|
||||||
decl += ind(1) + self.orig_method() + '('
|
decl += ind(3) + self.orig_method(name, i) + '('
|
||||||
decl += ind(2) + f'env, clazz, {self.name_list()}'
|
decl += ind(4) + f'env, clazz, {self.name_list()}'
|
||||||
decl += ind(1) + ');'
|
decl += ind(3) + ');'
|
||||||
decl += ind(1) + f'ctx.{self.base_name()}_post();'
|
decl += ind(3) + f'ctx.{self.base_name()}_post();'
|
||||||
return decl
|
return decl
|
||||||
|
|
||||||
class SpecApp(ForkAndSpec):
|
class SpecApp(ForkAndSpec):
|
||||||
@ -210,33 +210,23 @@ server_l = ForkServer('l', [uid, gid, gids, runtime_flags, rlimits,
|
|||||||
server_samsung_q = ForkServer('samsung_q', [uid, gid, gids, runtime_flags, Anon(jint), Anon(jint), rlimits,
|
server_samsung_q = ForkServer('samsung_q', [uid, gid, gids, runtime_flags, Anon(jint), Anon(jint), rlimits,
|
||||||
permitted_capabilities, effective_capabilities])
|
permitted_capabilities, effective_capabilities])
|
||||||
|
|
||||||
hook_map = {}
|
def gen_jni_def(name, clz, methods):
|
||||||
|
|
||||||
def gen_jni_def(clz, methods):
|
|
||||||
if clz not in hook_map:
|
|
||||||
hook_map[clz] = []
|
|
||||||
|
|
||||||
decl = ''
|
decl = ''
|
||||||
for m in methods:
|
decl += ind(0) + f'constexpr auto {name}_class = "{clz}";'
|
||||||
decl += ind(0) + f'[[clang::no_stack_protector]] {m.ret.type.cpp} {m.name}(JNIEnv *env, jclass clazz, {m.cpp()}) {{'
|
decl += ind(0) + f'std::array<JNINativeMethod, {len(methods)}> {name}_methods = {{{{'
|
||||||
decl += m.body()
|
for i, m in enumerate(methods):
|
||||||
if m.ret.value:
|
decl += ind(1) + '{'
|
||||||
decl += ind(1) + f'return {m.ret.value};'
|
|
||||||
decl += ind(0) + '}'
|
|
||||||
|
|
||||||
decl += ind(0) + f'std::array {m.base_name()}_methods = {{'
|
|
||||||
for m in methods:
|
|
||||||
decl += ind(1) + 'JNINativeMethod {'
|
|
||||||
decl += ind(2) + f'"{m.base_name()}",'
|
decl += ind(2) + f'"{m.base_name()}",'
|
||||||
decl += ind(2) + f'"{m.jni()}",'
|
decl += ind(2) + f'"{m.jni()}",'
|
||||||
decl += ind(2) + f'(void *) &{m.name}'
|
decl += ind(2) + f'(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, {m.cpp()}) static -> {m.ret.type.cpp} {{'
|
||||||
|
decl += m.body(name, i)
|
||||||
|
if m.ret.value:
|
||||||
|
decl += ind(3) + f'return {m.ret.value};'
|
||||||
|
decl += ind(2) + '}'
|
||||||
decl += ind(1) + '},'
|
decl += ind(1) + '},'
|
||||||
decl += ind(0) + '};'
|
decl += ind(0) + '}};'
|
||||||
decl = ind(0) + f'void *{m.base_name()}_orig = nullptr;' + decl
|
|
||||||
decl += ind(0)
|
decl += ind(0)
|
||||||
|
|
||||||
hook_map[clz].append(m.base_name())
|
|
||||||
|
|
||||||
return decl
|
return decl
|
||||||
|
|
||||||
with open('jni_hooks.hpp', 'w') as f:
|
with open('jni_hooks.hpp', 'w') as f:
|
||||||
@ -245,13 +235,8 @@ with open('jni_hooks.hpp', 'w') as f:
|
|||||||
|
|
||||||
zygote = 'com/android/internal/os/Zygote'
|
zygote = 'com/android/internal/os/Zygote'
|
||||||
|
|
||||||
methods = [fas_l, fas_o, fas_p, fas_q_alt, fas_r, fas_u, fas_samsung_m, fas_samsung_n, fas_samsung_o, fas_samsung_p]
|
f.write(gen_jni_def('zygote', zygote, [
|
||||||
f.write(gen_jni_def(zygote, methods))
|
fas_l, fas_o, fas_p, fas_q_alt, fas_r, fas_u, fas_samsung_m, fas_samsung_n, fas_samsung_o,
|
||||||
|
fas_samsung_p, spec_q, spec_q_alt, spec_r, spec_u, spec_samsung_q, server_l, server_samsung_q]))
|
||||||
methods = [spec_q, spec_q_alt, spec_r, spec_u, spec_samsung_q]
|
|
||||||
f.write(gen_jni_def(zygote, methods))
|
|
||||||
|
|
||||||
methods = [server_l, server_samsung_q]
|
|
||||||
f.write(gen_jni_def(zygote, methods))
|
|
||||||
|
|
||||||
f.write('\n} // namespace\n')
|
f.write('\n} // namespace\n')
|
||||||
|
@ -116,7 +116,6 @@ HookContext *g_hook;
|
|||||||
bool should_unmap_zygisk = false;
|
bool should_unmap_zygisk = false;
|
||||||
void *self_handle = nullptr;
|
void *self_handle = nullptr;
|
||||||
constexpr const char *kZygiskInit = "com.android.internal.os.ZygoteInit";
|
constexpr const char *kZygiskInit = "com.android.internal.os.ZygoteInit";
|
||||||
constexpr const char *kZygote = "com/android/internal/os/Zygote";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
@ -440,10 +439,6 @@ void HookContext::restore_plt_hook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
#define HOOK_JNI(method) \
|
|
||||||
hookJniNativeMethods(env, kZygote, method##_methods.data(), method##_methods.size()); \
|
|
||||||
for (auto m: method##_methods) if (m.fnPtr) { method##_orig = m.fnPtr; break; }
|
|
||||||
|
|
||||||
void HookContext::replace_jni_methods() {
|
void HookContext::replace_jni_methods() {
|
||||||
using method_sig = jint(*)(JavaVM **, jsize, jsize *);
|
using method_sig = jint(*)(JavaVM **, jsize, jsize *);
|
||||||
auto get_created_vms = reinterpret_cast<method_sig>(
|
auto get_created_vms = reinterpret_cast<method_sig>(
|
||||||
@ -478,15 +473,11 @@ void HookContext::replace_jni_methods() {
|
|||||||
if (res != JNI_OK || env == nullptr) {
|
if (res != JNI_OK || env == nullptr) {
|
||||||
ZLOGW("JNIEnv not found\n");
|
ZLOGW("JNIEnv not found\n");
|
||||||
}
|
}
|
||||||
HOOK_JNI(nativeForkAndSpecialize);
|
hookJniNativeMethods(env, zygote_class, zygote_methods.data(), zygote_methods.size());
|
||||||
HOOK_JNI(nativeSpecializeAppProcess);
|
|
||||||
HOOK_JNI(nativeForkSystemServer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HookContext::restore_jni_hook(JNIEnv *env) {
|
void HookContext::restore_jni_hook(JNIEnv *env) {
|
||||||
hookJniNativeMethods(env, kZygote, nativeForkAndSpecialize_methods.data(), nativeForkAndSpecialize_methods.size());
|
hookJniNativeMethods(env, zygote_class, zygote_methods.data(), zygote_methods.size());
|
||||||
hookJniNativeMethods(env, kZygote, nativeSpecializeAppProcess_methods.data(), nativeSpecializeAppProcess_methods.size());
|
|
||||||
hookJniNativeMethods(env, kZygote, nativeForkSystemServer_methods.data(), nativeForkSystemServer_methods.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
@ -2,307 +2,282 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void *nativeForkAndSpecialize_orig = nullptr;
|
constexpr auto zygote_class = "com/android/internal/os/Zygote";
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_l(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir) {
|
std::array<JNINativeMethod, 17> zygote_methods = {{
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
{
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_l)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_o(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_o)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_p(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_p)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_q_alt(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
args.is_top_app = &is_top_app;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_q_alt)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir, is_top_app
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_r(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
args.is_top_app = &is_top_app;
|
|
||||||
args.pkg_data_info_list = &pkg_data_info_list;
|
|
||||||
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
|
||||||
args.mount_data_dirs = &mount_data_dirs;
|
|
||||||
args.mount_storage_dirs = &mount_storage_dirs;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_r)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_u(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs, jboolean mount_sysprop_overrides) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
args.is_top_app = &is_top_app;
|
|
||||||
args.pkg_data_info_list = &pkg_data_info_list;
|
|
||||||
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
|
||||||
args.mount_data_dirs = &mount_data_dirs;
|
|
||||||
args.mount_storage_dirs = &mount_storage_dirs;
|
|
||||||
args.mount_sysprop_overrides = &mount_sysprop_overrides;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_u)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs, mount_sysprop_overrides
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_samsung_m(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _0, jint _1, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_samsung_m)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _0, _1, nice_name, fds_to_close, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_samsung_n(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _2, jint _3, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir, jint _4) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_samsung_n)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _2, _3, nice_name, fds_to_close, instruction_set, app_data_dir, _4
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_samsung_o(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _5, jint _6, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_samsung_o)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _5, _6, nice_name, fds_to_close, fds_to_ignore, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkAndSpecialize_samsung_p(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _7, jint _8, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.fds_to_ignore = &fds_to_ignore;
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkAndSpecialize_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkAndSpecialize_samsung_p)>(nativeForkAndSpecialize_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _7, _8, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeForkAndSpecialize_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
std::array nativeForkAndSpecialize_methods = {
|
|
||||||
JNINativeMethod {
|
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I",
|
||||||
(void *) &nativeForkAndSpecialize_l
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir)>(zygote_methods[0].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[ILjava/lang/String;Ljava/lang/String;)I",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[ILjava/lang/String;Ljava/lang/String;)I",
|
||||||
(void *) &nativeForkAndSpecialize_o
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jstring instruction_set, jstring app_data_dir) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jstring instruction_set, jstring app_data_dir)>(zygote_methods[1].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
|
||||||
(void *) &nativeForkAndSpecialize_p
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir)>(zygote_methods[2].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;Z)I",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;Z)I",
|
||||||
(void *) &nativeForkAndSpecialize_q_alt
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
args.is_top_app = &is_top_app;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app)>(zygote_methods[3].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir, is_top_app
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZ)I",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZ)I",
|
||||||
(void *) &nativeForkAndSpecialize_r
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
args.is_top_app = &is_top_app;
|
||||||
|
args.pkg_data_info_list = &pkg_data_info_list;
|
||||||
|
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
||||||
|
args.mount_data_dirs = &mount_data_dirs;
|
||||||
|
args.mount_storage_dirs = &mount_storage_dirs;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs)>(zygote_methods[4].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZZ)I",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZZ)I",
|
||||||
(void *) &nativeForkAndSpecialize_u
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs, jboolean mount_sysprop_overrides) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
args.is_top_app = &is_top_app;
|
||||||
|
args.pkg_data_info_list = &pkg_data_info_list;
|
||||||
|
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
||||||
|
args.mount_data_dirs = &mount_data_dirs;
|
||||||
|
args.mount_storage_dirs = &mount_storage_dirs;
|
||||||
|
args.mount_sysprop_overrides = &mount_sysprop_overrides;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs, jboolean mount_sysprop_overrides)>(zygote_methods[5].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs, mount_sysprop_overrides
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;IILjava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I",
|
"(II[II[[IILjava/lang/String;IILjava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I",
|
||||||
(void *) &nativeForkAndSpecialize_samsung_m
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _0, jint _1, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _0, jint _1, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir)>(zygote_methods[6].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _0, _1, nice_name, fds_to_close, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;IILjava/lang/String;[ILjava/lang/String;Ljava/lang/String;I)I",
|
"(II[II[[IILjava/lang/String;IILjava/lang/String;[ILjava/lang/String;Ljava/lang/String;I)I",
|
||||||
(void *) &nativeForkAndSpecialize_samsung_n
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _2, jint _3, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir, jint _4) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _2, jint _3, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir, jint _4)>(zygote_methods[7].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _2, _3, nice_name, fds_to_close, instruction_set, app_data_dir, _4
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;IILjava/lang/String;[I[ILjava/lang/String;Ljava/lang/String;)I",
|
"(II[II[[IILjava/lang/String;IILjava/lang/String;[I[ILjava/lang/String;Ljava/lang/String;)I",
|
||||||
(void *) &nativeForkAndSpecialize_samsung_o
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _5, jint _6, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jstring instruction_set, jstring app_data_dir) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _5, jint _6, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jstring instruction_set, jstring app_data_dir)>(zygote_methods[8].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _5, _6, nice_name, fds_to_close, fds_to_ignore, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkAndSpecialize",
|
"nativeForkAndSpecialize",
|
||||||
"(II[II[[IILjava/lang/String;IILjava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
|
"(II[II[[IILjava/lang/String;IILjava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
|
||||||
(void *) &nativeForkAndSpecialize_samsung_p
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _7, jint _8, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) static -> jint {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.fds_to_ignore = &fds_to_ignore;
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkAndSpecialize_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _7, jint _8, jstring nice_name, jintArray fds_to_close, jintArray fds_to_ignore, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir)>(zygote_methods[9].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _7, _8, nice_name, fds_to_close, fds_to_ignore, is_child_zygote, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeForkAndSpecialize_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
{
|
||||||
|
|
||||||
void *nativeSpecializeAppProcess_orig = nullptr;
|
|
||||||
[[clang::no_stack_protector]] void nativeSpecializeAppProcess_q(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeSpecializeAppProcess_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeSpecializeAppProcess_q)>(nativeSpecializeAppProcess_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeSpecializeAppProcess_post();
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] void nativeSpecializeAppProcess_q_alt(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
args.is_top_app = &is_top_app;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeSpecializeAppProcess_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeSpecializeAppProcess_q_alt)>(nativeSpecializeAppProcess_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir, is_top_app
|
|
||||||
);
|
|
||||||
ctx.nativeSpecializeAppProcess_post();
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] void nativeSpecializeAppProcess_r(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
args.is_top_app = &is_top_app;
|
|
||||||
args.pkg_data_info_list = &pkg_data_info_list;
|
|
||||||
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
|
||||||
args.mount_data_dirs = &mount_data_dirs;
|
|
||||||
args.mount_storage_dirs = &mount_storage_dirs;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeSpecializeAppProcess_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeSpecializeAppProcess_r)>(nativeSpecializeAppProcess_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs
|
|
||||||
);
|
|
||||||
ctx.nativeSpecializeAppProcess_post();
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] void nativeSpecializeAppProcess_u(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs, jboolean mount_sysprop_overrides) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
args.is_top_app = &is_top_app;
|
|
||||||
args.pkg_data_info_list = &pkg_data_info_list;
|
|
||||||
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
|
||||||
args.mount_data_dirs = &mount_data_dirs;
|
|
||||||
args.mount_storage_dirs = &mount_storage_dirs;
|
|
||||||
args.mount_sysprop_overrides = &mount_sysprop_overrides;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeSpecializeAppProcess_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeSpecializeAppProcess_u)>(nativeSpecializeAppProcess_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs, mount_sysprop_overrides
|
|
||||||
);
|
|
||||||
ctx.nativeSpecializeAppProcess_post();
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] void nativeSpecializeAppProcess_samsung_q(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _9, jint _10, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) {
|
|
||||||
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
|
||||||
args.is_child_zygote = &is_child_zygote;
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeSpecializeAppProcess_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeSpecializeAppProcess_samsung_q)>(nativeSpecializeAppProcess_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _9, _10, nice_name, is_child_zygote, instruction_set, app_data_dir
|
|
||||||
);
|
|
||||||
ctx.nativeSpecializeAppProcess_post();
|
|
||||||
}
|
|
||||||
std::array nativeSpecializeAppProcess_methods = {
|
|
||||||
JNINativeMethod {
|
|
||||||
"nativeSpecializeAppProcess",
|
"nativeSpecializeAppProcess",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;)V",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;)V",
|
||||||
(void *) &nativeSpecializeAppProcess_q
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) static -> void {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeSpecializeAppProcess_pre();
|
||||||
|
reinterpret_cast<void(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir)>(zygote_methods[10].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeSpecializeAppProcess_post();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeSpecializeAppProcess",
|
"nativeSpecializeAppProcess",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Z)V",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Z)V",
|
||||||
(void *) &nativeSpecializeAppProcess_q_alt
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app) static -> void {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
args.is_top_app = &is_top_app;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeSpecializeAppProcess_pre();
|
||||||
|
reinterpret_cast<void(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app)>(zygote_methods[11].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir, is_top_app
|
||||||
|
);
|
||||||
|
ctx.nativeSpecializeAppProcess_post();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeSpecializeAppProcess",
|
"nativeSpecializeAppProcess",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZ)V",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZ)V",
|
||||||
(void *) &nativeSpecializeAppProcess_r
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs) static -> void {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
args.is_top_app = &is_top_app;
|
||||||
|
args.pkg_data_info_list = &pkg_data_info_list;
|
||||||
|
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
||||||
|
args.mount_data_dirs = &mount_data_dirs;
|
||||||
|
args.mount_storage_dirs = &mount_storage_dirs;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeSpecializeAppProcess_pre();
|
||||||
|
reinterpret_cast<void(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs)>(zygote_methods[12].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs
|
||||||
|
);
|
||||||
|
ctx.nativeSpecializeAppProcess_post();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeSpecializeAppProcess",
|
"nativeSpecializeAppProcess",
|
||||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZZ)V",
|
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/String;ZZZ)V",
|
||||||
(void *) &nativeSpecializeAppProcess_u
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs, jboolean mount_sysprop_overrides) static -> void {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
args.is_top_app = &is_top_app;
|
||||||
|
args.pkg_data_info_list = &pkg_data_info_list;
|
||||||
|
args.whitelisted_data_info_list = &whitelisted_data_info_list;
|
||||||
|
args.mount_data_dirs = &mount_data_dirs;
|
||||||
|
args.mount_storage_dirs = &mount_storage_dirs;
|
||||||
|
args.mount_sysprop_overrides = &mount_sysprop_overrides;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeSpecializeAppProcess_pre();
|
||||||
|
reinterpret_cast<void(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir, jboolean is_top_app, jobjectArray pkg_data_info_list, jobjectArray whitelisted_data_info_list, jboolean mount_data_dirs, jboolean mount_storage_dirs, jboolean mount_sysprop_overrides)>(zygote_methods[13].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, is_child_zygote, instruction_set, app_data_dir, is_top_app, pkg_data_info_list, whitelisted_data_info_list, mount_data_dirs, mount_storage_dirs, mount_sysprop_overrides
|
||||||
|
);
|
||||||
|
ctx.nativeSpecializeAppProcess_post();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeSpecializeAppProcess",
|
"nativeSpecializeAppProcess",
|
||||||
"(II[II[[IILjava/lang/String;IILjava/lang/String;ZLjava/lang/String;Ljava/lang/String;)V",
|
"(II[II[[IILjava/lang/String;IILjava/lang/String;ZLjava/lang/String;Ljava/lang/String;)V",
|
||||||
(void *) &nativeSpecializeAppProcess_samsung_q
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _9, jint _10, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir) static -> void {
|
||||||
|
AppSpecializeArgs_v5 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
|
||||||
|
args.is_child_zygote = &is_child_zygote;
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeSpecializeAppProcess_pre();
|
||||||
|
reinterpret_cast<void(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jint _9, jint _10, jstring nice_name, jboolean is_child_zygote, jstring instruction_set, jstring app_data_dir)>(zygote_methods[14].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, _9, _10, nice_name, is_child_zygote, instruction_set, app_data_dir
|
||||||
|
);
|
||||||
|
ctx.nativeSpecializeAppProcess_post();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
{
|
||||||
|
|
||||||
void *nativeForkSystemServer_orig = nullptr;
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkSystemServer_l(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jlong permitted_capabilities, jlong effective_capabilities) {
|
|
||||||
ServerSpecializeArgs_v1 args(uid, gid, gids, runtime_flags, permitted_capabilities, effective_capabilities);
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkSystemServer_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkSystemServer_l)>(nativeForkSystemServer_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, rlimits, permitted_capabilities, effective_capabilities
|
|
||||||
);
|
|
||||||
ctx.nativeForkSystemServer_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
[[clang::no_stack_protector]] jint nativeForkSystemServer_samsung_q(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jint _11, jint _12, jobjectArray rlimits, jlong permitted_capabilities, jlong effective_capabilities) {
|
|
||||||
ServerSpecializeArgs_v1 args(uid, gid, gids, runtime_flags, permitted_capabilities, effective_capabilities);
|
|
||||||
ZygiskContext ctx(env, &args);
|
|
||||||
ctx.nativeForkSystemServer_pre();
|
|
||||||
reinterpret_cast<decltype(&nativeForkSystemServer_samsung_q)>(nativeForkSystemServer_orig)(
|
|
||||||
env, clazz, uid, gid, gids, runtime_flags, _11, _12, rlimits, permitted_capabilities, effective_capabilities
|
|
||||||
);
|
|
||||||
ctx.nativeForkSystemServer_post();
|
|
||||||
return ctx.pid;
|
|
||||||
}
|
|
||||||
std::array nativeForkSystemServer_methods = {
|
|
||||||
JNINativeMethod {
|
|
||||||
"nativeForkSystemServer",
|
"nativeForkSystemServer",
|
||||||
"(II[II[[IJJ)I",
|
"(II[II[[IJJ)I",
|
||||||
(void *) &nativeForkSystemServer_l
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jlong permitted_capabilities, jlong effective_capabilities) static -> jint {
|
||||||
|
ServerSpecializeArgs_v1 args(uid, gid, gids, runtime_flags, permitted_capabilities, effective_capabilities);
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkSystemServer_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jlong permitted_capabilities, jlong effective_capabilities)>(zygote_methods[15].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, rlimits, permitted_capabilities, effective_capabilities
|
||||||
|
);
|
||||||
|
ctx.nativeForkSystemServer_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
JNINativeMethod {
|
{
|
||||||
"nativeForkSystemServer",
|
"nativeForkSystemServer",
|
||||||
"(II[IIII[[IJJ)I",
|
"(II[IIII[[IJJ)I",
|
||||||
(void *) &nativeForkSystemServer_samsung_q
|
(void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jint _11, jint _12, jobjectArray rlimits, jlong permitted_capabilities, jlong effective_capabilities) static -> jint {
|
||||||
|
ServerSpecializeArgs_v1 args(uid, gid, gids, runtime_flags, permitted_capabilities, effective_capabilities);
|
||||||
|
ZygiskContext ctx(env, &args);
|
||||||
|
ctx.nativeForkSystemServer_pre();
|
||||||
|
reinterpret_cast<jint(*)(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jint _11, jint _12, jobjectArray rlimits, jlong permitted_capabilities, jlong effective_capabilities)>(zygote_methods[16].fnPtr)(
|
||||||
|
env, clazz, uid, gid, gids, runtime_flags, _11, _12, rlimits, permitted_capabilities, effective_capabilities
|
||||||
|
);
|
||||||
|
ctx.nativeForkSystemServer_post();
|
||||||
|
return ctx.pid;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
}};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user