Skip to content

Commit ce7dce5

Browse files
committed
kernel: core_hook: no ext4_unregister_sysfs, no problem
If ext4_unregister_sysfs ain't there, we don't care. This is mostly for UL builds. Signed-off-by: backslashxx <[email protected]>
1 parent 3327260 commit ce7dce5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

kernel/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ $(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH))
5656
ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE)
5757
ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\"
5858

59+
# UL, look for "ext4_unregister_sysfs" on fs/ext4
60+
ifeq ($(shell grep -q "^extern void ext4_unregister_sysfs" $(srctree)/fs/ext4/ext4.h 2>/dev/null; echo $$?),0)
61+
ccflags-y += -DKSU_HAS_MODERN_EXT4
62+
endif
63+
5964
# enable functions that use stuct filename when ksu_handle_execveat is found
6065
ifeq ($(shell grep -q "ksu_handle_execveat" $(srctree)/fs/exec.c; echo $$?),0)
6166
ccflags-y += -DKSU_USE_STRUCT_FILENAME

kernel/core_hook.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ LSM_HANDLER_TYPE ksu_handle_rename(struct dentry *old_dentry, struct dentry *new
224224
return 0;
225225
}
226226

227+
#if defined(KSU_HAS_MODERN_EXT4) && defined(CONFIG_EXT4_FS)
227228
static void nuke_ext4_sysfs() {
228229
struct path path;
229230
int err = kern_path("/data/adb/modules", 0, &path);
@@ -243,6 +244,9 @@ static void nuke_ext4_sysfs() {
243244
ext4_unregister_sysfs(sb);
244245
path_put(&path);
245246
}
247+
#else
248+
static void nuke_ext4_sysfs() { }
249+
#endif
246250

247251
LSM_HANDLER_TYPE ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
248252
unsigned long arg4, unsigned long arg5)

0 commit comments

Comments
 (0)