lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 11 Oct 2017 22:06:01 +0200 From: Jan Kara <jack@...e.cz> To: <linux-fsdevel@...r.kernel.org> Cc: <linux-ext4@...r.kernel.org>, <linux-xfs@...r.kernel.org>, Christoph Hellwig <hch@...radead.org>, Dan Williams <dan.j.williams@...el.com>, Ross Zwisler <ross.zwisler@...ux.intel.com>, Ted Tso <tytso@....edu>, "Darrick J. Wong" <darrick.wong@...cle.com>, Jan Kara <jack@...e.cz> Subject: [PATCH 17/19] ext4: Add support for MAP_SYNC flag Now when everything is prepared, add support in ext4 to accept MAP_SYNC as an mmap(2) flag. Signed-off-by: Jan Kara <jack@...e.cz> --- fs/ext4/file.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 61a8788168f3..f013cda84b3d 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -364,6 +364,25 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) return 0; } +#define EXT4_SUPPORTED_MAP_FLAGS (LEGACY_MAP_MASK | MAP_SYNC) + +static int ext4_file_mmap_validate(struct file *file, + struct vm_area_struct *vma, + unsigned long map_flags) +{ + if (map_flags & ~EXT4_SUPPORTED_MAP_FLAGS) + return -EOPNOTSUPP; + + /* + * We don't support synchronous mappings for non-DAX files. At least + * until someone comes with a sensible use case. + */ + if (!IS_DAX(file_inode(file)) && (map_flags & MAP_SYNC)) + return -EOPNOTSUPP; + + return ext4_file_mmap(file, vma); +} + static int ext4_file_open(struct inode * inode, struct file * filp) { struct super_block *sb = inode->i_sb; @@ -723,6 +742,7 @@ const struct file_operations ext4_file_operations = { .compat_ioctl = ext4_compat_ioctl, #endif .mmap = ext4_file_mmap, + .mmap_validate = ext4_file_mmap_validate, .open = ext4_file_open, .release = ext4_release_file, .fsync = ext4_sync_file, -- 2.12.3
Powered by blists - more mailing lists