• David Howells's avatar
    vfs: Add LSM hooks for the new mount API · da2441fd
    David Howells authored
    Add LSM hooks for use by the new mount API and filesystem context code.
    This includes:
    
     (1) Hooks to handle allocation, duplication and freeing of the security
         record attached to a filesystem context.
    
     (2) A hook to snoop source specifications.  There may be multiple of these
         if the filesystem supports it.  They will to be local files/devices if
         fs_context::source_is_dev is true and will be something else, possibly
         remote server specifications, if false.
    
     (3) A hook to snoop superblock configuration options in key[=val] form.
         If the LSM decides it wants to handle it, it can suppress the option
         being passed to the filesystem.  Note that 'val' may include commas
         and binary data with the fsopen patch.
    
     (4) A hook to perform validation and allocation after the configuration
         has been done but before the superblock is allocated and set up.
    
     (5) A hook to transfer the security from the context to a newly created
         superblock.
    
     (6) A hook to rule on whether a path point can be used as a mountpoint.
    
    These are intended to replace:
    
    	security_sb_copy_data
    	security_sb_kern_mount
    	security_sb_mount
    	security_sb_set_mnt_opts
    	security_sb_clone_mnt_opts
    	security_sb_parse_opts_str
    
    [AV -- some of the methods being replaced are already gone, some of the
    methods are not added for the lack of need]
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    cc: linux-security-module@vger.kernel.org
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    da2441fd
security.c 45.7 KB