Skip to content

Commit

Permalink
kernel: selinux: fix redefined KERNEL_SU_DOMAIN (tiann#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
moetayuko authored and vbajs committed Dec 10, 2024
1 parent 7f8717e commit 8713c64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions kernel/selinux/kernel_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ int ksu_handle_security_bounded_transition(u32 *old_sid, u32 *new_sid) {
if (*old_sid == *new_sid)
return 0;

const char *init_domain = INIT_DOMAIN;
const char *su_domain = KERNEL_SU_DOMAIN;
const char *init_domain = INIT_CONTEXT;
const char *su_domain = KERNEL_SU_CONTEXT;

error = security_secctx_to_secid(init_domain, strlen(init_domain), &init_sid);
if (error) {
Expand Down
2 changes: 1 addition & 1 deletion kernel/selinux/selinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bool is_ksu_domain()
if (err) {
return false;
}
result = strncmp(KERNEL_SU_DOMAIN, domain, seclen) == 0;
result = strncmp(KERNEL_SU_CONTEXT, domain, seclen) == 0;
security_release_secctx(domain, seclen);
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions kernel/selinux/selinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include "linux/types.h"
#include "linux/version.h"

#define KERNEL_SU_DOMAIN "u:r:su:s0"
#define INIT_DOMAIN "u:r:init:s0"
#define KERNEL_SU_CONTEXT "u:r:su:s0"
#define INIT_CONTEXT "u:r:init:s0"

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || defined(KSU_COMPAT_HAS_SELINUX_STATE)
#define KSU_COMPAT_USE_SELINUX_STATE
Expand Down

0 comments on commit 8713c64

Please sign in to comment.