Skip to content

Commit

Permalink
kernel: squash personal changes
Browse files Browse the repository at this point in the history
ksu.c: disable KPROBES=n warning, its useless, filesystem hooks are in use.
core_hook.c: umount /system/etc/hosts (tiann#1494)
Makefile: hardcode ksu version
  • Loading branch information
backslashxx committed Mar 21, 2024
1 parent bc1e03f commit f833b01
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
12 changes: 2 additions & 10 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,10 @@ ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-

obj-$(CONFIG_KSU) += kernelsu.o

# .git is a text file while the module is imported by 'git submodule add'.
ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0)
$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow)
KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD)
# ksu_version: major * 10000 + git version + 200 for historical reasons
$(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 200))
# hardcode!
$(eval KSU_VERSION=11675)
$(info -- KernelSU version: $(KSU_VERSION))
ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
else # If there is no .git file, the default version will be passed.
$(warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!")
ccflags-y += -DKSU_VERSION=16
endif

ifeq ($(shell grep -q " current_sid(void)" $(srctree)/security/selinux/include/objsec.h; echo $$?),0)
ccflags-y += -DKSU_COMPAT_HAS_CURRENT_SID
Expand Down
3 changes: 3 additions & 0 deletions kernel/core_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
// try umount ksu temp path
try_umount("/debug_ramdisk", false, MNT_DETACH);
try_umount("/sbin", false, MNT_DETACH);

// try umount /system/etc/hosts (for bindhosts)
try_umount("/system/etc/hosts", false, MNT_DETACH);

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion kernel/ksu.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ int __init kernelsu_init(void)
ksu_enable_sucompat();
ksu_enable_ksud();
#else
pr_alert("KPROBES is disabled, KernelSU may not work, please check https://kernelsu.org/guide/how-to-integrate-for-non-gki.html");
#endif

#ifdef MODULE
Expand Down

0 comments on commit f833b01

Please sign in to comment.