fix susfs patch

This commit is contained in:
2025-11-28 12:36:34 -05:00
parent 3b139f43d2
commit 5dad1e212b
2 changed files with 19 additions and 10 deletions

View File

@@ -949,7 +949,7 @@ index 2d0231797d0d..9296c8a1e0b5 100644
if (!mnt) if (!mnt)
return ERR_PTR(-ENOMEM); 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; copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;
if (user_ns != ns->user_ns) if (user_ns != ns->user_ns)
copy_flags |= CL_SHARED_TO_SLAVE; copy_flags |= CL_SHARED_TO_SLAVE;
@@ -959,7 +959,7 @@ index 2d0231797d0d..9296c8a1e0b5 100644
new = copy_tree(old, old->mnt.mnt_root, copy_flags); new = copy_tree(old, old->mnt.mnt_root, copy_flags);
if (IS_ERR(new)) { if (IS_ERR(new)) {
namespace_unlock(); 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); fs_initcall(init_fs_namespace_sysctls);
#endif /* CONFIG_SYSCTL */ #endif /* CONFIG_SYSCTL */
@@ -1152,10 +1152,10 @@ index 7cff02bc816e..9c9fa2259610 100644
+#ifdef CONFIG_KSU_SUSFS_SUS_MAP +#ifdef CONFIG_KSU_SUSFS_SUS_MAP
+#include <linux/susfs_def.h> +#include <linux/susfs_def.h>
+#endif +#endif
#include <linux/dma-buf.h>
#include <trace/events/oom.h> #include <trace/events/oom.h>
#include <trace/hooks/sched.h> #include <trace/hooks/sched.h>
#include "internal.h" @@ -914,6 +917,9 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
@@ -913,6 +916,9 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
ssize_t copied; ssize_t copied;
char *page; char *page;
unsigned int flags; unsigned int flags;
@@ -1165,7 +1165,7 @@ index 7cff02bc816e..9c9fa2259610 100644
if (!mm) if (!mm)
return 0; 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) { while (count > 0) {
size_t this_len = min_t(size_t, count, PAGE_SIZE); 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)) { if (write && copy_from_user(page, buf, this_len)) {
copied = -EFAULT; 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) { for_each_vma(vmi, vma) {
if (!vma->vm_file) if (!vma->vm_file)
continue; continue;
@@ -2249,7 +2249,7 @@ diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 9f44a0f446ec..ef307839a90b 100644 index 9f44a0f446ec..ef307839a90b 100644
--- a/security/selinux/avc.c --- a/security/selinux/avc.c
+++ b/security/selinux/avc.c +++ b/security/selinux/avc.c
@@ -47,6 +47,12 @@ @@ -48,6 +48,12 @@
#undef CREATE_TRACE_POINTS #undef CREATE_TRACE_POINTS
#include <trace/hooks/avc.h> #include <trace/hooks/avc.h>
@@ -2262,7 +2262,7 @@ index 9f44a0f446ec..ef307839a90b 100644
struct avc_entry { struct avc_entry {
u32 ssid; u32 ssid;
u32 tsid; 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, rc = security_sid_to_context(sad->tsid, &tcontext,
&tcontext_len); &tcontext_len);

View File

@@ -27,11 +27,18 @@ set_vars() {
BASEDIR=$(realpath "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")/..") BASEDIR=$(realpath "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")/..")
# Build toolchain locations # Build toolchain locations
CLANGDIR="${BASEDIR}/prebuilts/clang/host/linux-x86/clang-r547379"
GCCDIR="${BASEDIR}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9" GCCDIR="${BASEDIR}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9"
GCCDIR32="${BASEDIR}/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-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" 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 # Common options used for `make`, particularly for cross-compile
MAKEOPTS=( MAKEOPTS=(
O="${BASEDIR}/work" O="${BASEDIR}/work"
@@ -44,6 +51,7 @@ set_vars() {
CLANG_TRIPLE=aarch64-linux-gnu- CLANG_TRIPLE=aarch64-linux-gnu-
) )
# Environment tools that are already somewhere in the project so we'll use them instead of adding extra dependencies # 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" BUSYBOX="${BASEDIR}/prebuilts/magisk/lib/x86_64/libbusybox.so"
MAGISKBOOT="${BASEDIR}/prebuilts/magisk/lib/x86_64/libmagiskboot.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/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; } 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 popd > /dev/null
} }