From 5dad1e212b4fd2a3d15e1b6f9882f67a93da065c Mon Sep 17 00:00:00 2001 From: Kitty Cat Date: Fri, 28 Nov 2025 12:36:34 -0500 Subject: [PATCH] fix susfs patch --- 50_add_susfs_in_gki-android15-6.6.patch | 16 ++++++++-------- build.sh | 13 +++++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/50_add_susfs_in_gki-android15-6.6.patch b/50_add_susfs_in_gki-android15-6.6.patch index 0a1cef1..bd7bb97 100644 --- a/50_add_susfs_in_gki-android15-6.6.patch +++ b/50_add_susfs_in_gki-android15-6.6.patch @@ -949,7 +949,7 @@ index 2d0231797d0d..9296c8a1e0b5 100644 if (!mnt) return ERR_PTR(-ENOMEM); -@@ -3805,6 +4016,9 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns, +@@ -3816,6 +4027,9 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns, copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE; if (user_ns != ns->user_ns) copy_flags |= CL_SHARED_TO_SLAVE; @@ -959,7 +959,7 @@ index 2d0231797d0d..9296c8a1e0b5 100644 new = copy_tree(old, old->mnt.mnt_root, copy_flags); if (IS_ERR(new)) { namespace_unlock(); -@@ -5060,3 +5274,36 @@ static int __init init_fs_namespace_sysctls(void) +@@ -5071,3 +5285,36 @@ static int __init init_fs_namespace_sysctls(void) fs_initcall(init_fs_namespace_sysctls); #endif /* CONFIG_SYSCTL */ @@ -1152,10 +1152,10 @@ index 7cff02bc816e..9c9fa2259610 100644 +#ifdef CONFIG_KSU_SUSFS_SUS_MAP +#include +#endif + #include #include #include - #include "internal.h" -@@ -913,6 +916,9 @@ static ssize_t mem_rw(struct file *file, char __user *buf, +@@ -914,6 +917,9 @@ static ssize_t mem_rw(struct file *file, char __user *buf, ssize_t copied; char *page; unsigned int flags; @@ -1165,7 +1165,7 @@ index 7cff02bc816e..9c9fa2259610 100644 if (!mm) return 0; -@@ -931,6 +937,22 @@ static ssize_t mem_rw(struct file *file, char __user *buf, +@@ -932,6 +938,22 @@ static ssize_t mem_rw(struct file *file, char __user *buf, while (count > 0) { size_t this_len = min_t(size_t, count, PAGE_SIZE); @@ -1188,7 +1188,7 @@ index 7cff02bc816e..9c9fa2259610 100644 if (write && copy_from_user(page, buf, this_len)) { copied = -EFAULT; -@@ -2465,6 +2487,13 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) +@@ -2466,6 +2488,13 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) for_each_vma(vmi, vma) { if (!vma->vm_file) continue; @@ -2249,7 +2249,7 @@ diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 9f44a0f446ec..ef307839a90b 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c -@@ -47,6 +47,12 @@ +@@ -48,6 +48,12 @@ #undef CREATE_TRACE_POINTS #include @@ -2262,7 +2262,7 @@ index 9f44a0f446ec..ef307839a90b 100644 struct avc_entry { u32 ssid; u32 tsid; -@@ -719,11 +725,22 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) +@@ -720,11 +726,22 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) rc = security_sid_to_context(sad->tsid, &tcontext, &tcontext_len); diff --git a/build.sh b/build.sh index 03194fa..901224e 100755 --- a/build.sh +++ b/build.sh @@ -27,11 +27,18 @@ set_vars() { BASEDIR=$(realpath "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")/..") # Build toolchain locations + CLANGDIR="${BASEDIR}/prebuilts/clang/host/linux-x86/clang-r547379" GCCDIR="${BASEDIR}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9" GCCDIR32="${BASEDIR}/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" - CLANGDIR="${BASEDIR}/prebuilts/clang/host/linux-x86/clang-r547379" KERNELBUILDTOOLS="${BASEDIR}/prebuilts/kernel-build-tools/linux-x86" + # Array for all of the custom paths introduced by prebuilts + PREBUILTS_PATH=( + "${CLANGDIR}/bin" + "${GCCDIR}/bin" + "${KERNELBUILDTOOLS}/bin" + ) + # Common options used for `make`, particularly for cross-compile MAKEOPTS=( O="${BASEDIR}/work" @@ -44,6 +51,7 @@ set_vars() { CLANG_TRIPLE=aarch64-linux-gnu- ) + # Environment tools that are already somewhere in the project so we'll use them instead of adding extra dependencies BUSYBOX="${BASEDIR}/prebuilts/magisk/lib/x86_64/libbusybox.so" MAGISKBOOT="${BASEDIR}/prebuilts/magisk/lib/x86_64/libmagiskboot.so" @@ -102,7 +110,8 @@ add_susfs() { cp "${BASEDIR}/external/susfs4ksu/kernel_patches/fs/"* "fs/" || { echo "Failed to copy fs patches"; exit 1; } cp "${BASEDIR}/external/susfs4ksu/kernel_patches/include/linux/"* "include/linux/" || { echo "Failed to copy linux patches"; exit 1; } - patch --fuzz=3 -p1 < "${BASEDIR}/external/susfs4ksu/kernel_patches/50_add_susfs_in_gki-android15-6.6.patch" || { echo "Failed to patch kernel source for susfs"; exit 1; } + # Patch modified so that it works within a constrained environment + patch -p1 < "${BASEDIR}/meta/50_add_susfs_in_gki-android15-6.6.patch" || { echo "Failed to patch kernel source for susfs"; exit 1; } popd > /dev/null }