mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-28 14:27:37 +00:00
Update magiskpolicy
This commit is contained in:
parent
997d58932e
commit
e989195a68
@ -63,6 +63,7 @@ LOCAL_MODULE := magiskinit
|
||||
LOCAL_STATIC_LIBRARIES := libsepol liblzma
|
||||
LOCAL_C_INCLUDES := \
|
||||
jni/include \
|
||||
jni/magiskpolicy \
|
||||
out/$(TARGET_ARCH_ABI) \
|
||||
$(LIBSEPOL) \
|
||||
$(LIBLZMA)
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "magisk.h"
|
||||
#include "utils.h"
|
||||
#include "daemon.h"
|
||||
#include "magiskpolicy.h"
|
||||
#include "resetprop.h"
|
||||
|
||||
pthread_t sepol_patch;
|
||||
|
@ -299,7 +299,7 @@ static void patch_sepolicy() {
|
||||
compile_cil();
|
||||
}
|
||||
|
||||
sepol_med_rules();
|
||||
sepol_magisk_rules();
|
||||
dump_policydb("/sepolicy");
|
||||
}
|
||||
|
||||
@ -345,6 +345,8 @@ static int dump_magiskrc(const char *path, mode_t mode) {
|
||||
|
||||
static void magisk_init_daemon() {
|
||||
setsid();
|
||||
|
||||
// Full patch
|
||||
sepol_allow("su", ALL, ALL, ALL);
|
||||
|
||||
// Wait till init cold boot done
|
||||
@ -358,7 +360,7 @@ static void magisk_init_daemon() {
|
||||
|
||||
// Dump full patch to kernel
|
||||
dump_policydb(SELINUX_LOAD);
|
||||
close(open(PATCHDONE, O_RDONLY | O_CREAT, 0));
|
||||
close(creat(PATCHDONE, 0));
|
||||
destroy_policydb();
|
||||
|
||||
// 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
|
@ -1 +1 @@
|
||||
Subproject commit 8ee9984e4e0a0ce1917d4b131205c79a15f85876
|
||||
Subproject commit d7a6127273407a32bccf75e70fa7bbe84c14e4f8
|
Loading…
x
Reference in New Issue
Block a user