GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fgetpriority_NEXT/kernel/routine_kp.c at master · CKAndroidProject/fgetpriority_NEXT Expand file tree/ Copy pathroutine_kp.cMore file actions 70 lines (57 loc) · 1.63 KB / Copy pathroutine_kp.cFile metadata and controls70 lines (57 loc) · 1.63 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2026 \xx * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ // heapified kprobe registration, original from https://github.com/tiann/KernelSU/commit/4593ae81c static struct kprobe *init_kprobe(const char *name, kprobe_pre_handler_t handler) { struct kprobe *kp = kzalloc(sizeof(struct kprobe), GFP_KERNEL | __GFP_NOFAIL); kp->symbol_name = name; kp->pre_handler = handler; int ret = register_kprobe(kp); pr_info("%s: register %s kprobe: %d\n", __func__, name, ret); if (ret) { kfree(kp); return nullptr; } return kp; } static void destroy_kprobe(struct kprobe **kp_ptr) { struct kprobe *kp = *kp_ptr; if (!kp) return; unregister_kprobe(kp); synchronize_rcu(); kfree(kp); *kp_ptr = nullptr; } static struct kprobe *kp_find_user = nullptr; // struct user_struct *find_user(kuid_t uid) static int kp_find_user_pre(struct kprobe *p, struct pt_regs *regs) { kuid_t *p_uid = (kuid_t *)&PT_REGS_PARM1(regs); if (getpriority_should_swap(*(int *)p_uid)) *(int *)p_uid = HIDDEN_PRIORITY_UID; return 0; } static __init int getpriority_kp_init(void) { kp_find_user = init_kprobe("find_user", (kprobe_pre_handler_t)kp_find_user_pre); if (!kp_find_user) return -EAGAIN; pr_info("%s: kp armed: 0x%lx \n", __func__, (uintptr_t)kp_find_user); return 0; } static int getpriority_kp_exit(void) { if (!!kp_find_user) pr_info("%s: disarming kp: 0x%lx \n", __func__, (uintptr_t)kp_find_user); destroy_kprobe(&kp_find_user); return 0; } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |