diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 13:34:35 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 13:34:35 -0400 |
| commit | 1193755ac6328ad240ba987e6ec41d5e8baf0680 (patch) | |
| tree | 40bf847d7e3ebaa57b107151d14e6cd1d280cc6d /include/linux | |
| parent | 4edebed86690eb8db9af3ab85baf4a34e73266cc (diff) | |
| parent | 0ef97dcfce4179a2eba046b855ee2f91d6f1b414 (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')
| -rw-r--r-- | include/linux/errno.h | 1 | ||||
| -rw-r--r-- | include/linux/exportfs.h | 4 | ||||
| -rw-r--r-- | include/linux/fs.h | 10 | ||||
| -rw-r--r-- | include/linux/fsnotify_backend.h | 2 | ||||
| -rw-r--r-- | include/linux/lglock.h | 179 | ||||
| -rw-r--r-- | include/linux/mm.h | 2 | ||||
| -rw-r--r-- | include/linux/security.h | 40 | ||||
| -rw-r--r-- | include/linux/types.h | 2 |
8 files changed, 63 insertions, 177 deletions
diff --git a/include/linux/errno.h b/include/linux/errno.h index 2d09bfa5c262..e0de516374da 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #define ENOIOCTLCMD 515 /* No ioctl command */ | 17 | #define ENOIOCTLCMD 515 /* No ioctl command */ |
| 18 | #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ | 18 | #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ |
| 19 | #define EPROBE_DEFER 517 /* Driver requests probe retry */ | 19 | #define EPROBE_DEFER 517 /* Driver requests probe retry */ |
| 20 | #define EOPENSTALE 518 /* open found a stale dentry */ | ||
| 20 | 21 | ||
| 21 | /* Defined for the NFSv3 protocol */ | 22 | /* Defined for the NFSv3 protocol */ |
| 22 | #define EBADHANDLE 521 /* Illegal NFS file handle */ | 23 | #define EBADHANDLE 521 /* Illegal NFS file handle */ |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 3a4cef5322dc..12291a7ee275 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
| @@ -165,8 +165,8 @@ struct fid { | |||
| 165 | */ | 165 | */ |
| 166 | 166 | ||
| 167 | struct export_operations { | 167 | struct export_operations { |
| 168 | int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len, | 168 | int (*encode_fh)(struct inode *inode, __u32 *fh, int *max_len, |
| 169 | int connectable); | 169 | struct inode *parent); |
| 170 | struct dentry * (*fh_to_dentry)(struct super_block *sb, struct fid *fid, | 170 | struct dentry * (*fh_to_dentry)(struct super_block *sb, struct fid *fid, |
| 171 | int fh_len, int fh_type); | 171 | int fh_len, int fh_type); |
| 172 | struct dentry * (*fh_to_parent)(struct super_block *sb, struct fid *fid, | 172 | struct dentry * (*fh_to_parent)(struct super_block *sb, struct fid *fid, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 40887afaaca7..51978ed43e97 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1692,6 +1692,7 @@ struct inode_operations { | |||
| 1692 | int (*removexattr) (struct dentry *, const char *); | 1692 | int (*removexattr) (struct dentry *, const char *); |
| 1693 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | 1693 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, |
| 1694 | u64 len); | 1694 | u64 len); |
| 1695 | int (*update_time)(struct inode *, struct timespec *, int); | ||
| 1695 | } ____cacheline_aligned; | 1696 | } ____cacheline_aligned; |
| 1696 | 1697 | ||
| 1697 | struct seq_file; | 1698 | struct seq_file; |
| @@ -1850,6 +1851,13 @@ static inline void inode_inc_iversion(struct inode *inode) | |||
| 1850 | spin_unlock(&inode->i_lock); | 1851 | spin_unlock(&inode->i_lock); |
| 1851 | } | 1852 | } |
| 1852 | 1853 | ||
| 1854 | enum file_time_flags { | ||
| 1855 | S_ATIME = 1, | ||
| 1856 | S_MTIME = 2, | ||
| 1857 | S_CTIME = 4, | ||
| 1858 | S_VERSION = 8, | ||
| 1859 | }; | ||
| 1860 | |||
| 1853 | extern void touch_atime(struct path *); | 1861 | extern void touch_atime(struct path *); |
| 1854 | static inline void file_accessed(struct file *file) | 1862 | static inline void file_accessed(struct file *file) |
| 1855 | { | 1863 | { |
| @@ -2583,7 +2591,7 @@ extern int inode_change_ok(const struct inode *, struct iattr *); | |||
| 2583 | extern int inode_newsize_ok(const struct inode *, loff_t offset); | 2591 | extern int inode_newsize_ok(const struct inode *, loff_t offset); |
| 2584 | extern void setattr_copy(struct inode *inode, const struct iattr *attr); | 2592 | extern void setattr_copy(struct inode *inode, const struct iattr *attr); |
| 2585 | 2593 | ||
| 2586 | extern void file_update_time(struct file *file); | 2594 | extern int file_update_time(struct file *file); |
| 2587 | 2595 | ||
| 2588 | extern int generic_show_options(struct seq_file *m, struct dentry *root); | 2596 | extern int generic_show_options(struct seq_file *m, struct dentry *root); |
| 2589 | extern void save_mount_options(struct super_block *sb, char *options); | 2597 | extern void save_mount_options(struct super_block *sb, char *options); |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 91d0e0a34ef3..63d966d5c2ea 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | #define FS_EVENTS_POSS_ON_CHILD (FS_ACCESS | FS_MODIFY | FS_ATTRIB |\ | 60 | #define FS_EVENTS_POSS_ON_CHILD (FS_ACCESS | FS_MODIFY | FS_ATTRIB |\ |
| 61 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN |\ | 61 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN |\ |
| 62 | FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ | 62 | FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ |
| 63 | FS_DELETE) | 63 | FS_DELETE | FS_OPEN_PERM | FS_ACCESS_PERM) |
| 64 | 64 | ||
| 65 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) | 65 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) |
| 66 | 66 | ||
diff --git a/include/linux/lglock.h b/include/linux/lglock.h index 87f402ccec55..f01e5f6d1f07 100644 --- a/include/linux/lglock.h +++ b/include/linux/lglock.h | |||
| @@ -23,28 +23,17 @@ | |||
| 23 | #include <linux/lockdep.h> | 23 | #include <linux/lockdep.h> |
| 24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
| 25 | #include <linux/cpu.h> | 25 | #include <linux/cpu.h> |
| 26 | #include <linux/notifier.h> | ||
| 26 | 27 | ||
| 27 | /* can make br locks by using local lock for read side, global lock for write */ | 28 | /* can make br locks by using local lock for read side, global lock for write */ |
| 28 | #define br_lock_init(name) name##_lock_init() | 29 | #define br_lock_init(name) lg_lock_init(name, #name) |
| 29 | #define br_read_lock(name) name##_local_lock() | 30 | #define br_read_lock(name) lg_local_lock(name) |
| 30 | #define br_read_unlock(name) name##_local_unlock() | 31 | #define br_read_unlock(name) lg_local_unlock(name) |
| 31 | #define br_write_lock(name) name##_global_lock_online() | 32 | #define br_write_lock(name) lg_global_lock(name) |
| 32 | #define br_write_unlock(name) name##_global_unlock_online() | 33 | #define br_write_unlock(name) lg_global_unlock(name) |
| 33 | 34 | ||
| 34 | #define DECLARE_BRLOCK(name) DECLARE_LGLOCK(name) | ||
| 35 | #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) | 35 | #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) |
| 36 | 36 | ||
| 37 | |||
| 38 | #define lg_lock_init(name) name##_lock_init() | ||
| 39 | #define lg_local_lock(name) name##_local_lock() | ||
| 40 | #define lg_local_unlock(name) name##_local_unlock() | ||
| 41 | #define lg_local_lock_cpu(name, cpu) name##_local_lock_cpu(cpu) | ||
| 42 | #define lg_local_unlock_cpu(name, cpu) name##_local_unlock_cpu(cpu) | ||
| 43 | #define lg_global_lock(name) name##_global_lock() | ||
| 44 | #define lg_global_unlock(name) name##_global_unlock() | ||
| 45 | #define lg_global_lock_online(name) name##_global_lock_online() | ||
| 46 | #define lg_global_unlock_online(name) name##_global_unlock_online() | ||
| 47 | |||
| 48 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 37 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 49 | #define LOCKDEP_INIT_MAP lockdep_init_map | 38 | #define LOCKDEP_INIT_MAP lockdep_init_map |
| 50 | 39 | ||
| @@ -59,142 +48,26 @@ | |||
| 59 | #define DEFINE_LGLOCK_LOCKDEP(name) | 48 | #define DEFINE_LGLOCK_LOCKDEP(name) |
| 60 | #endif | 49 | #endif |
| 61 | 50 | ||
| 62 | 51 | struct lglock { | |
| 63 | #define DECLARE_LGLOCK(name) \ | 52 | arch_spinlock_t __percpu *lock; |
| 64 | extern void name##_lock_init(void); \ | 53 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 65 | extern void name##_local_lock(void); \ | 54 | struct lock_class_key lock_key; |
| 66 | extern void name##_local_unlock(void); \ | 55 | struct lockdep_map lock_dep_map; |
| 67 | extern void name##_local_lock_cpu(int cpu); \ | 56 | #endif |
| 68 | extern void name##_local_unlock_cpu(int cpu); \ | 57 | }; |
| 69 | extern void name##_global_lock(void); \ | ||
| 70 | extern void name##_global_unlock(void); \ | ||
| 71 | extern void name##_global_lock_online(void); \ | ||
| 72 | extern void name##_global_unlock_online(void); \ | ||
| 73 | 58 | ||
| 74 | #define DEFINE_LGLOCK(name) \ | 59 | #define DEFINE_LGLOCK(name) \ |
| 75 | \ | 60 | DEFINE_LGLOCK_LOCKDEP(name); \ |
| 76 | DEFINE_SPINLOCK(name##_cpu_lock); \ | 61 | DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \ |
| 77 | cpumask_t name##_cpus __read_mostly; \ | 62 | = __ARCH_SPIN_LOCK_UNLOCKED; \ |
| 78 | DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ | 63 | struct lglock name = { .lock = &name ## _lock } |
| 79 | DEFINE_LGLOCK_LOCKDEP(name); \ | 64 | |
| 80 | \ | 65 | void lg_lock_init(struct lglock *lg, char *name); |
| 81 | static int \ | 66 | void lg_local_lock(struct lglock *lg); |
| 82 | name##_lg_cpu_callback(struct notifier_block *nb, \ | 67 | void lg_local_unlock(struct lglock *lg); |
| 83 | unsigned long action, void *hcpu) \ | 68 | void lg_local_lock_cpu(struct lglock *lg, int cpu); |
| 84 | { \ | 69 | void lg_local_unlock_cpu(struct lglock *lg, int cpu); |
| 85 | switch (action & ~CPU_TASKS_FROZEN) { \ | 70 | void lg_global_lock(struct lglock *lg); |
| 86 | case CPU_UP_PREPARE: \ | 71 | void lg_global_unlock(struct lglock *lg); |
| 87 | spin_lock(&name##_cpu_lock); \ | 72 | |
| 88 | cpu_set((unsigned long)hcpu, name##_cpus); \ | ||
| 89 | spin_unlock(&name##_cpu_lock); \ | ||
| 90 | break; \ | ||
| 91 | case CPU_UP_CANCELED: case CPU_DEAD: \ | ||
| 92 | spin_lock(&name##_cpu_lock); \ | ||
| 93 | cpu_clear((unsigned long)hcpu, name##_cpus); \ | ||
| 94 | spin_unlock(&name##_cpu_lock); \ | ||
| 95 | } \ | ||
| 96 | return NOTIFY_OK; \ | ||
| 97 | } \ | ||
| 98 | static struct notifier_block name##_lg_cpu_notifier = { \ | ||
| 99 | .notifier_call = name##_lg_cpu_callback, \ | ||
| 100 | }; \ | ||
| 101 | void name##_lock_init(void) { \ | ||
| 102 | int i; \ | ||
| 103 | LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ | ||
| 104 | for_each_possible_cpu(i) { \ | ||
| 105 | arch_spinlock_t *lock; \ | ||
| 106 | lock = &per_cpu(name##_lock, i); \ | ||
| 107 | *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ | ||
| 108 | } \ | ||
| 109 | register_hotcpu_notifier(&name##_lg_cpu_notifier); \ | ||
| 110 | get_online_cpus(); \ | ||
| 111 | for_each_online_cpu(i) \ | ||
| 112 | cpu_set(i, name##_cpus); \ | ||
| 113 | put_online_cpus(); \ | ||
| 114 | } \ | ||
| 115 | EXPORT_SYMBOL(name##_lock_init); \ | ||
| 116 | \ | ||
| 117 | void name##_local_lock(void) { \ | ||
| 118 | arch_spinlock_t *lock; \ | ||
| 119 | preempt_disable(); \ | ||
| 120 | rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \ | ||
| 121 | lock = &__get_cpu_var(name##_lock); \ | ||
| 122 | arch_spin_lock(lock); \ | ||
| 123 | } \ | ||
| 124 | EXPORT_SYMBOL(name##_local_lock); \ | ||
| 125 | \ | ||
| 126 | void name##_local_unlock(void) { \ | ||
| 127 | arch_spinlock_t *lock; \ | ||
| 128 | rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \ | ||
| 129 | lock = &__get_cpu_var(name##_lock); \ | ||
| 130 | arch_spin_unlock(lock); \ | ||
| 131 | preempt_enable(); \ | ||
| 132 | } \ | ||
| 133 | EXPORT_SYMBOL(name##_local_unlock); \ | ||
| 134 | \ | ||
| 135 | void name##_local_lock_cpu(int cpu) { \ | ||
| 136 | arch_spinlock_t *lock; \ | ||
| 137 | preempt_disable(); \ | ||
| 138 | rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \ | ||
| 139 | lock = &per_cpu(name##_lock, cpu); \ | ||
| 140 | arch_spin_lock(lock); \ | ||
| 141 | } \ | ||
| 142 | EXPORT_SYMBOL(name##_local_lock_cpu); \ | ||
| 143 | \ | ||
| 144 | void name##_local_unlock_cpu(int cpu) { \ | ||
| 145 | arch_spinlock_t *lock; \ | ||
| 146 | rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \ | ||
| 147 | lock = &per_cpu(name##_lock, cpu); \ | ||
| 148 | arch_spin_unlock(lock); \ | ||
| 149 | preempt_enable(); \ | ||
| 150 | } \ | ||
| 151 | EXPORT_SYMBOL(name##_local_unlock_cpu); \ | ||
| 152 | \ | ||
| 153 | void name##_global_lock_online(void) { \ | ||
| 154 | int i; \ | ||
| 155 | spin_lock(&name##_cpu_lock); \ | ||
| 156 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ | ||
| 157 | for_each_cpu(i, &name##_cpus) { \ | ||
| 158 | arch_spinlock_t *lock; \ | ||
| 159 | lock = &per_cpu(name##_lock, i); \ | ||
| 160 | arch_spin_lock(lock); \ | ||
| 161 | } \ | ||
| 162 | } \ | ||
| 163 | EXPORT_SYMBOL(name##_global_lock_online); \ | ||
| 164 | \ | ||
| 165 | void name##_global_unlock_online(void) { \ | ||
| 166 | int i; \ | ||
| 167 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ | ||
| 168 | for_each_cpu(i, &name##_cpus) { \ | ||
| 169 | arch_spinlock_t *lock; \ | ||
| 170 | lock = &per_cpu(name##_lock, i); \ | ||
| 171 | arch_spin_unlock(lock); \ | ||
| 172 | } \ | ||
| 173 | spin_unlock(&name##_cpu_lock); \ | ||
| 174 | } \ | ||
| 175 | EXPORT_SYMBOL(name##_global_unlock_online); \ | ||
| 176 | \ | ||
| 177 | void name##_global_lock(void) { \ | ||
| 178 | int i; \ | ||
| 179 | preempt_disable(); \ | ||
| 180 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ | ||
| 181 | for_each_possible_cpu(i) { \ | ||
| 182 | arch_spinlock_t *lock; \ | ||
| 183 | lock = &per_cpu(name##_lock, i); \ | ||
| 184 | arch_spin_lock(lock); \ | ||
| 185 | } \ | ||
| 186 | } \ | ||
| 187 | EXPORT_SYMBOL(name##_global_lock); \ | ||
| 188 | \ | ||
| 189 | void name##_global_unlock(void) { \ | ||
| 190 | int i; \ | ||
| 191 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ | ||
| 192 | for_each_possible_cpu(i) { \ | ||
| 193 | arch_spinlock_t *lock; \ | ||
| 194 | lock = &per_cpu(name##_lock, i); \ | ||
| 195 | arch_spin_unlock(lock); \ | ||
| 196 | } \ | ||
| 197 | preempt_enable(); \ | ||
| 198 | } \ | ||
| 199 | EXPORT_SYMBOL(name##_global_unlock); | ||
| 200 | #endif | 73 | #endif |
diff --git a/include/linux/mm.h b/include/linux/mm.h index ce26716238c3..b36d08ce5c57 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1392,7 +1392,7 @@ extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned lo | |||
| 1392 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | 1392 | extern unsigned long mmap_region(struct file *file, unsigned long addr, |
| 1393 | unsigned long len, unsigned long flags, | 1393 | unsigned long len, unsigned long flags, |
| 1394 | vm_flags_t vm_flags, unsigned long pgoff); | 1394 | vm_flags_t vm_flags, unsigned long pgoff); |
| 1395 | extern unsigned long do_mmap(struct file *, unsigned long, | 1395 | extern unsigned long do_mmap_pgoff(struct file *, unsigned long, |
| 1396 | unsigned long, unsigned long, | 1396 | unsigned long, unsigned long, |
| 1397 | unsigned long, unsigned long); | 1397 | unsigned long, unsigned long); |
| 1398 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); | 1398 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); |
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, | |||
| 86 | extern int cap_inode_removexattr(struct dentry *dentry, const char *name); | 86 | extern int cap_inode_removexattr(struct dentry *dentry, const char *name); |
| 87 | extern int cap_inode_need_killpriv(struct dentry *dentry); | 87 | extern int cap_inode_need_killpriv(struct dentry *dentry); |
| 88 | extern int cap_inode_killpriv(struct dentry *dentry); | 88 | extern int cap_inode_killpriv(struct dentry *dentry); |
| 89 | extern int cap_file_mmap(struct file *file, unsigned long reqprot, | 89 | extern int cap_mmap_addr(unsigned long addr); |
| 90 | unsigned long prot, unsigned long flags, | 90 | extern 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); |
| 92 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); | 92 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); |
| 93 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, | 93 | extern 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); | |||
| 1743 | int security_file_alloc(struct file *file); | 1745 | int security_file_alloc(struct file *file); |
| 1744 | void security_file_free(struct file *file); | 1746 | void security_file_free(struct file *file); |
| 1745 | int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 1747 | int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
| 1746 | int security_file_mmap(struct file *file, unsigned long reqprot, | 1748 | int 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); | 1750 | int security_mmap_addr(unsigned long addr); |
| 1749 | int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, | 1751 | int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, |
| 1750 | unsigned long prot); | 1752 | unsigned long prot); |
| 1751 | int security_file_lock(struct file *file, unsigned int cmd); | 1753 | int 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 | ||
| 2184 | static inline int security_file_mmap(struct file *file, unsigned long reqprot, | 2186 | static 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 | |||
| 2192 | static 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 | ||
| 2193 | static inline int security_file_mprotect(struct vm_area_struct *vma, | 2197 | static inline int security_file_mprotect(struct vm_area_struct *vma, |
diff --git a/include/linux/types.h b/include/linux/types.h index 7f480db60231..9c1bd539ea70 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
| @@ -25,7 +25,7 @@ typedef __kernel_dev_t dev_t; | |||
| 25 | typedef __kernel_ino_t ino_t; | 25 | typedef __kernel_ino_t ino_t; |
| 26 | typedef __kernel_mode_t mode_t; | 26 | typedef __kernel_mode_t mode_t; |
| 27 | typedef unsigned short umode_t; | 27 | typedef unsigned short umode_t; |
| 28 | typedef __kernel_nlink_t nlink_t; | 28 | typedef __u32 nlink_t; |
| 29 | typedef __kernel_off_t off_t; | 29 | typedef __kernel_off_t off_t; |
| 30 | typedef __kernel_pid_t pid_t; | 30 | typedef __kernel_pid_t pid_t; |
| 31 | typedef __kernel_daddr_t daddr_t; | 31 | typedef __kernel_daddr_t daddr_t; |
