Skip to content

Instantly share code, notes, and snippets.

@jamietanna
Created February 10, 2016 20:48
Show Gist options
  • Save jamietanna/6bfde28c8b1e872e1e49 to your computer and use it in GitHub Desktop.
Save jamietanna/6bfde28c8b1e872e1e49 to your computer and use it in GitHub Desktop.
Find the current process name in Kernel-mode
struct file *exe_file;
struct mm_struct *mm = current->mm;
if(mm) {
struct file *exe_file;
exe_file = get_mm_exe_file(mm);
if(exe_file) {
printk("open(): process called is %s\n", exe_file->f_path.dentry->d_name.name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment