Compare commits

...

4 Commits

Author SHA1 Message Date
Wang Han
641984ea77 Update core_hook.c 2025-08-15 22:09:16 +08:00
Wang Han
884ca5851a Reset seccomp filter count when escaping to root 2025-08-15 21:49:17 +08:00
Tashfin Shakeer Rhythm
1ccdbc2b76 kernel: selinux: rules: Micro-optimize get_policydb() and fix illegal RCU lock usage in handle_sepolicy() (#2695)
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
2025-08-13 09:07:06 +08:00
Wang Han
539d44b8a0 Update resetprop from Magisk v30.2 (#2700)
This version of resetprop properly cleans up dirty backup area.
2025-08-12 09:16:08 +08:00
4 changed files with 7 additions and 4 deletions

View File

@@ -125,6 +125,7 @@ static void disable_seccomp()
#ifdef CONFIG_SECCOMP
current->seccomp.mode = 0;
current->seccomp.filter = NULL;
atomic_set(&current->seccomp.filter_count, 0);
#else
#endif
}

View File

@@ -19,7 +19,7 @@
static struct policydb *get_policydb(void)
{
struct policydb *db;
struct selinux_policy *policy = rcu_dereference(selinux_state.policy);
struct selinux_policy *policy = selinux_state.policy;
db = &policy->policydb;
return db;
}
@@ -189,6 +189,8 @@ static void reset_avc_cache()
int handle_sepolicy(unsigned long arg3, void __user *arg4)
{
struct policydb *db;
if (!arg4) {
return -1;
}
@@ -206,9 +208,9 @@ int handle_sepolicy(unsigned long arg3, void __user *arg4)
u32 cmd = data.cmd;
u32 subcmd = data.subcmd;
rcu_read_lock();
mutex_lock(&ksu_rules);
struct policydb *db = get_policydb();
db = get_policydb();
int ret = -1;
if (cmd == CMD_NORMAL_PERM) {
@@ -458,7 +460,7 @@ int handle_sepolicy(unsigned long arg3, void __user *arg4)
}
exit:
rcu_read_unlock();
mutex_unlock(&ksu_rules);
// only allow and xallow needs to reset avc cache, but we cannot do that because
// we are in atomic context. so we just reset it every time.

Binary file not shown.

Binary file not shown.