- This is a heavily modified version of susfs v1.5.12
- It does not comply with the upstream offical susfs v1.5.12
- sus_mount functionality still remain in v1.5.5 as backporting it to the latest version will result a mount detection leak in some apps/detectors
- Increase susfs_open_redirect UID limit to <11000
- susfs magic mount support is still implemented and enabled
- sus_map is implemented and complied with the upstream v1.5.12 codebase
This commit requires a bunch of backports commits from v4.19 and v5.x to make sus_map working:
0a8cbf3725edbacc5f1ead33eeae7e4d78823b5a proc: less memory for /proc/*/map_files readdir
37ae2444584654f6785f2cc49181f05af788c9b2 mm: smaps: split PSS into components
49a5115e11350ee68f6a5fbd56b3e817bf9e5aac fs/task_mmu: add pkeys header
6f94042bed51121f8f28a5e572cda20c21fed2e1 mm/pkeys: Add an empty arch_pkeys_enabled()
bbd5aec12b32097a71dc6a0097194a18f3ee9a17 mm/pkeys, powerpc, x86: Provide an empty vma_pkey() in linux/pkeys.h
849ca8ce954d9dbb082dcf83c98af861e98e5635 mm: /proc/pid/smaps_rollup: convert to single value seq_file
6071a482c8e603be25895cc2cac5f0eab61c4051 mm: /proc/pid/smaps: factor out common stats printing
03fd2fbe9c40da8128cec5c69ef54755c0f38c6c mm: /proc/pid/smaps: factor out mem stats gathering
95f8be4c8a86a491a1c2ac9bfe470aef9e1baa8f mm: /proc/pid/*maps remove is_pid and related wrappers
27956d255e3b012372951dd6131e07c106d2daae procfs: add seq_put_hex_ll to speed up /proc/pid/maps
7f2847d02cdc4491b5ee6d4a0043854cbd6c7a1a proc: add seq_put_decimal_ull_width to speed up /proc/pid/smaps
For KernelSU side patches for this commit you need the sidex15's KernelSU-Next fork:
https://github.com/sidex15/KernelSU-Next/tree/n3x7g3n-kernel
Or if you want to patch on your own here's the commit patch of susfs in the KernelSU-Next:
13b1dfd6e2
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
72 lines
1.7 KiB
C
72 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/fs.h>
|
|
#include <linux/init.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
#ifdef CONFIG_INITRAMFS_IGNORE_SKIP_FLAG
|
|
#include <asm/setup.h>
|
|
#endif
|
|
|
|
#ifdef CONFIG_INITRAMFS_IGNORE_SKIP_FLAG
|
|
#define INITRAMFS_STR_FIND "skip_initramfs"
|
|
#define INITRAMFS_STR_REPLACE "want_initramfs"
|
|
#define INITRAMFS_STR_LEN (sizeof(INITRAMFS_STR_FIND) - 1)
|
|
|
|
static char proc_command_line[COMMAND_LINE_SIZE];
|
|
|
|
static void proc_command_line_init(void) {
|
|
char *offset_addr;
|
|
|
|
strcpy(proc_command_line, saved_command_line);
|
|
|
|
offset_addr = strstr(proc_command_line, INITRAMFS_STR_FIND);
|
|
if (!offset_addr)
|
|
return;
|
|
|
|
memcpy(offset_addr, INITRAMFS_STR_REPLACE, INITRAMFS_STR_LEN);
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG
|
|
extern int susfs_spoof_cmdline_or_bootconfig(struct seq_file *m);
|
|
#endif
|
|
|
|
static int cmdline_proc_show(struct seq_file *m, void *v)
|
|
{
|
|
#ifdef CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG
|
|
if (!susfs_spoof_cmdline_or_bootconfig(m)) {
|
|
seq_putc(m, '\n');
|
|
return 0;
|
|
}
|
|
#endif
|
|
#ifdef CONFIG_INITRAMFS_IGNORE_SKIP_FLAG
|
|
seq_printf(m, "%s\n", proc_command_line);
|
|
#else
|
|
seq_printf(m, "%s\n", saved_command_line);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
static int cmdline_proc_open(struct inode *inode, struct file *file)
|
|
{
|
|
return single_open(file, cmdline_proc_show, NULL);
|
|
}
|
|
|
|
static const struct file_operations cmdline_proc_fops = {
|
|
.open = cmdline_proc_open,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.release = single_release,
|
|
};
|
|
|
|
static int __init proc_cmdline_init(void)
|
|
{
|
|
#ifdef CONFIG_INITRAMFS_IGNORE_SKIP_FLAG
|
|
proc_command_line_init();
|
|
#endif
|
|
|
|
proc_create("cmdline", 0, NULL, &cmdline_proc_fops);
|
|
return 0;
|
|
}
|
|
fs_initcall(proc_cmdline_init);
|