mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 21:27:41 +02:00
Add preliminary zygote code injection support
Prototyping the injection setup and a clean "self unloading" mechanism.
This commit is contained in:
@ -113,12 +113,12 @@ int exec_command_sync(exec_t &exec) {
|
||||
return WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
int new_daemon_thread(thread_entry entry, void *arg, const pthread_attr_t *attr) {
|
||||
int new_daemon_thread(thread_entry entry, void *arg) {
|
||||
pthread_t thread;
|
||||
int ret = xpthread_create(&thread, attr, entry, arg);
|
||||
if (ret == 0)
|
||||
pthread_detach(thread);
|
||||
return ret;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
return xpthread_create(&thread, &attr, entry, arg);
|
||||
}
|
||||
|
||||
static void *proxy_routine(void *fp) {
|
||||
|
@ -59,7 +59,7 @@ static inline int parse_int(const std::string &s) { return parse_int(s.data());
|
||||
static inline int parse_int(std::string_view s) { return parse_int(s.data()); }
|
||||
|
||||
using thread_entry = void *(*)(void *);
|
||||
int new_daemon_thread(thread_entry entry, void *arg = nullptr, const pthread_attr_t *attr = nullptr);
|
||||
int new_daemon_thread(thread_entry entry, void *arg = nullptr);
|
||||
int new_daemon_thread(std::function<void()> &&entry);
|
||||
|
||||
static inline bool str_contains(std::string_view s, std::string_view ss) {
|
||||
|
@ -64,3 +64,4 @@ long xptrace(int request, pid_t pid, void *addr = nullptr, void *data = nullptr)
|
||||
static inline long xptrace(int request, pid_t pid, void *addr, uintptr_t data) {
|
||||
return xptrace(request, pid, addr, reinterpret_cast<void *>(data));
|
||||
}
|
||||
#define WEVENT(s) (((s) & 0xffff0000) >> 16)
|
||||
|
Reference in New Issue
Block a user