You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
remove: ReZygiskd dl.c
This commit removes the "dl.c" file, which was used for using "android_dlopen_ext" in a new namespace, used to isolate libraries, which is not necessary here as they are on different processes, hence "dlopen" can be used.
This commit is contained in:
@@ -51,7 +51,6 @@ val Files = arrayOf(
|
||||
"root_impl/kernelsu.c",
|
||||
"root_impl/magisk.c",
|
||||
"companion.c",
|
||||
"dl.c",
|
||||
"main.c",
|
||||
"utils.c",
|
||||
"zygiskd.c"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "dl.h"
|
||||
#include "utils.h"
|
||||
|
||||
#undef LOG_TAG
|
||||
@@ -32,7 +31,7 @@ zygisk_companion_entry load_module(int fd) {
|
||||
char path[PATH_MAX];
|
||||
snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
|
||||
|
||||
void *handle = dlopen_ext(path, RTLD_NOW);
|
||||
void *handle = dlopen(path, RTLD_NOW);
|
||||
|
||||
if (!handle) return NULL;
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android/dlext.h>
|
||||
|
||||
#include "companion.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define __LOADER_ANDROID_CREATE_NAMESPACE_TYPE(name) struct android_namespace_t *(*name)( \
|
||||
const char *name, \
|
||||
const char *ld_library_path, \
|
||||
const char *default_library_path, \
|
||||
uint64_t type, \
|
||||
const char *permitted_when_isolated_path, \
|
||||
struct android_namespace_t *parent, \
|
||||
const void *caller_addr)
|
||||
|
||||
void *dlopen_ext(const char* path, int flags) {
|
||||
android_dlextinfo info = { 0 };
|
||||
char *dir = dirname(path);
|
||||
|
||||
__LOADER_ANDROID_CREATE_NAMESPACE_TYPE(__loader_android_create_namespace) = (__LOADER_ANDROID_CREATE_NAMESPACE_TYPE( ))dlsym(RTLD_DEFAULT, "__loader_android_create_namespace");
|
||||
|
||||
struct android_namespace_t *ns = __loader_android_create_namespace == NULL ? NULL :
|
||||
__loader_android_create_namespace(path, dir, NULL,
|
||||
2, /* ANDROID_NAMESPACE_TYPE_SHARED */
|
||||
NULL, NULL,
|
||||
(void *)&dlopen_ext);
|
||||
|
||||
if (ns) {
|
||||
info.flags = ANDROID_DLEXT_USE_NAMESPACE;
|
||||
info.library_namespace = ns;
|
||||
|
||||
LOGI("Open %s with namespace %p", path, (void *)ns);
|
||||
} else {
|
||||
LOGW("Cannot create namespace for %s", path);
|
||||
}
|
||||
|
||||
void *handle = android_dlopen_ext(path, flags, &info);
|
||||
if (handle) {
|
||||
LOGI("dlopen %s: %p", path, handle);
|
||||
} else {
|
||||
LOGE("dlopen %s: %s", path, dlerror());
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef DL_H
|
||||
#define DL_H
|
||||
|
||||
void *dlopen_ext(char *path, int flags);
|
||||
|
||||
#endif /* DL_H */
|
||||
Reference in New Issue
Block a user