kernel: don't setenforce if kernel is already permissive

This commit is contained in:
weishu
2022-12-12 22:18:59 +07:00
parent a30507dfcc
commit 280660125f
3 changed files with 13 additions and 2 deletions

View File

@@ -44,9 +44,10 @@ bool persistent_allow_list(void);
struct file *permissive_filp_open(const char * path, int flags, umode_t mode) {
struct file* fp;
// fixme: u:r:kernel:s0 don't have permission to write /data/adb...
setenforce(false);
bool enforcing = getenforce();
if (enforcing) setenforce(false);
fp = filp_open(path, flags, mode);
setenforce(true);
if (enforcing) setenforce(true);
return fp;
}