English 中文(简体)
我怎样才能得到目前进程的整整数,在舱内进行迫害?
原标题:How do I get the inode number of the current process s executable inside kernel module?

载于m_inode *>。 我正在寻找类似的东西。

外部/外部系统是否把这一信息储存到任何地方,或者在装上记忆时丢失了吗?

问题回答

没有任何直接联系。 <代码>proc_exe_link(>>功能通过在编造档案的任务中寻找第一个可起诉的版本获取这一信息。 请注意:

struct dentry *dentry = NULL;
struct vfsmount *mnt = NULL;
struct vm_area_struct * vma;

down_read(&current->mm->mmap_sem);

vma = current->mm->mmap;
while (vma) {
    if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file)
        break;
    vma = vma->vm_next;
}

if (vma) {
    mnt = mntget(vma->vm_file->f_path.mnt);
    dentry = dget(vma->vm_file->f_path.dentry);
}

up_read(&current->mm->mmap_sem);

if (dentry) {
    /* inode is dentry->d_inode */
}

当然,这并没有消失。 就在近期的欧伦特油轮中,跟踪该油轮是很复杂的。

近期的Libert kernel,身着“构造”号,首先需要用以下方法获得“构造毫米”:

    mm = get_task_mm(task); 

之后

    exe_file = get_mm_exe_file(mm);

如今,你有排泄物档案的固定文件点,有结构文件,可以:

    struct inode *inode = file->f_path.dentry->d_inode;

BTW,“获得_mm_exe_file()”的定义是

struct file *get_mm_exe_file(struct mm_struct *mm)
{       
        struct file *exe_file;

        /* We need mmap_sem to protect against races with removal of
         * VM_EXECUTABLE vmas */
        down_read(&mm->mmap_sem);
        exe_file = mm->exe_file;
        if (exe_file)
                get_file(exe_file);
        up_read(&mm->mmap_sem);
        return exe_file;
}




相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

Relation between USB and PCI

I m bit confused by the following statement in linux device drivers book. http://www.linuxdriver.co.il/ldd3/ 13.2. USB and Sysfs To help understand what this long device path means, we describe ...

Configuring kernel

After create a new system call, how to update the kernel? I tried these lines, make-kpkg clean fakeroot make-kpkg -initrd -append-to-version=-custom kernel_image kernel_headers But Ubuntu asked me ...

热门标签