diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e9726c8..beaaddfa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,22 +1,8 @@ name: Build CI on: - push: - branches: ["main"] - paths: - - ".github/workflows/build.yml" - - "kernel/**" - - "user/**" - - "tools/**" - - "version" - pull_request: - branches: ["main"] - paths: - - ".github/workflows/build.yml" - - "kernel/**" - - "user/**" - - "tools/**" - - "version" + workflow_call: + workflow_dispatch: jobs: Build-kpimg: @@ -254,53 +240,53 @@ jobs: permissions: contents: write steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Generate version - shell: pwsh - run: | - $MAJOR = (Select-String -Path version -Pattern '#define MAJOR').Line.Split(' ')[2] - $MINOR = (Select-String -Path version -Pattern '#define MINOR').Line.Split(' ')[2] - $PATCH = (Select-String -Path version -Pattern '#define PATCH').Line.Split(' ')[2] - $VERSION = "$MAJOR.$MINOR.$PATCH" - Write-Output "Generated Version: $VERSION" - "VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append - Add-Content -Path $env:GITHUB_OUTPUT -Value "VERSION=$VERSION" - - uses: msys2/setup-msys2@v2 - with: - update: true - msystem: ucrt64 - path-type: inherit - install: >- - msys/make - msys/gcc - - name: Copyfile - shell: pwsh - run: | - cp .\kernel\include\preset.h .\tools\ - cd tools - (Get-Content -Path "Makefile") -replace '\$\(CC\)', " x86_64-pc-msys-gcc.exe" | Set-Content -Path "Makefile" - (Get-Content -Path "Makefile") -replace '\${CC}', "x86_64-pc-msys-gcc.exe" | Set-Content -Path "Makefile" - - name: build - shell: cmd - run: | - cd tools - msys2 -c 'make' - - - name: Copyfile2 - shell: pwsh - run: | - cp .\tools\kptools.exe .\tools\kptools-msys2.exe - 7z a kptools-msys2-win .\tools\kptools-msys2.exe D:\a\_temp\msys64\usr\bin\msys-2.0.dll - - name: Release - uses: ncipollo/release-action@v1.12.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.VERSION }} - artifacts: | - kptools-msys2-win.7z - allowUpdates: true - replacesArtifacts: true + - name: Checkout + uses: actions/checkout@v3 + - name: Generate version + shell: pwsh + run: | + $MAJOR = (Select-String -Path version -Pattern '#define MAJOR').Line.Split(' ')[2] + $MINOR = (Select-String -Path version -Pattern '#define MINOR').Line.Split(' ')[2] + $PATCH = (Select-String -Path version -Pattern '#define PATCH').Line.Split(' ')[2] + $VERSION = "$MAJOR.$MINOR.$PATCH" + Write-Output "Generated Version: $VERSION" + "VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append + Add-Content -Path $env:GITHUB_OUTPUT -Value "VERSION=$VERSION" + - uses: msys2/setup-msys2@v2 + with: + update: true + msystem: ucrt64 + path-type: inherit + install: >- + msys/make + msys/gcc + - name: Copyfile + shell: pwsh + run: | + cp .\kernel\include\preset.h .\tools\ + cd tools + (Get-Content -Path "Makefile") -replace '\$\(CC\)', " x86_64-pc-msys-gcc.exe" | Set-Content -Path "Makefile" + (Get-Content -Path "Makefile") -replace '\${CC}', "x86_64-pc-msys-gcc.exe" | Set-Content -Path "Makefile" + - name: build + shell: cmd + run: | + cd tools + msys2 -c 'make' + + - name: Copyfile2 + shell: pwsh + run: | + cp .\tools\kptools.exe .\tools\kptools-msys2.exe + 7z a kptools-msys2-win .\tools\kptools-msys2.exe D:\a\_temp\msys64\usr\bin\msys-2.0.dll + - name: Release + uses: ncipollo/release-action@v1.12.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.VERSION }} + artifacts: | + kptools-msys2-win.7z + allowUpdates: true + replacesArtifacts: true Build-kptools-windows-llvm: runs-on: ubuntu-latest diff --git a/.github/workflows/build_dev.yml b/.github/workflows/build_dev.yml index 8d217d7d..b6e34d3d 100644 --- a/.github/workflows/build_dev.yml +++ b/.github/workflows/build_dev.yml @@ -1,7 +1,22 @@ name: Build DEV CI on: - workflow_dispatch: + push: + branches: ["dev"] + paths: + - ".github/workflows/build.yml" + - "kernel/**" + - "user/**" + - "tools/**" + - "version" + pull_request: + branches: ["dev"] + paths: + - ".github/workflows/build.yml" + - "kernel/**" + - "user/**" + - "tools/**" + - "version" jobs: Build-kpimg: diff --git a/kernel/patch/common/sucompat.c b/kernel/patch/android/sucompat.c similarity index 95% rename from kernel/patch/common/sucompat.c rename to kernel/patch/android/sucompat.c index 61441fec..48f4363c 100644 --- a/kernel/patch/common/sucompat.c +++ b/kernel/patch/android/sucompat.c @@ -345,7 +345,27 @@ static void handle_before_execve(hook_local_t *hook_local, char **__user u_filen commit_su(0, 0); - // command + // real command +#define EMBEDDED_NAME_MAX (PATH_MAX - sizeof(*filename) - 128) // enough + + const char *exec = sh_path; + int exec_len = sizeof(sh_path); + const char __user *p2 = get_user_arg_ptr(0, *uargv, 2); + + if (p1 && !IS_ERR(p2)) { + char buffer[EMBEDDED_NAME_MAX]; + int len = compact_strncpy_from_user(buffer, p2, EMBEDDED_NAME_MAX); + if (len >= 0) { + exec = buffer; + exec_len = len; + } + } + + int cplen = 0; +#ifdef TRY_DIRECT_MODIFY_USER + cplen = compat_copy_to_user(*u_filename_p, exec, exec_len); +#endif + if (cplen <= 0) *u_filename_p = copy_to_user_stack(exec, exec_len); // shift args *uargv += 2 * 8; diff --git a/kernel/patch/android/sucompat.c1 b/kernel/patch/android/sucompat.c1 deleted file mode 100644 index 619aa60e..00000000 --- a/kernel/patch/android/sucompat.c1 +++ /dev/null @@ -1,571 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const char sh_path[] = ANDROID_SH_PATH; -static const char default_su_path[] = ANDROID_SU_PATH; -static const char *current_su_path = 0; -static const char apd_path[] = APD_PATH; -static const char kpatch_supercmd[] = SUPERCMD; - -struct allow_uid -{ - uid_t uid; - struct su_profile profile; - struct list_head list; - struct rcu_head rcu; -}; - -static struct list_head allow_uid_list; -static spinlock_t list_lock; - -static void allow_reclaim_callback(struct rcu_head *rcu) -{ - struct allow_uid *allow = container_of(rcu, struct allow_uid, rcu); - kvfree(allow); -} - -static struct su_profile *search_allow_uid(uid_t uid) -{ - rcu_read_lock(); - struct allow_uid *pos; - list_for_each_entry_rcu(pos, &allow_uid_list, list) - { - if (pos->uid == uid) { - // make a deep copy - struct su_profile *profile = (struct su_profile *)vmalloc(sizeof(struct su_profile)); - memcpy(profile, &pos->profile, sizeof(struct su_profile)); - rcu_read_unlock(); - return profile; - } - } - rcu_read_unlock(); - return 0; -} - -static int is_allow_uid(uid_t uid) -{ - rcu_read_lock(); - struct allow_uid *pos; - list_for_each_entry_rcu(pos, &allow_uid_list, list) - { - if (pos->uid == uid) { - rcu_read_unlock(); - return 1; - } - } - rcu_read_unlock(); - return 0; -} - -int su_add_allow_uid(uid_t uid, struct su_profile *profile, int async) -{ - rcu_read_lock(); - struct allow_uid *pos, *old = 0; - list_for_each_entry(pos, &allow_uid_list, list) - { - if (pos->uid == uid) { - old = pos; - break; - } - } - struct allow_uid *new = (struct allow_uid *)vmalloc(sizeof(struct allow_uid)); - new->uid = profile->uid; - memcpy(&new->profile, profile, sizeof(struct su_profile)); - new->profile.scontext[sizeof(new->profile.scontext) - 1] = '\0'; - - spin_lock(&list_lock); - if (old) { // update - list_replace_rcu(&old->list, &new->list); - logkfi("update uid: %d, to_uid: %d, sctx: %s\n", uid, new->profile.to_uid, new->profile.scontext); - } else { // add new one - list_add_rcu(&new->list, &allow_uid_list); - logkfi("new uid: %d, to_uid: %d, sctx: %s\n", uid, new->profile.to_uid, new->profile.scontext); - } - spin_unlock(&list_lock); - - rcu_read_unlock(); - if (old) { - if (async) { - call_rcu(&old->rcu, allow_reclaim_callback); - } else { - synchronize_rcu(); - kvfree(old); - } - } - return 0; -} - -int su_remove_allow_uid(uid_t uid, int async) -{ - struct allow_uid *pos; - spin_lock(&list_lock); - list_for_each_entry(pos, &allow_uid_list, list) - { - if (pos->uid == uid) { - list_del_rcu(&pos->list); - spin_unlock(&list_lock); - logkfi("uid: %d, to_uid: %d, sctx: %s\n", pos->uid, pos->profile.to_uid, pos->profile.scontext); - if (async) { - call_rcu(&pos->rcu, allow_reclaim_callback); - } else { - synchronize_rcu(); - kvfree(pos); - } - return 0; - } - } - spin_unlock(&list_lock); - return 0; -} - -int su_allow_uid_nums() -{ - int num = 0; - rcu_read_lock(); - struct allow_uid *pos; - list_for_each_entry(pos, &allow_uid_list, list) - { - num++; - } - rcu_read_unlock(); - logkfd("%d\n", num); - return num; -} - -int su_allow_uids(uid_t *__user uuids, int unum) -{ - int rc = 0; - int num = 0; - rcu_read_lock(); - struct allow_uid *pos; - list_for_each_entry(pos, &allow_uid_list, list) - { - if (num >= unum) { - goto out; - } - uid_t uid = pos->profile.uid; - int cplen = compat_copy_to_user(uuids + num, &uid, sizeof(uid)); - logkfd("uid: %d\n", uid); - if (cplen <= 0) { - logkfd("compat_copy_to_user error: %d", cplen); - rc = cplen; - goto out; - } - num++; - } - rc = num; -out: - rcu_read_unlock(); - return rc; -} - -int su_allow_uid_profile(uid_t uid, struct su_profile *__user uprofile) -{ - int rc = -ENOENT; - rcu_read_lock(); - struct allow_uid *pos; - list_for_each_entry(pos, &allow_uid_list, list) - { - if (pos->profile.uid != uid) continue; - int cplen = compat_copy_to_user(uprofile, &pos->profile, sizeof(struct su_profile)); - logkfd("profile: %d %d %s\n", uid, pos->profile.to_uid, pos->profile.scontext); - if (cplen <= 0) { - logkfd("compat_copy_to_user error: %d", cplen); - rc = cplen; - goto out; - } - rc = 0; - goto out; - } -out: - rcu_read_unlock(); - return rc; -} - -// no free, no lock -int su_reset_path(const char *path) -{ - if (!path) return -EINVAL; - int len = strlen(path); - if (len <= 0) return -EINVAL; - char *new_su_path = vmalloc(len + 1); - if (!new_su_path) return -ENOMEM; - strcpy(new_su_path, path); - new_su_path[len] = '\0'; - current_su_path = new_su_path; - dsb(ishst); - logkfi("%s\n", current_su_path); - return 0; -} - -int su_get_path(char *__user ubuf, int buf_len) -{ - if (!current_su_path) { - logkfi("null su path\n"); - current_su_path = default_su_path; - } - int len = strnlen(current_su_path, SU_PATH_MAX_LEN); - if (len <= 0) return -EINVAL; - if (buf_len < len) return -ENOBUFS; - logkfi("%s\n", current_su_path); - return compat_copy_to_user(ubuf, current_su_path, len + 1); -} - -// todo: rcu_dereference_protected -static uid_t current_uid() -{ - struct cred *cred = *(struct cred **)((uintptr_t)current + task_struct_offset.cred_offset); - uid_t uid = *(uid_t *)((uintptr_t)cred + cred_offset.uid_offset); - return uid; -} - -/* KernelSU idea */ -static void *__user copy_to_user_stack(void *data, size_t len) -{ - uintptr_t addr = current_user_stack_pointer(); - addr -= len; - addr &= 0xFFFFFFFFFFFFFFF0; - compat_copy_to_user((void *)addr, data, len); - return (void *)addr; -} - -static inline char *__user android_sh_user_path() -{ - return (char *__user)copy_to_user_stack((void *)sh_path, sizeof(sh_path)); -} - -static inline char *__user android_su_user_path() -{ - int len = strlen(current_su_path); - return (char *__user)copy_to_user_stack((void *)current_su_path, len); -} - -// int do_execveat_common(int fd, struct filename *filename, struct user_arg_ptr argv, struct user_arg_ptr envp, int flags) -// int __do_execve_file(int fd, struct filename *filename, struct user_arg_ptr argv, struct user_arg_ptr envp, int flags, -// struct file *file); -// static int do_execve_common(struct filename *filename, struct user_arg_ptr argv, struct user_arg_ptr envp) -static void before_do_execve(hook_fargs8_t *args, void *udata) -{ - struct filename *filename; - int filename_index = 0; - if ((((uintptr_t)args->arg0) & 0xFFFF000000000000) != 0xFFFF000000000000) { - // int, AT_FDCWD(ffffff9c) or fd - filename_index = 1; - } - filename = (struct filename *)args->args[filename_index]; - - if (!filename || IS_ERR(filename)) return; - - if (!strcmp(current_su_path, filename->name)) { - uid_t uid = current_uid(); - struct su_profile *profile = search_allow_uid(uid); - if (!profile) return; - - uid_t to_uid = profile->to_uid; - const char *sctx = profile->scontext; - commit_su(to_uid, sctx); - - struct file *filp = filp_open(apd_path, O_RDONLY, 0); - if (!filp || IS_ERR(filp)) { - logkfi("call su uid: %d, to_uid: %d, sctx: %s\n", uid, to_uid, sctx); - strcpy((char *)filename->name, sh_path); - } else { - filp_close(filp, 0); - logkfi("call apd uid: %d, to_uid: %d, sctx: %s\n", uid, to_uid, sctx); - strcpy((char *)filename->name, apd_path); - const char *__user p0 = - get_user_arg_ptr((void *)args->args[filename_index + 1], (void *)args->args[filename_index + 2], 0); - int sz = compat_copy_to_user((char *__user)p0, default_su_path, sizeof(default_su_path)); - if (sz != sizeof(default_su_path)) { - logkfe("compat_copy_to_user error: %d\n", sz); - } - } - kvfree(profile); - } else if (!strcmp(kpatch_supercmd, filename->name)) { - void *ua0 = (void *)args->args[filename_index + 1]; - void *ua1 = (void *)args->args[filename_index + 2]; - // key - const char __user *p1 = get_user_arg_ptr(ua0, ua1, 1); - if (!p1 || IS_ERR(p1)) return; - - // auth skey - char arg1[SUPER_KEY_LEN]; - if (compact_strncpy_from_user(arg1, p1, sizeof(arg1)) <= 0) return; - if (superkey_auth(arg1)) return; - - commit_su(0, 0); - - // real exec - const char __user *p2 = get_user_arg_ptr(ua0, ua1, 2); - - if (!p2 || IS_ERR(p2)) { - strcpy((char *)filename->name, sh_path); - return; - } - -#define EMBEDDED_NAME_MAX (PATH_MAX - sizeof(*filename) - 128) // enough - - int len = compact_strncpy_from_user((char *)filename->name, p2, EMBEDDED_NAME_MAX); - if (unlikely(len < 0)) return; - - // user_arg_ptr - if (has_config_compat) { - if (ua0) { - args->args[filename_index + 2] += 2 * 4; - } else { - args->args[filename_index + 2] += 2 * 8; - } - } else { - args->args[filename_index + 1] += 2 * 8; - } - - // char option[128]; - // for (int i = 3; i < 10; i++) { - // const char *pn = - // get_user_arg_ptr((void *)args->args[filename_index + 1], (void *)args->args[filename_index + 2], i); - // if (!pn || IS_ERR(pn)) break; - // compact_strncpy_from_user(option, pn, sizeof(option)); - // if (!strcmp("--path", option)) { - // i++; - // pn = - // get_user_arg_ptr((void *)args->args[filename_index + 1], (void *)args->args[filename_index + 2], i); - // if (!pn || IS_ERR(pn)) break; - // compact_strncpy_from_user(option, pn, sizeof(option)); - // strcpy((char *)filename->name, option); - // } - // } - } - - return; -} - -// long do_faccessat(int dfd, const char __user *filename, int mode, int flags) -// SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode) -// SYSCALL_DEFINE4(faccessat2, int, dfd, const char __user *, filename, int, mode, int, flags) -static void before_faccessat(hook_fargs4_t *args, void *udata) -{ - uid_t uid = current_uid(); - if (!is_allow_uid(uid)) return; - - const char *local_su_path = current_su_path; - - char __user *filename = (char __user *)args->arg1; - char buf[SU_PATH_MAX_LEN]; - compact_strncpy_from_user(buf, filename, sizeof(buf)); - if (strcmp(buf, local_su_path)) return; - - logkfd("uid: %d\n", uid); - args->ret = 0; - args->skip_origin = 1; -} - -// int vfs_statx(int dfd, struct filename *filename, int flags, struct kstat *stat, u32 request_mask) -// int do_statx(int dfd, struct filename *filename, unsigned int flags, unsigned int mask, struct statx __user *buffer) -// int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, int flags) -// int do_statx(int dfd, struct filename *filename, unsigned int flags, unsigned int mask, struct statx __user *buffer) -// int do_statx(int dfd, const char __user *filename, unsigned flags, unsigned int mask, struct statx __user *buffer) -// int vfs_statx(int dfd, const char __user *filename, int flags, struct kstat *stat, u32 request_mask) -static void before_stat(hook_fargs8_t *args, void *udata) -{ - int change_flag = 0; - args->local.data[0] = change_flag; - - uid_t uid = current_uid(); - if (!is_allow_uid(uid)) return; - - struct filename *filename = 0; - char *__user u_filename = 0; - - const char *local_su_path = current_su_path; - - // assume this is kernel address - if ((((uintptr_t)args->arg1) & 0xFFFF000000000000) == 0xFFFF000000000000) { - filename = (struct filename *)args->arg1; - if (!filename || IS_ERR(filename)) return; - if (strcmp(filename->name, local_su_path)) return; - } else { - u_filename = (char *)args->arg1; - char buf[SU_PATH_MAX_LEN]; - compact_strncpy_from_user(buf, u_filename, sizeof(buf)); - if (strcmp(buf, local_su_path)) return; - } - - if (filename) { - logkfd("0 uid: %d\n", uid); - strcpy((char *)filename->name, sh_path); - } else { - logkfd("1 uid: %d\n", uid); - int sz = compat_copy_to_user(u_filename, sh_path, sizeof(sh_path)); - if (sz == sizeof(sh_path)) { - change_flag = 1; - args->local.data[0] = change_flag; - args->local.data[1] = (uint64_t)local_su_path; - } else { - // logkfe("compat_copy_to_user error: %d\n", sz); - args->arg1 = (uint64_t)android_sh_user_path(); - } - } -} - -static void after_stat(hook_fargs8_t *args, void *udata) -{ - int change_flag = args->local.data[0]; - if (change_flag) { - const char *local_su_path = (const char *)args->local.data[1]; - int sz = compat_copy_to_user((void *)args->arg1, local_su_path, strlen(local_su_path) + 1); - if (sz != strlen(local_su_path) + 1) logkfe("compat_copy_to_user error: %d\n", sz); - } -} - -// // static ssize_t path_getxattr(const char __user *pathname, const char __user *name, void __user *value, size_t size, unsigned int lookup_flags) -// static void before_path_getxattr(hook_fargs5_t *args, void *udata) -// { -// int change_flag = 0; -// args->local.data[0] = change_flag; - -// char buf[sizeof(su_path)]; -// compact_strncpy_from_user(buf, (char *__user)args->arg0, sizeof(buf)); -// if (strcmp(su_path, buf)) return; - -// uid_t uid = current_uid(); -// if (!is_allow_uid(uid)) return; - -// logkfd("uid: %d\n", uid); -// int sz = compat_copy_to_user((char *__user)args->arg0, sh_path, sizeof(sh_path)); -// if (sz != sizeof(sh_path)) logkfe("compat_copy_to_user error: %d\n", sz); - -// change_flag = 1; -// args->local.data[0] = change_flag; -// } - -// static void after_path_getxattr(hook_fargs5_t *args, void *udata) -// { -// int change_flag = args->local.data[0]; -// if (change_flag) { -// int sz = compat_copy_to_user((void *)args->arg0, su_path, sizeof(su_path)); -// if (sz != sizeof(su_path)) logkfe("compat_copy_to_user error: %d\n", sz); -// } -// } - -int su_compat_init() -{ - int rc = 0; - - current_su_path = default_su_path; - - INIT_LIST_HEAD(&allow_uid_list); - spin_lock_init(&list_lock); - - // default shell - struct su_profile default_shell_profile = { - .uid = 2000, - .to_uid = 0, - }; - su_add_allow_uid(default_shell_profile.uid, &default_shell_profile, 1); - - hook_err_t err = HOOK_NO_ERR; - - // stat - unsigned long vfs_stat_addr = get_preset_patch_sym()->vfs_statx; - if (!vfs_stat_addr) vfs_stat_addr = get_preset_patch_sym()->do_statx; - if (!vfs_stat_addr) vfs_stat_addr = get_preset_patch_sym()->vfs_fstatat; - if (!vfs_stat_addr) { - log_boot("no symbol vfs_fstatat, do_statx or vfs_statx\n"); - rc = -ENOENT; - goto out; - } else { - err |= hook_wrap8((void *)vfs_stat_addr, before_stat, after_stat, 0); - if (err) { - log_boot("hook vfs_fstatat error: %d\n", err); - rc = err; - goto out; - } - } - - unsigned long xxx = kallsyms_lookup_name("vfs_stat"); - logkd("aaaaaaaaaaaaaaa %llx\n", xxx); - err |= hook_wrap8((void *)xxx, before_stat, after_stat, 0); - - // access - unsigned long do_accessat_addr = get_preset_patch_sym()->do_faccessat; - if (do_accessat_addr) { - err |= hook_wrap4((void *)do_accessat_addr, before_faccessat, 0, 0); - if (err) { - log_boot("hook do_faccessat error: %d\n", err); - rc = err; - goto out; - } - } else { - unsigned long faccessat_addr = get_preset_patch_sym()->sys_faccessat; - unsigned long faccessat2_addr = get_preset_patch_sym()->sys_faccessat; - err |= hook_wrap4((void *)faccessat_addr, before_faccessat, 0, 0); - err |= hook_wrap4((void *)faccessat2_addr, before_faccessat, 0, 0); - if (err) { - log_boot("hook do_faccessat error: %d\n", err); - rc = err; - goto out; - } - } - - // execv - err |= add_execv_hook(before_do_execve, 0, 0); - if (err) { - log_boot("hook add execv error: %d\n", err); - rc = err; - goto out; - } - - // xattr - // unsigned long path_getxattr_addr = kallsyms_lookup_name("path_getxattr"); - // if (!path_getxattr_addr) { - // log_boot("no symbol do_faccessat or sys_faccessat\n"); - // rc = -ENOENT; - // goto out; - // } else { - // hook_err_t err = hook_wrap5((void *)path_getxattr_addr, before_path_getxattr, after_path_getxattr, 0); - // if (err) { - // log_boot("hook do_faccessat error: %d\n", err); - // rc = err; - // goto out; - // } - // } - -out: - return rc; -} \ No newline at end of file diff --git a/tools/patch.c b/tools/patch.c index c4aaa11e..59325589 100644 --- a/tools/patch.c +++ b/tools/patch.c @@ -83,8 +83,8 @@ void print_preset_info(preset_t *preset) setup_preset_t *setup = &preset->setup; version_t ver = header->kp_version; uint32_t ver_num = (ver.major << 16) + (ver.minor << 8) + ver.patch; - bool is_android = header->config_flags | CONFIG_ANDROID; - bool is_debug = header->config_flags | CONFIG_DEBUG; + bool is_android = (header->config_flags | CONFIG_ANDROID) == CONFIG_ANDROID; + bool is_debug = (header->config_flags & CONFIG_DEBUG) == CONFIG_DEBUG; fprintf(stdout, INFO_KP_IMG_SESSION "\n"); fprintf(stdout, "version=0x%x\n", ver_num); diff --git a/user/android/android_user.c b/user/android/android_user.c index fcc36319..bf01dadc 100644 --- a/user/android/android_user.c +++ b/user/android/android_user.c @@ -231,8 +231,6 @@ int android_user(int argc, char **argv) char *scmd = argv[1]; if (scmd == NULL) return -EINVAL; - log_kernel("cmd: %s\n", scmd); - int optc; while ((optc = getopt_long(argc, argv, "k", longopts, NULL)) != -1) { switch (optc) { diff --git a/version b/version index d68ebbb8..8ffe67de 100644 --- a/version +++ b/version @@ -1,3 +1,3 @@ #define MAJOR 0 #define MINOR 10 -#define PATCH 0 +#define PATCH 1