Re: chmod from LSM

From: Michael Halcrow (mhalcrowat_private)
Date: Thu May 22 2003 - 11:32:55 PDT

  • Next message: Chris Wright: "Re: chmod from LSM"

    On Thu, May 22, 2003 at 09:52:32AM -0700, Seth Arnold wrote:
    > Hopefully, your module is already working with a dentry or inode, in
    > which case the __user_walk() function is superfluous. (Given a pathname
    > _in userspace_, it copies the pathname to the kernel and then performs a
    > lookup on the name to find a dentry.)
    
    Hence the ``user'' in ``user_walk''... :-)  It turned out that
    path_walk was my friend in this case.  FYI, here's how I did it:
    
    struct nameidata nd;
    nd.dentry = current->fs->root;
    nd.last_type = LAST_ROOT;
    nd.flags = 0;
    error = path_walk( filename, &nd );
    // now do something with nd.dentry...
    
    Oh, and not setting up your nameidata struct correctly before the
    path_walk() call seems to be a sure-fire way to oops your kernel.
    
    Thanks for your help,
    Mike
    
    -- 
    ------------------------------------------- | ---------------------
    Michael Halcrow                             | mhalcrowat_private 
    Developer, IBM Linux Technology Center      |                      
                                                |
    ------------------------------------------- | ---------------------
    GnuPG Keyprint:  05B5 08A8 713A 64C1 D35D  2371 2D3C FDDA 3EB6 601D
    
    
    

    _______________________________________________ linux-security-module mailing list linux-security-moduleat_private http://mail.wirex.com/mailman/listinfo/linux-security-module



    This archive was generated by hypermail 2b30 : Thu May 22 2003 - 11:31:33 PDT