diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d167f3b6..e5dbd28b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,10 +64,6 @@ jobs: make mv syscallhook.kpm demo-syscallhook.kpm - cd ../make-shamiko-happy - make - mv make-shamiko-happy.kpm demo-make-shamiko-happy.kpm - - name: Upload elf uses: actions/upload-artifact@v3 with: @@ -87,7 +83,6 @@ jobs: kpms/demo-hello/demo-hello.kpm kpms/demo-inlinehook/demo-inlinehook.kpm kpms/demo-syscallhook/demo-syscallhook.kpm - kpms/make-shamiko-happy/demo-make-shamiko-happy.kpm generateReleaseNotes: true omitBodyDuringUpdate: true allowUpdates: true diff --git a/.github/workflows/build_dev.yml b/.github/workflows/build_dev.yml index 5c37f3f4..2f6ba868 100644 --- a/.github/workflows/build_dev.yml +++ b/.github/workflows/build_dev.yml @@ -72,10 +72,6 @@ jobs: make mv syscallhook.kpm demo-syscallhook.kpm - cd ../make-shamiko-happy - make - mv make-shamiko-happy.kpm demo-make-shamiko-happy.kpm - - name: Upload elf uses: actions/upload-artifact@v3 with: @@ -96,7 +92,6 @@ jobs: kpms/demo-hello/demo-hello.kpm kpms/demo-inlinehook/demo-inlinehook.kpm kpms/demo-syscallhook/demo-syscallhook.kpm - kpms/make-shamiko-happy/demo-make-shamiko-happy.kpm generateReleaseNotes: true allowUpdates: true replacesArtifacts: true diff --git a/kernel/patch/common/supercall.c b/kernel/patch/common/supercall.c index 9bb840c9..96112011 100644 --- a/kernel/patch/common/supercall.c +++ b/kernel/patch/common/supercall.c @@ -165,6 +165,18 @@ static long supercall(long cmd, long arg1, long arg2, long arg3, long arg4) case SUPERCALL_KERNEL_VER: return kver; } + + switch (cmd) { + case SUPERCALL_SKEY_GET: + break; + case SUPERCALL_SKEY_SET: + break; + case SUPERCALL_SKEY_RAND: + break; + case SUPERCALL_SKEY_TRY_HASH_AUTH: + break; + } + switch (cmd) { case SUPERCALL_SU: return call_su((struct su_profile * __user) arg1); @@ -207,8 +219,8 @@ static void before(hook_fargs6_t *args, void *udata) long a3 = (long)syscall_argn(args, 4); long a4 = (long)syscall_argn(args, 5); - uint32_t ver = (ver_xx_cmd & 0xFFFFFFFF00000000ul) >> 32; - long xx = (ver_xx_cmd & 0xFFFF0000) >> 16; + // uint32_t ver = (ver_xx_cmd & 0xFFFFFFFF00000000ul) >> 32; + // long xx = (ver_xx_cmd & 0xFFFF0000) >> 16; long cmd = ver_xx_cmd & 0xFFFF; char key[MAX_KEY_LEN]; @@ -224,7 +236,6 @@ int supercall_install() { int rc = 0; - // hook_err_t err = inline_hook_syscalln(__NR_supercall, 6, before, 0, 0); hook_err_t err = fp_hook_syscalln(__NR_supercall, 6, before, 0, 0); if (err) { log_boot("install supercall hook error: %d\n", err); diff --git a/kernel/patch/include/uapi/scdefs.h b/kernel/patch/include/uapi/scdefs.h index 51113807..070abe34 100644 --- a/kernel/patch/include/uapi/scdefs.h +++ b/kernel/patch/include/uapi/scdefs.h @@ -29,7 +29,7 @@ static inline long hash_key(const char *key) #define SUPERCALL_SKEY_GET 0x100a #define SUPERCALL_SKEY_SET 0x100b #define SUPERCALL_SKEY_RAND 0x100c -#define SUPERCALL_SKEY_HASH_AUTH 0x100d +#define SUPERCALL_SKEY_TRY_HASH_AUTH 0x100d #define SUPERCALL_SU 0x1010 #define SUPERCALL_SU_TASK 0x1011 // syscall(__NR_gettid) diff --git a/kernel/patch/module/module.c b/kernel/patch/module/module.c index 15de1ac9..ea1c2c1c 100644 --- a/kernel/patch/module/module.c +++ b/kernel/patch/module/module.c @@ -258,13 +258,6 @@ static void layout_symtab(struct module *mod, struct load_info *info) strsect->sh_entsize = get_offset(mod, &mod->size, strsect, info->index.str); } -static int license_is_gpl_compatible(const char *license) -{ - return (strcmp(license, "GPL") == 0 || strcmp(license, "GPL v2") == 0 || - strcmp(license, "GPL and additional rights") == 0 || strcmp(license, "Dual BSD/GPL") == 0 || - strcmp(license, "Dual MIT/GPL") == 0 || strcmp(license, "Dual MPL/GPL") == 0); -} - static int rewrite_section_headers(struct load_info *info) { info->sechdrs[0].sh_addr = 0; @@ -317,7 +310,8 @@ static int move_module(struct module *mod, struct load_info *info) } mod->info.name = info->info.name - info->info.base + mod->info.base; mod->info.version = info->info.version - info->info.base + mod->info.base; - mod->info.license = info->info.license - info->info.base + mod->info.base; + + if (info->info.license) mod->info.license = info->info.license - info->info.base + mod->info.base; if (info->info.author) mod->info.author = info->info.author - info->info.base + mod->info.base; if (info->info.description) mod->info.description = info->info.description - info->info.base + mod->info.base; @@ -366,10 +360,6 @@ static int setup_load_info(struct load_info *info) logkd(" version: %s\n", version); const char *license = get_modinfo(info, "license"); - if (!license || !license_is_gpl_compatible(license)) { - logkd("module license incompatible\n"); - return -ENOEXEC; - } info->info.license = license; logkd(" license: %s\n", license); diff --git a/kpms/.gitignore b/kpms/.gitignore index d4e6506a..48b4b28b 100644 --- a/kpms/.gitignore +++ b/kpms/.gitignore @@ -33,5 +33,3 @@ build/* # private -stat-sel-fs -fake-mem diff --git a/kpms/fstat/.gitignore b/kpms/fstat/.gitignore deleted file mode 100644 index 2085cbfc..00000000 --- a/kpms/fstat/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Libraries -*.lib -*.a -*.la -*.lo - -*.bin -*.elf - -*.kpm diff --git a/kpms/fstat/Makefile b/kpms/fstat/Makefile deleted file mode 100644 index a31e36a0..00000000 --- a/kpms/fstat/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -ifndef TARGET_COMPILE - $(error TARGET_COMPILE not set) -endif - -ifndef KP_DIR - KP_DIR = ../.. -endif - - -CC = $(TARGET_COMPILE)gcc -LD = $(TARGET_COMPILE)ld - -INCLUDE_DIRS := . include patch/include linux/include linux/arch/arm64/include linux/tools/arch/arm64/include - -INCLUDE_FLAGS := $(foreach dir,$(INCLUDE_DIRS),-I$(KP_DIR)/kernel/$(dir)) - -objs := main.o - -all: fstat.kpm - -fstat.kpm: ${objs} - ${CC} -r -o $@ $^ - -%.o: %.c - ${CC} $(CFLAGS) $(INCLUDE_FLAGS) -Tlink.lds -c -O2 -o $@ $< - -.PHONY: clean -clean: - rm -rf *.kpm - find . -name "*.o" | xargs rm -f \ No newline at end of file diff --git a/kpms/fstat/fstat.h b/kpms/fstat/fstat.h deleted file mode 100644 index 0ac0cf40..00000000 --- a/kpms/fstat/fstat.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2024 bmax121. All Rights Reserved. - */ - -#ifndef _KPM_STAT_FS_H_ -#define _KPM_STAT_FS_H_ - -#define FSTAT_MOD_NAME "kpm-fstat" - -#endif \ No newline at end of file diff --git a/kpms/fstat/link.lds b/kpms/fstat/link.lds deleted file mode 100644 index d599a67a..00000000 --- a/kpms/fstat/link.lds +++ /dev/null @@ -1,5 +0,0 @@ -SECTIONS { - .plt (NOLOAD) : { BYTE(0) } - .init.plt (NOLOAD) : { BYTE(0) } - .text.ftrace_trampoline (NOLOAD) : { BYTE(0) } -} \ No newline at end of file diff --git a/kpms/fstat/main.c b/kpms/fstat/main.c deleted file mode 100644 index c8deb9b8..00000000 --- a/kpms/fstat/main.c +++ /dev/null @@ -1,89 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2024 bmax121. All Rights Reserved. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fstat.h" - -KPM_NAME(FSTAT_MOD_NAME); -KPM_VERSION("1.0.0"); -KPM_LICENSE("GPL v2"); -KPM_AUTHOR("bmax121"); -KPM_DESCRIPTION("Modify the state of file system"); - -typedef __s64 time64_t; -typedef __u64 timeu64_t; - -struct timespec64 -{ - time64_t tv_sec; /* seconds */ - long tv_nsec; /* nanoseconds */ -}; - -struct stat -{ - unsigned long st_dev; /* Device. */ - unsigned long st_ino; /* File serial number. */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group. */ - unsigned long st_rdev; /* Device number, if device. */ - unsigned long __pad1; - long st_size; /* Size of file, in bytes. */ - int st_blksize; /* Optimal block size for I/O. */ - int __pad2; - long st_blocks; /* Number 512-byte blocks allocated. */ - long st_atime; /* Time of last access. */ - unsigned long st_atime_nsec; - long st_mtime; /* Time of last modification. */ - unsigned long st_mtime_nsec; - long st_ctime; /* Time of last status change. */ - unsigned long st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; -}; - -static void handler_fstat(hook_fargs6_t *args, void *udata) -{ - // copy to user len - // args->local.data0 = 0; - - char __user *ufilename = (char __user *)syscall_argn(args, 1); - char filename[128]; - int flen = compact_strncpy_from_user(filename, ufilename, sizeof(filename)); - if (flen <= 0) return; -} - -static long minit(const char *args, const char *event, void *__user reserved) -{ - hook_err_t rc = fp_hook_syscalln(__NR3264_fstatat, 4, handler_fstat, 0, (void *)__NR3264_fstatat); - pr_info("hook __NR3264_fstatat rc: %d\n", rc); - - return 0; -} - -static long mcontrol0(const char *args, char *__user out_msg, int outlen) -{ - return 0; -} - -static long mexit(void *__user reserved) -{ - return 0; -} - -KPM_INIT(minit); -KPM_CTL0(mcontrol0); -KPM_EXIT(mexit); diff --git a/kpms/make-shamiko-happy/.gitignore b/kpms/make-shamiko-happy/.gitignore deleted file mode 100644 index 2085cbfc..00000000 --- a/kpms/make-shamiko-happy/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Libraries -*.lib -*.a -*.la -*.lo - -*.bin -*.elf - -*.kpm diff --git a/kpms/make-shamiko-happy/Makefile b/kpms/make-shamiko-happy/Makefile deleted file mode 100644 index d4a56118..00000000 --- a/kpms/make-shamiko-happy/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -ifndef TARGET_COMPILE - $(error TARGET_COMPILE not set) -endif - -ifndef KP_DIR - KP_DIR = ../.. -endif - - -CC = $(TARGET_COMPILE)gcc -LD = $(TARGET_COMPILE)ld - -INCLUDE_DIRS := . include patch/include linux/include linux/arch/arm64/include linux/tools/arch/arm64/include - -INCLUDE_FLAGS := $(foreach dir,$(INCLUDE_DIRS),-I$(KP_DIR)/kernel/$(dir)) - -objs := main.o - -all: make-shamiko-happy.kpm - -make-shamiko-happy.kpm: ${objs} - ${CC} -r -o $@ $^ - -%.o: %.c - ${CC} $(CFLAGS) $(INCLUDE_FLAGS) -Thello.lds -c -O2 -o $@ $< - -.PHONY: clean -clean: - rm -rf *.kpm - find . -name "*.o" | xargs rm -f \ No newline at end of file diff --git a/kpms/make-shamiko-happy/main.c b/kpms/make-shamiko-happy/main.c deleted file mode 100644 index 17508bec..00000000 --- a/kpms/make-shamiko-happy/main.c +++ /dev/null @@ -1,109 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2023 bmax121. All Rights Reserved. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -KPM_NAME("make-shamiko-happy"); -KPM_VERSION("1.0.0"); -KPM_LICENSE("GPL v2"); -KPM_AUTHOR("bmax121"); -KPM_DESCRIPTION("Tell Shamiko(0.7.4) that we're KernelSU, make it happy."); - -void prctl_before(hook_fargs6_t *args, void *udata) -{ - uint64_t option = syscall_argn(args, 0); - - if ((option & 0xffffffff) != 0xDEADBEEF) return; - - struct task_struct *task = current; - - struct cred *cred = *(struct cred **)((uintptr_t)task + task_struct_offset.cred_offset); - uid_t uid = *(uid_t *)((uintptr_t)cred + cred_offset.euid_offset); - - if (uid) return; - - uint64_t cmd = syscall_argn(args, 1); - uint64_t arg2 = syscall_argn(args, 2); - uint64_t arg3 = syscall_argn(args, 3); - uint64_t arg4 = syscall_argn(args, 4); - uint64_t arg5 = syscall_argn(args, 5); - - // pr_info("ksu prctl: %x, %x, %x, %x, %x, %x\n", option, cmd, arg2, arg3, arg4, arg5); - - uint32_t *__user result = (uint32_t * __user) arg4; - - uint32_t reply_ok = 0xDEADBEEF; - - if (cmd == 2) { //CMD_GET_VERSION - uint32_t version = 11724; - int rc = compat_copy_to_user((void *)arg2, &version, 4); - pr_info("fake ksu version: %d, %d", version, rc); - } else if (cmd == 7) { // CMD_REPORT_EVENT - pr_info("fake ksu report event: %d", arg2); - } else if (cmd == 9) { - extern int android_is_safe_mode; - pr_info("fake ksu safe mode: %d", android_is_safe_mode); - if (android_is_safe_mode) { - compat_copy_to_user(result, &reply_ok, sizeof(reply_ok)); - } - } else if (cmd == 12 || cmd == 13) { // CMD_UID_GRANTED_ROOT 12 CMD_UID_SHOULD_UMOUNT 13 - uid_t uid = arg2; - bool res = is_su_allow_uid(uid); - if (cmd == 13) { - res = !res; - pr_info("fake ksu unmount: uid: %d\n", arg2); - } else { - pr_info("fake ksu allow: uid: %d\n", arg2); - } - compat_copy_to_user((void *)arg3, &res, sizeof(res)); - compat_copy_to_user(result, &reply_ok, sizeof(reply_ok)); - } else { - } - - args->ret = 0; - args->skip_origin = true; -} - -static long do_init(const char *args, const char *event, void *__user reserved) -{ - int rc = fp_hook_syscalln(__NR_prctl, 6, prctl_before, 0, 0); - - pr_info("init hook prctl rc: %d\n", rc); - - return 0; -} - -static long do_control0(const char *args, char *__user out_msg, int outlen) -{ - return 0; -} - -static long do_control1(void *a1, void *a2, void *a3) -{ - return 0; -} - -static long do_exit(void *__user reserved) -{ - fp_unhook_syscall(__NR_prctl, prctl_before, 0); - return 0; -} - -KPM_INIT(do_init); -KPM_CTL0(do_control0); -KPM_CTL1(do_control1); -KPM_EXIT(do_exit); diff --git a/kpms/make-shamiko-happy/main.lds b/kpms/make-shamiko-happy/main.lds deleted file mode 100644 index d599a67a..00000000 --- a/kpms/make-shamiko-happy/main.lds +++ /dev/null @@ -1,5 +0,0 @@ -SECTIONS { - .plt (NOLOAD) : { BYTE(0) } - .init.plt (NOLOAD) : { BYTE(0) } - .text.ftrace_trampoline (NOLOAD) : { BYTE(0) } -} \ No newline at end of file diff --git a/user/android/android_user.c b/user/android/android_user.c index 4f051cdc..500934ed 100644 --- a/user/android/android_user.c +++ b/user/android/android_user.c @@ -162,13 +162,13 @@ static void fork_for_result(const char *exec, char *const *argv) if (pid < 0) { log_kernel("%d fork %s error: %d\n", getpid(), exec, pid); } else if (pid == 0) { - setenv("KERNELPATCH", "true", 1); - setenv("SUPERKEY", key, 1); + setenv("KERNEL_PATCH", "true", 1); char kpver[16] = { '\0' }, kver[16] = { '\0' }; sprintf(kpver, "%x", sc_kp_ver(key)); - setenv("KERNELPATCH_VERSION", kpver, 1); + setenv("KERNEL_PATCH_VER", kpver, 1); sprintf(kver, "%x", sc_k_ver(key)); - setenv("KERNEL_VERSION", kver, 1); + setenv("KERNEL_VER", kver, 1); + setenv("SUPERKEY", key, 1); int rc = execv(exec, argv); log_kernel("%d exec %s error: %s\n", getpid(), cmd, strerror(errno)); } else { @@ -207,15 +207,6 @@ static void save_dmegs(const char *file) save_log(dmesg_argv, file); } -static void save_logcat(const char *file) -{ - char *argv[] = { - "/system/bin/logcat", - NULL, - }; - save_log(argv, file); -} - static void early_init() { struct su_profile profile = { .uid = getuid() }; diff --git a/user/supercall.h b/user/supercall.h index b09a55be..6d2a7c03 100644 --- a/user/supercall.h +++ b/user/supercall.h @@ -12,19 +12,20 @@ #include #include #include +#include "../version" #include "uapi/scdefs.h" -static inline long hash_key_cmd(const char *key, long cmd) +static inline long ver_and_cmd(const char *key, long cmd) { - long hash = hash_key(key); - return hash & 0xFFFF0000 | cmd; + uint32_t version_code = (MAJOR << 16) + (MINOR << 8) + PATCH; + return ((long)version_code << 32) | (0 & 0xFFFF0000) | (cmd & 0xFFFF); } static inline long sc_hello(const char *key) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_HELLO)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_HELLO)); return ret; } @@ -37,21 +38,21 @@ static inline long sc_klog(const char *key, const char *msg) { if (!key || !key[0]) return -EINVAL; if (!msg || strlen(msg) <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KLOG), msg); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KLOG), msg); return ret; } static inline uint32_t sc_kp_ver(const char *key) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KERNELPATCH_VER)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KERNELPATCH_VER)); return (uint32_t)ret; } static inline uint32_t sc_k_ver(const char *key) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KERNEL_VER)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KERNEL_VER)); return (uint32_t)ret; } @@ -59,14 +60,14 @@ static inline long sc_su(const char *key, struct su_profile *profile) { if (!key || !key[0]) return -EINVAL; if (strlen(profile->scontext) >= SUPERCALL_SCONTEXT_LEN) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU), profile); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU), profile); return ret; } static inline long sc_su_task(const char *key, pid_t tid, struct su_profile *profile) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_TASK), tid, profile); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_TASK), tid, profile); return ret; } @@ -74,7 +75,7 @@ static inline long sc_kpm_load(const char *key, const char *path, const char *ar { if (!key || !key[0]) return -EINVAL; if (!path || strlen(path) <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KPM_LOAD), path, args, reserved); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KPM_LOAD), path, args, reserved); return ret; } @@ -83,7 +84,7 @@ static inline long sc_kpm_control(const char *key, const char *name, const char if (!key || !key[0]) return -EINVAL; if (!name || strlen(name) <= 0) return -EINVAL; if (!ctl_args || strlen(ctl_args) <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KPM_CONTROL), name, ctl_args, out_msg, outlen); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KPM_CONTROL), name, ctl_args, out_msg, outlen); return ret; } @@ -91,14 +92,14 @@ static inline long sc_kpm_unload(const char *key, const char *name, void *reserv { if (!key || !key[0]) return -EINVAL; if (!name || strlen(name) <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KPM_UNLOAD), name, reserved); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KPM_UNLOAD), name, reserved); return ret; } static inline long sc_kpm_nums(const char *key) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KPM_NUMS)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KPM_NUMS)); return ret; } @@ -106,7 +107,7 @@ static inline long sc_kpm_list(const char *key, char *names_buf, int buf_len) { if (!key || !key[0]) return -EINVAL; if (!names_buf || buf_len <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KPM_LIST), names_buf, buf_len); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KPM_LIST), names_buf, buf_len); return ret; } @@ -114,32 +115,32 @@ static inline long sc_kpm_info(const char *key, const char *name, char *buf, int { if (!key || !key[0]) return -EINVAL; if (!buf || buf_len <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_KPM_INFO), name, buf, buf_len); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_KPM_INFO), name, buf, buf_len); return ret; } static inline long sc_pid_virt_to_phys(const char *key, pid_t pid, unsigned long vaddr) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_MEM_PHYS), pid, vaddr); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_MEM_PHYS), pid, vaddr); return ret; } static inline long sc_bootlog(const char *key) { - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_BOOTLOG)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_BOOTLOG)); return ret; } static inline long sc_panic(const char *key) { - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_PANIC)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_PANIC)); return ret; } static inline long __sc_test(const char *key, long a1, long a2, long a3) { - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_TEST), a1, a2, a3); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_TEST), a1, a2, a3); return ret; } @@ -147,21 +148,21 @@ static inline long __sc_test(const char *key, long a1, long a2, long a3) static inline long sc_su_grant_uid(const char *key, uid_t uid, struct su_profile *profile) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_GRANT_UID), uid, profile); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_GRANT_UID), uid, profile); return ret; } static inline long sc_su_revoke_uid(const char *key, uid_t uid) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_REVOKE_UID), uid); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_REVOKE_UID), uid); return ret; } static inline long sc_su_uid_nums(const char *key) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_NUMS)); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_NUMS)); return ret; } @@ -169,14 +170,14 @@ static inline long sc_su_allow_uids(const char *key, uid_t *buf, int num) { if (!key || !key[0]) return -EINVAL; if (!buf || num <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_LIST), buf, num); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_LIST), buf, num); return ret; } static inline long sc_su_uid_profile(const char *key, uid_t uid, struct su_profile *out_profile) { if (!key || !key[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_PROFILE), uid, out_profile); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_PROFILE), uid, out_profile); return ret; } @@ -184,7 +185,7 @@ static inline long sc_su_reset_path(const char *key, const char *path) { if (!key || !key[0]) return -EINVAL; if (!path || !path[0]) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_RESET_PATH), path); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_RESET_PATH), path); return ret; } @@ -192,7 +193,7 @@ static inline long sc_su_get_path(const char *key, char *buf, int buf_size) { if (!key || !key[0]) return -EINVAL; if (!buf || buf_size <= 0) return -EINVAL; - long ret = syscall(__NR_supercall, key, hash_key_cmd(key, SUPERCALL_SU_GET_PATH), buf, buf_size); + long ret = syscall(__NR_supercall, key, ver_and_cmd(key, SUPERCALL_SU_GET_PATH), buf, buf_size); return ret; }