You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Update magiskpolicy
This commit is contained in:
@@ -63,6 +63,7 @@ LOCAL_MODULE := magiskinit
|
|||||||
LOCAL_STATIC_LIBRARIES := libsepol liblzma
|
LOCAL_STATIC_LIBRARIES := libsepol liblzma
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
jni/include \
|
jni/include \
|
||||||
|
jni/magiskpolicy \
|
||||||
out/$(TARGET_ARCH_ABI) \
|
out/$(TARGET_ARCH_ABI) \
|
||||||
$(LIBSEPOL) \
|
$(LIBSEPOL) \
|
||||||
$(LIBLZMA)
|
$(LIBLZMA)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "magisk.h"
|
#include "magisk.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "daemon.h"
|
#include "daemon.h"
|
||||||
#include "magiskpolicy.h"
|
|
||||||
#include "resetprop.h"
|
#include "resetprop.h"
|
||||||
|
|
||||||
pthread_t sepol_patch;
|
pthread_t sepol_patch;
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ static void patch_sepolicy() {
|
|||||||
compile_cil();
|
compile_cil();
|
||||||
}
|
}
|
||||||
|
|
||||||
sepol_med_rules();
|
sepol_magisk_rules();
|
||||||
dump_policydb("/sepolicy");
|
dump_policydb("/sepolicy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,6 +345,8 @@ static int dump_magiskrc(const char *path, mode_t mode) {
|
|||||||
|
|
||||||
static void magisk_init_daemon() {
|
static void magisk_init_daemon() {
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
|
// Full patch
|
||||||
sepol_allow("su", ALL, ALL, ALL);
|
sepol_allow("su", ALL, ALL, ALL);
|
||||||
|
|
||||||
// Wait till init cold boot done
|
// Wait till init cold boot done
|
||||||
@@ -358,7 +360,7 @@ static void magisk_init_daemon() {
|
|||||||
|
|
||||||
// Dump full patch to kernel
|
// Dump full patch to kernel
|
||||||
dump_policydb(SELINUX_LOAD);
|
dump_policydb(SELINUX_LOAD);
|
||||||
close(open(PATCHDONE, O_RDONLY | O_CREAT, 0));
|
close(creat(PATCHDONE, 0));
|
||||||
destroy_policydb();
|
destroy_policydb();
|
||||||
|
|
||||||
// Keep Magisk daemon always alive
|
// Keep Magisk daemon always alive
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
/* magiskpolicy.h - Public API for policy patching
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _MAGISKPOLICY_H
|
|
||||||
#define _MAGISKPOLICY_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define ALL NULL
|
|
||||||
|
|
||||||
// policydb functions
|
|
||||||
int load_policydb(const char *filename);
|
|
||||||
int dump_policydb(const char *filename);
|
|
||||||
void destroy_policydb();
|
|
||||||
|
|
||||||
// Handy functions
|
|
||||||
int sepol_allow(char *s, char *t, char *c, char *p);
|
|
||||||
int sepol_deny(char *s, char *t, char *c, char *p);
|
|
||||||
int sepol_auditallow(char *s, char *t, char *c, char *p);
|
|
||||||
int sepol_auditdeny(char *s, char *t, char *c, char *p);
|
|
||||||
int sepol_typetrans(char *s, char *t, char *c, char *d, char *o);
|
|
||||||
int sepol_allowxperm(char *s, char *t, char *c, char *range);
|
|
||||||
int sepol_auditallowxperm(char *s, char *t, char *c, char *range);
|
|
||||||
int sepol_dontauditxperm(char *s, char *t, char *c, char *range);
|
|
||||||
int sepol_create(char *s);
|
|
||||||
int sepol_permissive(char *s);
|
|
||||||
int sepol_enforce(char *s);
|
|
||||||
int sepol_attradd(char *s, char *a);
|
|
||||||
int sepol_exists(char *source);
|
|
||||||
|
|
||||||
// Built in rules
|
|
||||||
void sepol_min_rules();
|
|
||||||
void sepol_med_rules();
|
|
||||||
void sepol_full_rules();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Submodule jni/magiskpolicy updated: 8ee9984e4e...d7a6127273
Reference in New Issue
Block a user