kernel: Add CONFIG_KSU_MANUAL_SU configuration

- Use random passphrase protection for manual su functionality
This commit is contained in:
ShirkNeko
2025-09-29 06:50:39 +08:00
parent a9a10466b3
commit 78e0dc6da2
7 changed files with 54 additions and 6 deletions

View File

@@ -9,7 +9,9 @@ kernelsu-objs += ksud.o
kernelsu-objs += embed_ksud.o
kernelsu-objs += kernel_compat.o
kernelsu-objs += throne_comm.o
ifeq ($(CONFIG_KSU_MANUAL_SU), y)
kernelsu-objs += manual_su.o
endif
ifeq ($(CONFIG_KSU_TRACEPOINT_HOOK), y)
kernelsu-objs += ksu_trace.o
@@ -125,6 +127,22 @@ else
$(info -- KPM is disabled)
endif
ifeq ($(CONFIG_KSU_MANUAL_SU), y)
KSU_PW_POOL := abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
KSU_PW_LEN := $(shell awk 'BEGIN{srand(); print int(rand()*9)+8}')
ifeq ($(CONFIG_KSU), m)
KSU_SU_PASSWORD := CilloZako114514
else
KSU_SU_PASSWORD := $(shell \
tr -dc '$(KSU_PW_POOL)' </dev/urandom | head -c $(KSU_PW_LEN))
endif
ccflags-y += -DKSU_SU_PASSWORD=\"$(KSU_SU_PASSWORD)\"
$(info -- KSU manual-su password : $(KSU_SU_PASSWORD))
endif
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
ccflags-y += -Wno-declaration-after-statement -Wno-unused-function