Created
September 11, 2020 21:55
-
-
Save linuxthor/a2b2ef9e39470fd6dd188b25c427322b to your computer and use it in GitHub Desktop.
Use a kprobe to find the address of some kernel symbol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/module.h> | |
#include <linux/init.h> | |
#include <linux/kernel.h> | |
#include <linux/kprobes.h> | |
static struct kprobe kp = { | |
.symbol_name = "kallsyms_lookup_name" | |
}; | |
int init_module(void) | |
{ | |
register_kprobe(&kp); | |
printk("Found at %px \n", kp.addr); | |
return 0; | |
} | |
void cleanup_module(void) | |
{ | |
unregister_kprobe(&kp); | |
} | |
MODULE_AUTHOR("linuxthor"); | |
MODULE_LICENSE("GPL"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment