diff --git a/kernel/Makefile b/kernel/Makefile index 4ac74b50..98861d9a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -103,10 +103,13 @@ endif ifeq ($(shell grep "ssize_t kernel_write" $(srctree)/fs/read_write.c | grep -q "const void" ; echo $$?),0) ccflags-y += -DKSU_OPTIONAL_KERNEL_WRITE endif +ifeq ($(shell grep -q "inode_security_struct\s\+\*selinux_inode" $(srctree)/security/selinux/include/objsec.h; echo $$?),0) +$(info -- KernelSU: kernel has selinux_inode.) +ccflags-y += -DKSU_OPTIONAL_SELINUX_INODE +endif ifeq ($(shell grep -q "int\s\+path_umount" $(srctree)/fs/namespace.c; echo $$?),0) ccflags-y += -DKSU_HAS_PATH_UMOUNT endif - # Checks Samsung UH drivers ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0) ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST diff --git a/kernel/sucompat.c b/kernel/sucompat.c index f40ecf09..59b1bc50 100644 --- a/kernel/sucompat.c +++ b/kernel/sucompat.c @@ -164,7 +164,7 @@ int ksu_handle_devpts(struct inode *inode) return 0; if (ksu_devpts_sid) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(KSU_OPTIONAL_SELINUX_INODE) struct inode_security_struct *sec = selinux_inode(inode); #else struct inode_security_struct *sec =