Compare commits

...

11 commits

Author SHA1 Message Date
Ksawlii
e0a4064163 Update and fix susfs4ksu 2025-01-29 18:01:59 +01:00
Ksawlii
c8b3e5b969 defconfigs: Regenerate with regen.sh 2025-01-29 17:01:12 +01:00
Ksawlii
14950606b9 build: Return to .patch file for SusFs 2025-01-29 16:48:25 +01:00
Ksawlii
936490e734
Merge pull request #8 from mitzamike/5.10.233-testing
5.10.233 testing
2025-01-29 17:43:39 +02:00
mitzamike
3e8102300f
Update fireasf.yml 2025-01-28 13:08:46 +02:00
mitzamike
cecf5816ef
Add files via upload 2025-01-28 13:06:07 +02:00
mitzamike
95268e6772
Create .gitkeep 2025-01-28 13:05:52 +02:00
Ksawlii
2074546535 build: Change KernelSU-Next url to my fork 2025-01-26 12:56:02 +01:00
Ksawlii
5962426542 Merge branch '5.10.233-testing' of https://github.com/Ksawlii-Android-Repos/android_kernel_samsung_a53x-FireAsf into 5.10.233-testing
* '5.10.233-testing' of https://github.com/Ksawlii-Android-Repos/android_kernel_samsung_a53x-FireAsf:
  update: susfs to 4a2aeafed0387550cd7e22bbd2566bcf2df58e8c
2025-01-26 12:54:23 +01:00
ThePedroo
e69c25d4b2
update: susfs to 4a2aeafed0387550cd7e22bbd2566bcf2df58e8c
This commit updates susfs in the kernel to the latest currently available by the time of this commit.
2025-01-26 08:46:38 -03:00
Ksawlii
f270fd9224 Revert "Update susfs4ksu"
This reverts commit 85f7fc17fc.
2025-01-25 21:06:29 +01:00
24 changed files with 1631 additions and 281 deletions

View file

@ -26,9 +26,9 @@ jobs:
rm -rf setup.sh* rm -rf setup.sh*
rm -rf KernelSU* rm -rf KernelSU*
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash -s next curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash -s next
cp $(pwd)/patches/0001-KernelSU-Next-Implement-SUSFS-v1.5.3-plus-GKI.patch $(pwd)/KernelSU-Next/0001-KernelSU-Next-Implement-SUSFS-v1.5.3-plus-GKI.patch cp $(pwd)/patches/Implement-SUSFS-v1.5.4-for-KernelSU-Next.patch $(pwd)/KernelSU-Next/Implement-SUSFS-v1.5.4-for-KernelSU-Next.patch
cd $(pwd)/KernelSU-Next/ cd $(pwd)/KernelSU-Next/
patch -p1 < 0001-KernelSU-Next-Implement-SUSFS-v1.5.3-plus-GKI.patch patch -p1 < Implement-SUSFS-v1.5.4-for-KernelSU-Next.patch
cd .. cd ..
echo "Applied susfs4ksu" echo "Applied susfs4ksu"
export FIREASF_VANILLA=true export FIREASF_VANILLA=true

View file

@ -556,10 +556,6 @@ CONFIG_PM_WAKELOCKS_LIMIT=0
# CONFIG_PM_WAKELOCKS_GC is not set # CONFIG_PM_WAKELOCKS_GC is not set
CONFIG_PM=y CONFIG_PM=y
# CONFIG_PM_DEBUG is not set # CONFIG_PM_DEBUG is not set
# CONFIG_PM_ADVANCED_DEBUG is not set
# CONFIG_PM_TEST_SUSPEND is not set
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_DPM_WATCHDOG is not set
CONFIG_PM_CLK=y CONFIG_PM_CLK=y
CONFIG_PM_GENERIC_DOMAINS=y CONFIG_PM_GENERIC_DOMAINS=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set # CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
@ -5483,7 +5479,7 @@ CONFIG_LEDS_TRIGGER_TRANSIENT=y
# CONFIG_LEDS_TRIGGER_AUDIO is not set # CONFIG_LEDS_TRIGGER_AUDIO is not set
# CONFIG_ACCESSIBILITY is not set # CONFIG_ACCESSIBILITY is not set
# CONFIG_INFINIBAND is not set # CONFIG_INFINIBAND is not set
# CONFIG_EDAC_SUPPORT is not set CONFIG_EDAC_SUPPORT=y
# CONFIG_EDAC is not set # CONFIG_EDAC is not set
CONFIG_RTC_LIB=y CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
@ -5677,7 +5673,6 @@ CONFIG_UIO=y
CONFIG_VIRTIO=y CONFIG_VIRTIO=y
CONFIG_VIRTIO_MENU=y CONFIG_VIRTIO_MENU=y
# CONFIG_VIRTIO_PCI is not set # CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_PMEM is not set
# CONFIG_VIRTIO_BALLOON is not set # CONFIG_VIRTIO_BALLOON is not set
# CONFIG_VIRTIO_INPUT is not set # CONFIG_VIRTIO_INPUT is not set
# CONFIG_VIRTIO_MMIO is not set # CONFIG_VIRTIO_MMIO is not set
@ -6010,6 +6005,7 @@ CONFIG_CMUCAL=m
CONFIG_CP_PMUCAL=m CONFIG_CP_PMUCAL=m
CONFIG_GNSS_PMUCAL=m CONFIG_GNSS_PMUCAL=m
CONFIG_CHUB_PMUCAL=m CONFIG_CHUB_PMUCAL=m
CONFIG_CMUCAL_DEBUG=m
CONFIG_CMUCAL_QCH_IGNORE_SUPPORT=m CONFIG_CMUCAL_QCH_IGNORE_SUPPORT=m
CONFIG_PMUCAL=y CONFIG_PMUCAL=y
# CONFIG_PMUCAL_DBG is not set # CONFIG_PMUCAL_DBG is not set
@ -6073,6 +6069,7 @@ CONFIG_EXYNOS_ACPM_MFD=y
# CONFIG_EXYNOS_MFD_SPMI is not set # CONFIG_EXYNOS_MFD_SPMI is not set
CONFIG_EXYNOS_MFD_I3C=y CONFIG_EXYNOS_MFD_I3C=y
# CONFIG_EXYNOS_ACPM_S2D is not set # CONFIG_EXYNOS_ACPM_S2D is not set
# CONFIG_EXYNOS_ACPM_PLGDBG is not set
CONFIG_EXYNOS_DEBUG=y CONFIG_EXYNOS_DEBUG=y
CONFIG_DEBUG_SNAPSHOT=m CONFIG_DEBUG_SNAPSHOT=m
# CONFIG_DEBUG_SNAPSHOT_API is not set # CONFIG_DEBUG_SNAPSHOT_API is not set
@ -6695,13 +6692,6 @@ CONFIG_ANDROID_VENDOR_OEM_DATA=y
CONFIG_TRACE_GPU_MEM=y CONFIG_TRACE_GPU_MEM=y
# CONFIG_LIBNVDIMM is not set # CONFIG_LIBNVDIMM is not set
CONFIG_BLK_DEV_PMEM=y
# CONFIG_ND_BLK is not set
CONFIG_ND_CLAIM=y
CONFIG_ND_BTT=y
CONFIG_BTT=y
CONFIG_OF_PMEM=y
CONFIG_DAX_DRIVER=y
CONFIG_DAX=y CONFIG_DAX=y
# CONFIG_DEV_DAX is not set # CONFIG_DEV_DAX is not set
CONFIG_NVMEM=y CONFIG_NVMEM=y
@ -7857,7 +7847,6 @@ CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_COMPAT_VDSO=y CONFIG_GENERIC_COMPAT_VDSO=y
CONFIG_GENERIC_VDSO_TIME_NS=y CONFIG_GENERIC_VDSO_TIME_NS=y
CONFIG_SG_POOL=y CONFIG_SG_POOL=y
CONFIG_MEMREGION=y
CONFIG_ARCH_STACKWALK=y CONFIG_ARCH_STACKWALK=y
CONFIG_STACKDEPOT=y CONFIG_STACKDEPOT=y
CONFIG_STACK_HASH_ORDER=12 CONFIG_STACK_HASH_ORDER=12
@ -7923,8 +7912,6 @@ CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set # CONFIG_KGDB is not set
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not set # CONFIG_UBSAN is not set
CONFIG_CC_HAS_UBSAN_BOUNDS=y
CONFIG_CC_HAS_UBSAN_ARRAY_BOUNDS=y
CONFIG_HAVE_KCSAN_COMPILER=y CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments # end of Generic Kernel Debugging Instruments
@ -8090,7 +8077,6 @@ CONFIG_BPF_EVENTS=y
CONFIG_DYNAMIC_EVENTS=y CONFIG_DYNAMIC_EVENTS=y
CONFIG_PROBE_EVENTS=y CONFIG_PROBE_EVENTS=y
# CONFIG_BPF_KPROBE_OVERRIDE is not set # CONFIG_BPF_KPROBE_OVERRIDE is not set
CONFIG_TRACING_MAP=y
CONFIG_SYNTH_EVENTS=y CONFIG_SYNTH_EVENTS=y
# CONFIG_HIST_TRIGGERS is not set # CONFIG_HIST_TRIGGERS is not set
# CONFIG_TRACE_EVENT_INJECT is not set # CONFIG_TRACE_EVENT_INJECT is not set
@ -8101,7 +8087,6 @@ CONFIG_SYNTH_EVENTS=y
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set # CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_SYNTH_EVENT_GEN_TEST is not set # CONFIG_SYNTH_EVENT_GEN_TEST is not set
# CONFIG_KPROBE_EVENT_GEN_TEST is not set # CONFIG_KPROBE_EVENT_GEN_TEST is not set
# CONFIG_HIST_TRIGGERS_DEBUG is not set
# CONFIG_SAMPLES is not set # CONFIG_SAMPLES is not set
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set # CONFIG_STRICT_DEVMEM is not set

View file

@ -556,10 +556,6 @@ CONFIG_PM_WAKELOCKS_LIMIT=0
# CONFIG_PM_WAKELOCKS_GC is not set # CONFIG_PM_WAKELOCKS_GC is not set
CONFIG_PM=y CONFIG_PM=y
# CONFIG_PM_DEBUG is not set # CONFIG_PM_DEBUG is not set
# CONFIG_PM_ADVANCED_DEBUG is not set
# CONFIG_PM_TEST_SUSPEND is not set
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_DPM_WATCHDOG is not set
CONFIG_PM_CLK=y CONFIG_PM_CLK=y
CONFIG_PM_GENERIC_DOMAINS=y CONFIG_PM_GENERIC_DOMAINS=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set # CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
@ -3008,7 +3004,7 @@ CONFIG_SERIAL_MCTRL_GPIO=y
# CONFIG_NOZOMI is not set # CONFIG_NOZOMI is not set
# CONFIG_NULL_TTY is not set # CONFIG_NULL_TTY is not set
# CONFIG_TRACE_SINK is not set # CONFIG_TRACE_SINK is not set
# CONFIG_HVC_DRIVER is not set CONFIG_HVC_DRIVER=y
# CONFIG_HVC_DCC is not set # CONFIG_HVC_DCC is not set
CONFIG_SERIAL_DEV_BUS=y CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
@ -5483,12 +5479,8 @@ CONFIG_LEDS_TRIGGER_TRANSIENT=y
# CONFIG_LEDS_TRIGGER_AUDIO is not set # CONFIG_LEDS_TRIGGER_AUDIO is not set
# CONFIG_ACCESSIBILITY is not set # CONFIG_ACCESSIBILITY is not set
# CONFIG_INFINIBAND is not set # CONFIG_INFINIBAND is not set
# CONFIG_EDAC_SUPPORT is not set CONFIG_EDAC_SUPPORT=y
# CONFIG_EDAC is not set # CONFIG_EDAC is not set
# CONFIG_EDAC_DEBUG is not set
# CONFIG_EDAC_THUNDERX is not set
# CONFIG_EDAC_XGENE is not set
# CONFIG_EDAC_DMC520 is not set
CONFIG_RTC_LIB=y CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y CONFIG_RTC_HCTOSYS=y
@ -5681,7 +5673,6 @@ CONFIG_UIO=y
CONFIG_VIRTIO=y CONFIG_VIRTIO=y
CONFIG_VIRTIO_MENU=y CONFIG_VIRTIO_MENU=y
# CONFIG_VIRTIO_PCI is not set # CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_PMEM is not set
# CONFIG_VIRTIO_BALLOON is not set # CONFIG_VIRTIO_BALLOON is not set
# CONFIG_VIRTIO_INPUT is not set # CONFIG_VIRTIO_INPUT is not set
# CONFIG_VIRTIO_MMIO is not set # CONFIG_VIRTIO_MMIO is not set
@ -6014,6 +6005,7 @@ CONFIG_CMUCAL=m
CONFIG_CP_PMUCAL=m CONFIG_CP_PMUCAL=m
CONFIG_GNSS_PMUCAL=m CONFIG_GNSS_PMUCAL=m
CONFIG_CHUB_PMUCAL=m CONFIG_CHUB_PMUCAL=m
CONFIG_CMUCAL_DEBUG=m
CONFIG_CMUCAL_QCH_IGNORE_SUPPORT=m CONFIG_CMUCAL_QCH_IGNORE_SUPPORT=m
CONFIG_PMUCAL=y CONFIG_PMUCAL=y
# CONFIG_PMUCAL_DBG is not set # CONFIG_PMUCAL_DBG is not set
@ -6077,6 +6069,7 @@ CONFIG_EXYNOS_ACPM_MFD=y
# CONFIG_EXYNOS_MFD_SPMI is not set # CONFIG_EXYNOS_MFD_SPMI is not set
CONFIG_EXYNOS_MFD_I3C=y CONFIG_EXYNOS_MFD_I3C=y
# CONFIG_EXYNOS_ACPM_S2D is not set # CONFIG_EXYNOS_ACPM_S2D is not set
# CONFIG_EXYNOS_ACPM_PLGDBG is not set
CONFIG_EXYNOS_DEBUG=y CONFIG_EXYNOS_DEBUG=y
CONFIG_DEBUG_SNAPSHOT=m CONFIG_DEBUG_SNAPSHOT=m
# CONFIG_DEBUG_SNAPSHOT_API is not set # CONFIG_DEBUG_SNAPSHOT_API is not set
@ -6699,13 +6692,6 @@ CONFIG_ANDROID_VENDOR_OEM_DATA=y
CONFIG_TRACE_GPU_MEM=y CONFIG_TRACE_GPU_MEM=y
# CONFIG_LIBNVDIMM is not set # CONFIG_LIBNVDIMM is not set
CONFIG_BLK_DEV_PMEM=y
# CONFIG_ND_BLK is not set
CONFIG_ND_CLAIM=y
CONFIG_ND_BTT=y
CONFIG_BTT=y
CONFIG_OF_PMEM=y
CONFIG_DAX_DRIVER=y
CONFIG_DAX=y CONFIG_DAX=y
# CONFIG_DEV_DAX is not set # CONFIG_DEV_DAX is not set
CONFIG_NVMEM=y CONFIG_NVMEM=y
@ -7843,7 +7829,6 @@ CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_COMPAT_VDSO=y CONFIG_GENERIC_COMPAT_VDSO=y
CONFIG_GENERIC_VDSO_TIME_NS=y CONFIG_GENERIC_VDSO_TIME_NS=y
CONFIG_SG_POOL=y CONFIG_SG_POOL=y
CONFIG_MEMREGION=y
CONFIG_ARCH_STACKWALK=y CONFIG_ARCH_STACKWALK=y
CONFIG_STACKDEPOT=y CONFIG_STACKDEPOT=y
CONFIG_STACK_HASH_ORDER=12 CONFIG_STACK_HASH_ORDER=12
@ -7909,8 +7894,6 @@ CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set # CONFIG_KGDB is not set
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not set # CONFIG_UBSAN is not set
CONFIG_CC_HAS_UBSAN_BOUNDS=y
CONFIG_CC_HAS_UBSAN_ARRAY_BOUNDS=y
CONFIG_HAVE_KCSAN_COMPILER=y CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments # end of Generic Kernel Debugging Instruments
@ -8076,7 +8059,6 @@ CONFIG_BPF_EVENTS=y
CONFIG_DYNAMIC_EVENTS=y CONFIG_DYNAMIC_EVENTS=y
CONFIG_PROBE_EVENTS=y CONFIG_PROBE_EVENTS=y
# CONFIG_BPF_KPROBE_OVERRIDE is not set # CONFIG_BPF_KPROBE_OVERRIDE is not set
CONFIG_TRACING_MAP=y
CONFIG_SYNTH_EVENTS=y CONFIG_SYNTH_EVENTS=y
# CONFIG_HIST_TRIGGERS is not set # CONFIG_HIST_TRIGGERS is not set
# CONFIG_TRACE_EVENT_INJECT is not set # CONFIG_TRACE_EVENT_INJECT is not set
@ -8087,7 +8069,6 @@ CONFIG_SYNTH_EVENTS=y
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set # CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_SYNTH_EVENT_GEN_TEST is not set # CONFIG_SYNTH_EVENT_GEN_TEST is not set
# CONFIG_KPROBE_EVENT_GEN_TEST is not set # CONFIG_KPROBE_EVENT_GEN_TEST is not set
# CONFIG_HIST_TRIGGERS_DEBUG is not set
# CONFIG_SAMPLES is not set # CONFIG_SAMPLES is not set
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set # CONFIG_STRICT_DEVMEM is not set

View file

@ -18,6 +18,11 @@ command_three() {
rm -rf setup.sh* rm -rf setup.sh*
rm -rf KernelSU* rm -rf KernelSU*
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash -s next curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash -s next
cp $(pwd)/patches/Implement-SUSFS-v1.5.4-for-KernelSU-Next.patch $(pwd)/KernelSU-Next/Implement-SUSFS-v1.5.4-for-KernelSU-Next.patch
cd $(pwd)/KernelSU-Next/
patch -p1 < Implement-SUSFS-v1.5.4-for-KernelSU-Next.patch
cd ..
echo "Applied susfs4ksu"
} }
command_four() { command_four() {

View file

@ -21,9 +21,6 @@ obj-y := open.o read_write.o file_table.o super.o \
obj-$(CONFIG_KSU_SUSFS) += susfs.o obj-$(CONFIG_KSU_SUSFS) += susfs.o
obj-$(CONFIG_KSU_SUSFS_SUS_SU) += sus_su.o obj-$(CONFIG_KSU_SUSFS_SUS_SU) += sus_su.o
obj-$(CONFIG_KSU_SUSFS) += susfs.o
obj-$(CONFIG_KSU_SUSFS_SUS_SU) += sus_su.o
ifeq ($(CONFIG_BLOCK),y) ifeq ($(CONFIG_BLOCK),y)
obj-y += buffer.o block_dev.o direct-io.o mpage.o obj-y += buffer.o block_dev.o direct-io.o mpage.o
else else

View file

@ -2410,12 +2410,6 @@ struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name)
if (dentry->d_name.hash != hash) if (dentry->d_name.hash != hash)
continue; continue;
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
continue;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_PATH #ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) { if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
continue; continue;

View file

@ -601,11 +601,6 @@ extern bool ksu_devpts_hook;
extern int ksu_handle_devpts(struct inode*); extern int ksu_handle_devpts(struct inode*);
#endif #endif
#if defined(CONFIG_KSU_SUSFS_SUS_SU)
extern bool ksu_devpts_hook;
extern int ksu_handle_devpts(struct inode*);
#endif
/** /**
* devpts_get_priv -- get private data for a slave * devpts_get_priv -- get private data for a slave
* @pts_inode: inode of the slave * @pts_inode: inode of the slave

View file

@ -1882,12 +1882,6 @@ extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
void *envp, int *flags); void *envp, int *flags);
#endif #endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU
extern bool susfs_is_sus_su_hooks_enabled __read_mostly;
extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr, void *argv,
void *envp, int *flags);
#endif
static int do_execveat_common(int fd, struct filename *filename, static int do_execveat_common(int fd, struct filename *filename,
struct user_arg_ptr argv, struct user_arg_ptr argv,
struct user_arg_ptr envp, struct user_arg_ptr envp,
@ -1899,11 +1893,6 @@ static int do_execveat_common(int fd, struct filename *filename,
if (IS_ERR(filename)) if (IS_ERR(filename))
return PTR_ERR(filename); return PTR_ERR(filename);
#ifdef CONFIG_KSU_SUSFS_SUS_SU
if (susfs_is_sus_su_hooks_enabled)
ksu_handle_execveat_sucompat(&fd, &filename, &argv, &envp, &flags);
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU #ifdef CONFIG_KSU_SUSFS_SUS_SU
if (susfs_is_sus_su_hooks_enabled) if (susfs_is_sus_su_hooks_enabled)
ksu_handle_execveat_sucompat(&fd, &filename, &argv, &envp, &flags); ksu_handle_execveat_sucompat(&fd, &filename, &argv, &envp, &flags);

View file

@ -24,10 +24,6 @@
#include <trace/events/writeback.h> #include <trace/events/writeback.h>
#include "internal.h" #include "internal.h"
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
extern bool susfs_is_current_ksu_domain(void);
#endif
/* /*
* Inode locking rules: * Inode locking rules:
* *
@ -1829,11 +1825,6 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
int iflags = I_DIRTY_TIME; int iflags = I_DIRTY_TIME;
bool dirty = false; bool dirty = false;
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
if (susfs_is_current_ksu_domain()) {
return 0;
}
#endif
if (flags & S_ATIME) if (flags & S_ATIME)
inode->i_atime = *time; inode->i_atime = *time;
if (flags & S_VERSION) if (flags & S_VERSION)
@ -1859,11 +1850,6 @@ EXPORT_SYMBOL(generic_update_time);
*/ */
int inode_update_time(struct inode *inode, struct timespec64 *time, int flags) int inode_update_time(struct inode *inode, struct timespec64 *time, int flags)
{ {
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
if (susfs_is_current_ksu_domain()) {
return 0;
}
#endif
if (inode->i_op->update_time) if (inode->i_op->update_time)
return inode->i_op->update_time(inode, time, flags); return inode->i_op->update_time(inode, time, flags);
return generic_update_time(inode, time, flags); return generic_update_time(inode, time, flags);
@ -1920,12 +1906,6 @@ void touch_atime(const struct path *path)
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct timespec64 now; struct timespec64 now;
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
if (susfs_is_current_ksu_domain()) {
return;
}
#endif
if (!atime_needs_update(path, inode)) if (!atime_needs_update(path, inode))
return; return;

View file

@ -43,10 +43,6 @@
#include <linux/susfs_def.h> #include <linux/susfs_def.h>
#endif #endif
#if defined(CONFIG_KSU_SUSFS_SUS_PATH) || defined(CONFIG_KSU_SUSFS_OPEN_REDIRECT)
#include <linux/susfs_def.h>
#endif
#ifdef CONFIG_FSCRYPT_SDP #ifdef CONFIG_FSCRYPT_SDP
#include <linux/fscrypto_sdp_name.h> #include <linux/fscrypto_sdp_name.h>
#endif #endif
@ -1139,12 +1135,6 @@ int may_linkat(struct path *link)
{ {
struct inode *inode = link->dentry->d_inode; struct inode *inode = link->dentry->d_inode;
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (inode && unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return -ENOENT;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_PATH #ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (inode && unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) { if (inode && unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return -ENOENT; return -ENOENT;
@ -1570,19 +1560,6 @@ static struct dentry *lookup_dcache(const struct qstr *name,
return ERR_PTR(error); return ERR_PTR(error);
} }
} }
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
if ((flags & (LOOKUP_CREATE | LOOKUP_EXCL))) {
error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
if (error) {
dput(dentry);
return ERR_PTR(error);
}
}
dput(dentry);
return ERR_PTR(-ENOENT);
}
#endif
return dentry; return dentry;
} }
@ -1695,12 +1672,6 @@ static struct dentry *lookup_fast(struct nameidata *nd,
dput(dentry); dput(dentry);
return ERR_PTR(status); return ERR_PTR(status);
} }
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
dput(dentry);
return ERR_PTR(-ENOENT);
}
#endif
return dentry; return dentry;
} }
@ -2498,12 +2469,6 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
path_get(&nd->root); path_get(&nd->root);
nd->flags |= LOOKUP_ROOT_GRABBED; nd->flags |= LOOKUP_ROOT_GRABBED;
} }
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
// we deal with sus sub path here
if (nd->inode && unlikely(nd->inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return 0;
}
#endif
} }
return s; return s;
} }
@ -2915,12 +2880,6 @@ static int may_delete(struct inode *dir, struct dentry *victim, bool isdir)
if (IS_APPEND(dir)) if (IS_APPEND(dir))
return -EPERM; return -EPERM;
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return -ENOENT;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_PATH #ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) { if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return -ENOENT; return -ENOENT;
@ -3134,12 +3093,6 @@ static int may_open(const struct path *path, int acc_mode, int flag)
if (!inode) if (!inode)
return -ENOENT; return -ENOENT;
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return -ENOENT;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_PATH #ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) { if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
return -ENOENT; return -ENOENT;

View file

@ -45,18 +45,25 @@
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
extern bool susfs_is_current_ksu_domain(void); extern bool susfs_is_current_ksu_domain(void);
extern bool susfs_is_current_zygote_domain(void); extern bool susfs_is_current_zygote_domain(void);
#define CL_SUSFS_COPY_MNT_NS 0x1000000
#define DEFAULT_SUS_MNT_GROUP_ID 1000 static DEFINE_IDA(susfs_mnt_id_ida);
static DEFINE_IDA(susfs_mnt_group_ida);
#define CL_ZYGOTE_COPY_MNT_NS BIT(24) /* used by copy_mnt_ns() */
#define CL_COPY_MNT_NS BIT(25) /* used by copy_mnt_ns() */
#endif #endif
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT
extern void susfs_auto_add_sus_ksu_default_mount(const char __user *to_pathname);
bool susfs_is_auto_add_sus_ksu_default_mount_enabled = true;
#endif
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT #ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT
extern int susfs_auto_add_sus_bind_mount(const char *pathname, struct path *path_target); extern int susfs_auto_add_sus_bind_mount(const char *pathname, struct path *path_target);
bool susfs_is_auto_add_sus_bind_mount_enabled = true;
#endif #endif
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT #ifdef CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT
extern void susfs_auto_add_try_umount_for_bind_mount(struct path *path); extern void susfs_auto_add_try_umount_for_bind_mount(struct path *path);
#endif bool susfs_is_auto_add_try_umount_for_bind_mount_enabled = true;
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT
extern void susfs_auto_add_sus_ksu_default_mount(const char __user *to_pathname);
#endif #endif
/* Maximum number of mounts in a mount namespace */ /* Maximum number of mounts in a mount namespace */
@ -215,31 +222,35 @@ static int mnt_alloc_id(struct mount *mnt)
static void mnt_free_id(struct mount *mnt) static void mnt_free_id(struct mount *mnt)
{ {
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
// If mnt->mnt.susfs_orig_mnt_id is not zero, it means mnt->mnt_id is spoofed, // We should first check the 'mnt->mnt.susfs_mnt_id_backup', see if it is DEFAULT_SUS_MNT_ID_FOR_KSU_PROC_UNSHARE
// so here we return the original mnt_id for being freed. // if so, these mnt_id were not assigned by mnt_alloc_id() so we don't need to free it.
if (unlikely(mnt->mnt.susfs_orig_mnt_id)) { if (unlikely(mnt->mnt.susfs_mnt_id_backup == DEFAULT_SUS_MNT_ID_FOR_KSU_PROC_UNSHARE)) {
ida_free(&mnt_id_ida, mnt->mnt.susfs_orig_mnt_id); return;
}
// Now we can check if its mnt_id is sus
if (unlikely(mnt->mnt_id >= DEFAULT_SUS_MNT_ID)) {
ida_free(&susfs_mnt_id_ida, mnt->mnt_id);
return;
}
// Lastly if 'mnt->mnt.susfs_mnt_id_backup' is not 0, then it contains a backup origin mnt_id
// so we free it in the original way
if (likely(mnt->mnt.susfs_mnt_id_backup)) {
// If mnt->mnt.susfs_mnt_id_backup is not zero, it means mnt->mnt_id is spoofed,
// so here we return the original mnt_id for being freed.
ida_free(&mnt_id_ida, mnt->mnt.susfs_mnt_id_backup);
return; return;
} }
#endif #endif
ida_free(&mnt_id_ida, mnt->mnt_id); ida_free(&mnt_id_ida, mnt->mnt_id);
} }
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
static void susfs_mnt_alloc_group_id(struct mount *mnt)
{
// Just assign the same default sus mount_group_id to mnt->mnt_group_id
mnt->mnt_group_id = DEFAULT_SUS_MNT_GROUP_ID;
}
#endif
/* /*
* Allocate a new peer group ID * Allocate a new peer group ID
*/ */
static int mnt_alloc_group_id(struct mount *mnt) static int mnt_alloc_group_id(struct mount *mnt)
{ {
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
int res; int res;
// Check if mnt has sus mnt_id // Check if mnt has sus mnt_id
if (mnt->mnt_id >= DEFAULT_SUS_MNT_ID) { if (mnt->mnt_id >= DEFAULT_SUS_MNT_ID) {
@ -250,7 +261,7 @@ static int mnt_alloc_group_id(struct mount *mnt)
res = ida_alloc_min(&mnt_group_ida, 1, GFP_KERNEL); res = ida_alloc_min(&mnt_group_ida, 1, GFP_KERNEL);
bypass_orig_flow: bypass_orig_flow:
#else #else
int res = ida_alloc_min(&mnt_group_ida, 1, GFP_KERNEL); int res = ida_alloc_min(&mnt_group_ida, 1, GFP_KERNEL);
#endif #endif
if (res < 0) if (res < 0)
@ -265,9 +276,10 @@ bypass_orig_flow:
void mnt_release_group_id(struct mount *mnt) void mnt_release_group_id(struct mount *mnt)
{ {
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
// If mnt->mnt_group_id >= DEFAULT_SUS_MNT_GROUP_ID, it means 'mnt' is sus mount, // If mnt->mnt_group_id >= DEFAULT_SUS_MNT_GROUP_ID, it means 'mnt' is also sus mount,
// here we don't need to free the mnt_group_id and just simply return and do nothing. // then we free the mnt->mnt_group_id from susfs_mnt_group_ida
if (unlikely(mnt->mnt_group_id >= DEFAULT_SUS_MNT_GROUP_ID)) { if (mnt->mnt_group_id >= DEFAULT_SUS_MNT_GROUP_ID) {
ida_free(&susfs_mnt_group_ida, mnt->mnt_group_id);
mnt->mnt_group_id = 0; mnt->mnt_group_id = 0;
return; return;
} }
@ -1175,7 +1187,7 @@ bypass_orig_flow:
#else #else
mnt = alloc_vfsmnt(fc->source ?: "none"); mnt = alloc_vfsmnt(fc->source ?: "none");
#endif #endif
if (!mnt) if (!mnt)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (fc->sb_flags & SB_KERNMOUNT) if (fc->sb_flags & SB_KERNMOUNT)
@ -1196,13 +1208,6 @@ bypass_orig_flow:
#endif #endif
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (susfs_is_current_zygote_domain()) {
mnt->mnt.susfs_orig_mnt_id = mnt->mnt_id;
mnt->mnt_id = current->susfs_last_fake_mnt_id++;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
// If caller process is zygote, then it is a normal mount, so we just reorder the mnt_id // If caller process is zygote, then it is a normal mount, so we just reorder the mnt_id
if (susfs_is_current_zygote_domain()) { if (susfs_is_current_zygote_domain()) {
@ -1338,7 +1343,7 @@ bypass_orig_flow:
#else #else
mnt = alloc_vfsmnt(old->mnt_devname); mnt = alloc_vfsmnt(old->mnt_devname);
#endif #endif
if (!mnt) if (!mnt)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE)) if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
@ -1372,7 +1377,8 @@ bypass_orig_flow:
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (susfs_is_current_zygote_domain() && !(flag & CL_SUSFS_COPY_MNT_NS)) { // If caller process is zygote and not doing unshare, so we just reorder the mnt_id
if (likely(is_current_zygote_domain) && !(flag & CL_ZYGOTE_COPY_MNT_NS)) {
mnt->mnt.susfs_orig_mnt_id = mnt->mnt_id; mnt->mnt.susfs_orig_mnt_id = mnt->mnt_id;
mnt->mnt_id = current->susfs_last_fake_mnt_id++; mnt->mnt_id = current->susfs_last_fake_mnt_id++;
} }
@ -2481,17 +2487,6 @@ static int invent_group_ids(struct mount *mnt, bool recurse)
{ {
struct mount *p; struct mount *p;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (susfs_is_current_ksu_domain()) {
for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
susfs_mnt_alloc_group_id(p);
}
}
return 0;
}
#endif
for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) { for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
if (!p->mnt_group_id && !IS_MNT_SHARED(p)) { if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
int err = mnt_alloc_group_id(p); int err = mnt_alloc_group_id(p);
@ -2714,29 +2709,6 @@ retry:
} }
return mp; return mp;
} }
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
// current->susfs_last_fake_mnt_id -> to record last valid fake mnt_id to zygote pid
// q->mnt.susfs_mnt_id_backup -> original mnt_id
// q->mnt_id -> will be modified to the fake mnt_id
// Here We are only interested in processes of which original mnt namespace belongs to zygote
// Also we just make use of existing 'q' mount pointer, no need to delcare extra mount pointer
if (is_zygote_pid) {
last_entry_mnt_id = list_first_entry(&new_ns->list, struct mount, mnt_list)->mnt_id;
list_for_each_entry(q, &new_ns->list, mnt_list) {
if (unlikely(q->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT)) {
continue;
}
q->mnt.susfs_mnt_id_backup = q->mnt_id;
q->mnt_id = last_entry_mnt_id++;
}
}
// Assign the 'last_entry_mnt_id' to 'current->susfs_last_fake_mnt_id' for later use.
// should be fine here assuming zygote is forking/unsharing app in one single thread.
// Or should we put a lock here?
current->susfs_last_fake_mnt_id = last_entry_mnt_id;
#endif
namespace_unlock(); namespace_unlock();
inode_unlock(path->dentry->d_inode); inode_unlock(path->dentry->d_inode);
path_put(path); path_put(path);
@ -2910,12 +2882,15 @@ static int do_loopback(struct path *path, const char *old_name,
// And we target only process with ksu domain. // And we target only process with ksu domain.
if (susfs_is_current_ksu_domain()) { if (susfs_is_current_ksu_domain()) {
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT) #if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT)
if (susfs_auto_add_sus_bind_mount(old_name, &old_path)) { if (susfs_is_auto_add_sus_bind_mount_enabled &&
susfs_auto_add_sus_bind_mount(old_name, &old_path)) {
goto orig_flow; goto orig_flow;
} }
#endif #endif
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT) #if defined(CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT)
susfs_auto_add_try_umount_for_bind_mount(path); if (susfs_is_auto_add_try_umount_for_bind_mount_enabled) {
susfs_auto_add_try_umount_for_bind_mount(path);
}
#endif #endif
} }
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT) #if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT)
@ -3946,9 +3921,11 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
copy_flags |= CL_SHARED_TO_SLAVE; copy_flags |= CL_SHARED_TO_SLAVE;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
// Always let clone_mnt() in copy_tree() know it is from copy_mnt_ns()
copy_flags |= CL_COPY_MNT_NS;
if (is_zygote_pid) { if (is_zygote_pid) {
// Let clone_mnt() in copy_tree() know we only interested in function called by copy_mnt_ns() // Let clone_mnt() in copy_tree() know copy_mnt_ns() is run by zygote process
copy_flags |= CL_SUSFS_COPY_MNT_NS; copy_flags |= CL_ZYGOTE_COPY_MNT_NS;
} }
#endif #endif
#ifdef CONFIG_KDP_NS #ifdef CONFIG_KDP_NS
@ -4014,7 +3991,7 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
} }
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
// current->susfs_last_fake_mnt_id -> to record last valid fake mnt_id to zygote pid // current->susfs_last_fake_mnt_id -> to record last valid fake mnt_id to zygote pid
// q->mnt.susfs_orig_mnt_id -> original mnt_id // q->mnt.susfs_mnt_id_backup -> original mnt_id
// q->mnt_id -> will be modified to the fake mnt_id // q->mnt_id -> will be modified to the fake mnt_id
// Here We are only interested in processes of which original mnt namespace belongs to zygote // Here We are only interested in processes of which original mnt namespace belongs to zygote
@ -4025,7 +4002,7 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
if (unlikely(q->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT)) { if (unlikely(q->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT)) {
continue; continue;
} }
q->mnt.susfs_orig_mnt_id = q->mnt_id; q->mnt.susfs_mnt_id_backup = q->mnt_id;
q->mnt_id = last_entry_mnt_id++; q->mnt_id = last_entry_mnt_id++;
} }
} }
@ -4106,12 +4083,6 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
goto out_data; goto out_data;
ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options); ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT) && defined(CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT)
// Just for the compatibility of Magic Mount KernelSU
if (!ret && susfs_is_current_ksu_domain()) {
susfs_auto_add_sus_ksu_default_mount(dir_name);
}
#endif
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT) && defined(CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT) #if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT) && defined(CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT)
// Just for the compatibility of Magic Mount KernelSU // Just for the compatibility of Magic Mount KernelSU
@ -4325,7 +4296,8 @@ out_to:
out_from: out_from:
path_put(&from_path); path_put(&from_path);
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT #ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT
if (!ret && susfs_is_current_ksu_domain()) { // For Legacy KSU mount scheme
if (!ret && susfs_is_auto_add_sus_ksu_default_mount_enabled && susfs_is_current_ksu_domain()) {
susfs_auto_add_sus_ksu_default_mount(to_pathname); susfs_auto_add_sus_ksu_default_mount(to_pathname);
} }
#endif #endif

View file

@ -25,17 +25,28 @@
#if defined(CONFIG_INOTIFY_USER) || defined(CONFIG_FANOTIFY) #if defined(CONFIG_INOTIFY_USER) || defined(CONFIG_FANOTIFY)
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
static void show_fdinfo(struct seq_file *m, struct file *f,
void (*show)(struct seq_file *m,
struct fsnotify_mark *mark,
struct file *file))
#else
static void show_fdinfo(struct seq_file *m, struct file *f, static void show_fdinfo(struct seq_file *m, struct file *f,
void (*show)(struct seq_file *m, void (*show)(struct seq_file *m,
struct fsnotify_mark *mark)) struct fsnotify_mark *mark))
#endif
{ {
struct fsnotify_group *group = f->private_data; struct fsnotify_group *group = f->private_data;
struct fsnotify_mark *mark; struct fsnotify_mark *mark;
fsnotify_group_lock(group); fsnotify_group_lock(group);
list_for_each_entry(mark, &group->marks_list, g_list) { list_for_each_entry(mark, &group->marks_list, g_list) {
show(m, mark); #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (seq_has_overflowed(m)) show(m, mark, f);
#else
show(m, mark);
#endif
if (seq_has_overflowed(m))
break; break;
} }
fsnotify_group_unlock(group); fsnotify_group_unlock(group);

View file

@ -401,12 +401,6 @@ extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int
int *flags); int *flags);
#endif #endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU
extern bool susfs_is_sus_su_hooks_enabled __read_mostly;
extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
int *flags);
#endif
static long do_faccessat(int dfd, const char __user *filename, int mode, int flags) static long do_faccessat(int dfd, const char __user *filename, int mode, int flags)
{ {
struct path path; struct path path;
@ -415,12 +409,6 @@ static long do_faccessat(int dfd, const char __user *filename, int mode, int fla
unsigned int lookup_flags = LOOKUP_FOLLOW; unsigned int lookup_flags = LOOKUP_FOLLOW;
const struct cred *old_cred = NULL; const struct cred *old_cred = NULL;
#ifdef CONFIG_KSU_SUSFS_SUS_SU
if (susfs_is_sus_su_hooks_enabled) {
ksu_handle_faccessat(&dfd, &filename, &mode, NULL);
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU #ifdef CONFIG_KSU_SUSFS_SUS_SU
if (susfs_is_sus_su_hooks_enabled) { if (susfs_is_sus_su_hooks_enabled) {
ksu_handle_faccessat(&dfd, &filename, &mode, NULL); ksu_handle_faccessat(&dfd, &filename, &mode, NULL);

View file

@ -168,15 +168,6 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
metacopy_blocks = ovl_is_metacopy_dentry(dentry); metacopy_blocks = ovl_is_metacopy_dentry(dentry);
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
ovl_path_lowerdata(dentry, &realpath);
if (likely(realpath.mnt && realpath.dentry)) {
old_cred = ovl_override_creds(dentry->d_sb);
err = vfs_getattr(&realpath, stat, request_mask, flags);
goto out;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS #ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
ovl_path_lowerdata(dentry, &realpath); ovl_path_lowerdata(dentry, &realpath);
if (likely(realpath.mnt && realpath.dentry)) { if (likely(realpath.mnt && realpath.dentry)) {

View file

@ -327,18 +327,6 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
struct path path; struct path path;
int err; int err;
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
ovl_path_lowerdata(root_dentry, &path);
if (likely(path.mnt && path.dentry)) {
err = vfs_statfs(&path, buf);
if (!err) {
buf->f_namelen = 255; // 255 for erofs, ext2/4, f2fs
buf->f_type = path.dentry->d_sb->s_magic;
}
return err;
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS #ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
ovl_path_lowerdata(root_dentry, &path); ovl_path_lowerdata(root_dentry, &path);
if (likely(path.mnt && path.dentry)) { if (likely(path.mnt && path.dentry)) {

View file

@ -324,10 +324,6 @@ static void show_vma_header_prefix(struct seq_file *m,
extern void susfs_sus_ino_for_show_map_vma(unsigned long ino, dev_t *out_dev, unsigned long *out_ino); extern void susfs_sus_ino_for_show_map_vma(unsigned long ino, dev_t *out_dev, unsigned long *out_ino);
#endif #endif
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
extern void susfs_sus_ino_for_show_map_vma(unsigned long ino, dev_t *out_dev, unsigned long *out_ino);
#endif
static void static void
show_map_vma(struct seq_file *m, struct vm_area_struct *vma) show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
{ {

View file

@ -110,11 +110,6 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
struct super_block *sb = mnt_path.dentry->d_sb; struct super_block *sb = mnt_path.dentry->d_sb;
int err; int err;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely((r->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT) && !susfs_is_current_ksu_domain()))
return 0;
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely((r->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT) && !susfs_is_current_ksu_domain())) if (unlikely((r->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT) && !susfs_is_current_ksu_domain()))
return 0; return 0;
@ -220,11 +215,6 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
struct super_block *sb = mnt_path.dentry->d_sb; struct super_block *sb = mnt_path.dentry->d_sb;
int err; int err;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely((r->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT) && !susfs_is_current_ksu_domain()))
return 0;
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely((r->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT) && !susfs_is_current_ksu_domain())) if (unlikely((r->mnt.mnt_root->d_inode->i_state & INODE_STATE_SUS_MOUNT) && !susfs_is_current_ksu_domain()))
return 0; return 0;

View file

@ -498,11 +498,6 @@ static int compat_filldir(struct dir_context *ctx, const char *name, int namlen,
namlen + 2, sizeof(compat_long_t)); namlen + 2, sizeof(compat_long_t));
int prev_reclen; int prev_reclen;
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC) && susfs_sus_ino_for_filldir64(ino)) {
return 0;
}
#endif
buf->error = verify_dirent_name(name, namlen); buf->error = verify_dirent_name(name, namlen);
if (unlikely(buf->error)) if (unlikely(buf->error))
return buf->error; return buf->error;

View file

@ -17,7 +17,7 @@
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/compat.h> #include <linux/compat.h>
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT #if defined(CONFIG_KSU_SUSFS_SUS_KSTAT) || defined(CONFIG_KSU_SUSFS_SUS_MOUNT)
#include <linux/susfs_def.h> #include <linux/susfs_def.h>
#endif #endif
@ -31,10 +31,6 @@
extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *stat); extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *stat);
#endif #endif
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *stat);
#endif
/** /**
* generic_fillattr - Fill in the basic attributes from the inode struct * generic_fillattr - Fill in the basic attributes from the inode struct
* @inode: Inode to use as the source * @inode: Inode to use as the source
@ -47,7 +43,8 @@ extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *
void generic_fillattr(struct inode *inode, struct kstat *stat) void generic_fillattr(struct inode *inode, struct kstat *stat)
{ {
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT #ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
if (unlikely(inode->i_state & INODE_STATE_SUS_KSTAT)) { if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC) &&
unlikely(inode->i_state & INODE_STATE_SUS_KSTAT)) {
susfs_sus_ino_for_generic_fillattr(inode->i_ino, stat); susfs_sus_ino_for_generic_fillattr(inode->i_ino, stat);
stat->mode = inode->i_mode; stat->mode = inode->i_mode;
stat->rdev = inode->i_rdev; stat->rdev = inode->i_rdev;
@ -142,6 +139,7 @@ EXPORT_SYMBOL(vfs_getattr_nosec);
* *
* 0 will be returned on success, and a -ve error code if unsuccessful. * 0 will be returned on success, and a -ve error code if unsuccessful.
*/ */
int vfs_getattr(const struct path *path, struct kstat *stat, int vfs_getattr(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags) u32 request_mask, unsigned int query_flags)
{ {
@ -204,6 +202,19 @@ static int vfs_statx(int dfd, const char __user *filename, int flags,
struct path path; struct path path;
unsigned lookup_flags = 0; unsigned lookup_flags = 0;
int error; int error;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
struct mount *mnt;
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU
if (susfs_is_sus_su_hooks_enabled) {
ksu_handle_stat(&dfd, &filename, &flags);
}
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
struct mount *mnt;
#endif
#ifdef CONFIG_KSU_SUSFS_SUS_SU #ifdef CONFIG_KSU_SUSFS_SUS_SU
if (susfs_is_sus_su_hooks_enabled) { if (susfs_is_sus_su_hooks_enabled) {
@ -235,9 +246,9 @@ retry:
} }
stat->mnt_id = mnt->mnt_id; stat->mnt_id = mnt->mnt_id;
#else #else
stat->mnt_id = real_mount(path.mnt)->mnt_id; stat->mnt_id = real_mount(path.mnt)->mnt_id;
#endif #endif
stat->result_mask |= STATX_MNT_ID; stat->result_mask |= STATX_MNT_ID;
if (path.mnt->mnt_root == path.dentry) if (path.mnt->mnt_root == path.dentry)
stat->attributes |= STATX_ATTR_MOUNT_ROOT; stat->attributes |= STATX_ATTR_MOUNT_ROOT;
stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT; stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT;

View file

@ -92,7 +92,7 @@ int vfs_statfs(const struct path *path, struct kstatfs *buf)
int error; int error;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
struct mount *mnt; struct mount *mnt;
mnt = real_mount(path->mnt); mnt = real_mount(path->mnt);
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) { if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
for (; mnt->mnt_id >= DEFAULT_SUS_MNT_ID; mnt = mnt->mnt_parent) {} for (; mnt->mnt_id >= DEFAULT_SUS_MNT_ID; mnt = mnt->mnt_parent) {}

View file

@ -77,8 +77,8 @@ struct vfsmount {
ANDROID_KABI_RESERVE(1); ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2); ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3); ANDROID_KABI_RESERVE(3);
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS
ANDROID_KABI_USE(4, u64 susfs_orig_mnt_id); ANDROID_KABI_USE(4, u64 susfs_mnt_id_backup);
#else #else
ANDROID_KABI_RESERVE(4); ANDROID_KABI_RESERVE(4);
#endif #endif

View file

@ -1398,12 +1398,12 @@ struct task_struct {
ANDROID_KABI_RESERVE(4); ANDROID_KABI_RESERVE(4);
ANDROID_KABI_RESERVE(5); ANDROID_KABI_RESERVE(5);
ANDROID_KABI_RESERVE(6); ANDROID_KABI_RESERVE(6);
#ifdef CONFIG_KSU_SUSFS_SUS_PATH #ifdef CONFIG_KSU_SUSFS
ANDROID_KABI_USE(7, u64 susfs_task_state); ANDROID_KABI_USE(7, u64 susfs_task_state);
#else #else
ANDROID_KABI_RESERVE(7); ANDROID_KABI_RESERVE(7);
#endif #endif
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS
ANDROID_KABI_USE(8, u64 susfs_last_fake_mnt_id); ANDROID_KABI_USE(8, u64 susfs_last_fake_mnt_id);
#else #else
ANDROID_KABI_RESERVE(8); ANDROID_KABI_RESERVE(8);

1
patches/.gitkeep Normal file
View file

@ -0,0 +1 @@

File diff suppressed because it is too large Load diff