diff options
author | Christoph Hellwig <hch@lst.de> | 2015-01-14 04:42:32 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-01-20 16:02:58 -0500 |
commit | b4caecd48005fbed3949dde6c1cb233142fd69e9 (patch) | |
tree | 1fdd9b7c15568c79eb3c1ed84a39858ddbcbc88b /security | |
parent | 97b713ba3ebaa6c8d84c2c720f5468a7c6a6eb4e (diff) |
fs: introduce f_op->mmap_capabilities for nommu mmap support
Since "BDI: Provide backing device capability information [try #3]" the
backing_dev_info structure also provides flags for the kind of mmap
operation available in a nommu environment, which is entirely unrelated
to it's original purpose.
Introduce a new nommu-only file operation to provide this information to
the nommu mmap code instead. Splitting this from the backing_dev_info
structure allows to remove lots of backing_dev_info instance that aren't
otherwise needed, and entirely gets rid of the concept of providing a
backing_dev_info for a character device. It also removes the need for
the mtd_inodefs filesystem.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tejun Heo <tj@kernel.org>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/security.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/security/security.c b/security/security.c index 18b35c63fc0c..a0442b20f001 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -726,16 +726,15 @@ static inline unsigned long mmap_prot(struct file *file, unsigned long prot) | |||
726 | return prot | PROT_EXEC; | 726 | return prot | PROT_EXEC; |
727 | /* | 727 | /* |
728 | * ditto if it's not on noexec mount, except that on !MMU we need | 728 | * ditto if it's not on noexec mount, except that on !MMU we need |
729 | * BDI_CAP_EXEC_MMAP (== VM_MAYEXEC) in this case | 729 | * NOMMU_MAP_EXEC (== VM_MAYEXEC) in this case |
730 | */ | 730 | */ |
731 | if (!(file->f_path.mnt->mnt_flags & MNT_NOEXEC)) { | 731 | if (!(file->f_path.mnt->mnt_flags & MNT_NOEXEC)) { |
732 | #ifndef CONFIG_MMU | 732 | #ifndef CONFIG_MMU |
733 | unsigned long caps = 0; | 733 | if (file->f_op->mmap_capabilities) { |
734 | struct address_space *mapping = file->f_mapping; | 734 | unsigned caps = file->f_op->mmap_capabilities(file); |
735 | if (mapping && mapping->backing_dev_info) | 735 | if (!(caps & NOMMU_MAP_EXEC)) |
736 | caps = mapping->backing_dev_info->capabilities; | 736 | return prot; |
737 | if (!(caps & BDI_CAP_EXEC_MAP)) | 737 | } |
738 | return prot; | ||
739 | #endif | 738 | #endif |
740 | return prot | PROT_EXEC; | 739 | return prot | PROT_EXEC; |
741 | } | 740 | } |