Backport CMD_SUSFS_HIDE_SUS_MNTS_FOR_ALL_PROCS

This commit is contained in:
Phapoom Saksri 2025-05-22 22:28:01 +07:00
parent e82f86e8f7
commit ed4a9c02cc
2 changed files with 12 additions and 3 deletions

View file

@ -21,6 +21,14 @@
#include "pnode.h"
#include "internal.h"
/* This is very good example if you still don't get it.*/
/* More info: https://github.com/KernelSU-Next/KernelSU-Next/commit/8df2cbcade8a46eef98fb2ed0deb68ad51155232#commitcomment-156399657 */
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
extern bool susfs_is_current_ksu_domain(void);
bool susfs_hide_sus_mnts_for_all_procs = true; // hide sus mounts for all processes by default
#endif
static __poll_t mounts_poll(struct file *file, poll_table *wait)
{
struct seq_file *m = file->private_data;
@ -106,7 +114,7 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
int err;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely(r->mnt_id >= DEFAULT_SUS_MNT_ID))
if (unlikely(r->mnt_id >= DEFAULT_SUS_MNT_ID) && (susfs_hide_sus_mnts_for_all_procs || !susfs_is_current_ksu_domain()))
return 0;
#endif
@ -147,7 +155,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
int err;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely(r->mnt_id >= DEFAULT_SUS_MNT_ID))
if (unlikely(r->mnt_id >= DEFAULT_SUS_MNT_ID) && (susfs_hide_sus_mnts_for_all_procs || !susfs_is_current_ksu_domain()))
return 0;
#endif
@ -216,7 +224,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
int err;
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
if (unlikely(r->mnt_id >= DEFAULT_SUS_MNT_ID))
if (unlikely(r->mnt_id >= DEFAULT_SUS_MNT_ID) && (susfs_hide_sus_mnts_for_all_procs || !susfs_is_current_ksu_domain()))
return 0;
#endif

View file

@ -9,6 +9,7 @@
/* shared with userspace ksu_susfs tool */
#define CMD_SUSFS_ADD_SUS_PATH 0x55550
#define CMD_SUSFS_ADD_SUS_MOUNT 0x55560
#define CMD_SUSFS_HIDE_SUS_MNTS_FOR_ALL_PROCS 0x55561
#define CMD_SUSFS_ADD_SUS_KSTAT 0x55570
#define CMD_SUSFS_UPDATE_SUS_KSTAT 0x55571
#define CMD_SUSFS_ADD_SUS_KSTAT_STATICALLY 0x55572