aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/security.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-06-01 13:34:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-06-01 13:34:35 -0400
commit1193755ac6328ad240ba987e6ec41d5e8baf0680 (patch)
tree40bf847d7e3ebaa57b107151d14e6cd1d280cc6d /include/linux/security.h
parent4edebed86690eb8db9af3ab85baf4a34e73266cc (diff)
parent0ef97dcfce4179a2eba046b855ee2f91d6f1b414 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs changes from Al Viro. "A lot of misc stuff. The obvious groups: * Miklos' atomic_open series; kills the damn abuse of ->d_revalidate() by NFS, which was the major stumbling block for all work in that area. * ripping security_file_mmap() and dealing with deadlocks in the area; sanitizing the neighborhood of vm_mmap()/vm_munmap() in general. * ->encode_fh() switched to saner API; insane fake dentry in mm/cleancache.c gone. * assorted annotations in fs (endianness, __user) * parts of Artem's ->s_dirty work (jff2 and reiserfs parts) * ->update_time() work from Josef. * other bits and pieces all over the place. Normally it would've been in two or three pull requests, but signal.git stuff had eaten a lot of time during this cycle ;-/" Fix up trivial conflicts in Documentation/filesystems/vfs.txt (the 'truncate_range' inode method was removed by the VM changes, the VFS update adds an 'update_time()' method), and in fs/btrfs/ulist.[ch] (due to sparse fix added twice, with other changes nearby). * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (95 commits) nfs: don't open in ->d_revalidate vfs: retry last component if opening stale dentry vfs: nameidata_to_filp(): don't throw away file on error vfs: nameidata_to_filp(): inline __dentry_open() vfs: do_dentry_open(): don't put filp vfs: split __dentry_open() vfs: do_last() common post lookup vfs: do_last(): add audit_inode before open vfs: do_last(): only return EISDIR for O_CREAT vfs: do_last(): check LOOKUP_DIRECTORY vfs: do_last(): make ENOENT exit RCU safe vfs: make follow_link check RCU safe vfs: do_last(): use inode variable vfs: do_last(): inline walk_component() vfs: do_last(): make exit RCU safe vfs: split do_lookup() Btrfs: move over to use ->update_time fs: introduce inode operation ->update_time reiserfs: get rid of resierfs_sync_super reiserfs: mark the superblock as dirty a bit later ...
Diffstat (limited to 'include/linux/security.h')
-rw-r--r--include/linux/security.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index ab0e091ce5fa..4e5a73cdbbef 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -86,9 +86,9 @@ extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
86extern int cap_inode_removexattr(struct dentry *dentry, const char *name); 86extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
87extern int cap_inode_need_killpriv(struct dentry *dentry); 87extern int cap_inode_need_killpriv(struct dentry *dentry);
88extern int cap_inode_killpriv(struct dentry *dentry); 88extern int cap_inode_killpriv(struct dentry *dentry);
89extern int cap_file_mmap(struct file *file, unsigned long reqprot, 89extern int cap_mmap_addr(unsigned long addr);
90 unsigned long prot, unsigned long flags, 90extern int cap_mmap_file(struct file *file, unsigned long reqprot,
91 unsigned long addr, unsigned long addr_only); 91 unsigned long prot, unsigned long flags);
92extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); 92extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
93extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 93extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
94 unsigned long arg4, unsigned long arg5); 94 unsigned long arg4, unsigned long arg5);
@@ -586,15 +586,17 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
586 * simple integer value. When @arg represents a user space pointer, it 586 * simple integer value. When @arg represents a user space pointer, it
587 * should never be used by the security module. 587 * should never be used by the security module.
588 * Return 0 if permission is granted. 588 * Return 0 if permission is granted.
589 * @file_mmap : 589 * @mmap_addr :
590 * Check permissions for a mmap operation at @addr.
591 * @addr contains virtual address that will be used for the operation.
592 * Return 0 if permission is granted.
593 * @mmap_file :
590 * Check permissions for a mmap operation. The @file may be NULL, e.g. 594 * Check permissions for a mmap operation. The @file may be NULL, e.g.
591 * if mapping anonymous memory. 595 * if mapping anonymous memory.
592 * @file contains the file structure for file to map (may be NULL). 596 * @file contains the file structure for file to map (may be NULL).
593 * @reqprot contains the protection requested by the application. 597 * @reqprot contains the protection requested by the application.
594 * @prot contains the protection that will be applied by the kernel. 598 * @prot contains the protection that will be applied by the kernel.
595 * @flags contains the operational flags. 599 * @flags contains the operational flags.
596 * @addr contains virtual address that will be used for the operation.
597 * @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1.
598 * Return 0 if permission is granted. 600 * Return 0 if permission is granted.
599 * @file_mprotect: 601 * @file_mprotect:
600 * Check permissions before changing memory access permissions. 602 * Check permissions before changing memory access permissions.
@@ -1481,10 +1483,10 @@ struct security_operations {
1481 void (*file_free_security) (struct file *file); 1483 void (*file_free_security) (struct file *file);
1482 int (*file_ioctl) (struct file *file, unsigned int cmd, 1484 int (*file_ioctl) (struct file *file, unsigned int cmd,
1483 unsigned long arg); 1485 unsigned long arg);
1484 int (*file_mmap) (struct file *file, 1486 int (*mmap_addr) (unsigned long addr);
1487 int (*mmap_file) (struct file *file,
1485 unsigned long reqprot, unsigned long prot, 1488 unsigned long reqprot, unsigned long prot,
1486 unsigned long flags, unsigned long addr, 1489 unsigned long flags);
1487 unsigned long addr_only);
1488 int (*file_mprotect) (struct vm_area_struct *vma, 1490 int (*file_mprotect) (struct vm_area_struct *vma,
1489 unsigned long reqprot, 1491 unsigned long reqprot,
1490 unsigned long prot); 1492 unsigned long prot);
@@ -1743,9 +1745,9 @@ int security_file_permission(struct file *file, int mask);
1743int security_file_alloc(struct file *file); 1745int security_file_alloc(struct file *file);
1744void security_file_free(struct file *file); 1746void security_file_free(struct file *file);
1745int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 1747int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1746int security_file_mmap(struct file *file, unsigned long reqprot, 1748int security_mmap_file(struct file *file, unsigned long prot,
1747 unsigned long prot, unsigned long flags, 1749 unsigned long flags);
1748 unsigned long addr, unsigned long addr_only); 1750int security_mmap_addr(unsigned long addr);
1749int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 1751int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1750 unsigned long prot); 1752 unsigned long prot);
1751int security_file_lock(struct file *file, unsigned int cmd); 1753int security_file_lock(struct file *file, unsigned int cmd);
@@ -2181,13 +2183,15 @@ static inline int security_file_ioctl(struct file *file, unsigned int cmd,
2181 return 0; 2183 return 0;
2182} 2184}
2183 2185
2184static inline int security_file_mmap(struct file *file, unsigned long reqprot, 2186static inline int security_mmap_file(struct file *file, unsigned long prot,
2185 unsigned long prot, 2187 unsigned long flags)
2186 unsigned long flags, 2188{
2187 unsigned long addr, 2189 return 0;
2188 unsigned long addr_only) 2190}
2191
2192static inline int security_mmap_addr(unsigned long addr)
2189{ 2193{
2190 return cap_file_mmap(file, reqprot, prot, flags, addr, addr_only); 2194 return cap_mmap_addr(addr);
2191} 2195}
2192 2196
2193static inline int security_file_mprotect(struct vm_area_struct *vma, 2197static inline int security_file_mprotect(struct vm_area_struct *vma,