Commit 38e3eaee authored by Tyler Hicks's avatar Tyler Hicks

eCryptfs: Remove mmap from directory operations

Adrian reported that mkfontscale didn't work inside of eCryptfs mounts.
Strace revealed the following:

open("./", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
open("./fonts.scale", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
getdents(3, /* 80 entries */, 32768) = 2304
open("./.", O_RDONLY) = 5
fcntl64(5, F_SETFD, FD_CLOEXEC) = 0
fstat64(5, {st_mode=S_IFDIR|0755, st_size=16384, ...}) = 0
mmap2(NULL, 16384, PROT_READ, MAP_PRIVATE, 5, 0) = 0xb7fcf000
close(5) = 0
--- SIGBUS (Bus error) @ 0 (0) ---
+++ killed by SIGBUS +++

The mmap2() on a directory was successful, resulting in a SIGBUS
signal later.  This patch removes mmap() from the list of possible
ecryptfs_dir_fops so that mmap() isn't possible on eCryptfs directory
files.

https://bugs.launchpad.net/ecryptfs/+bug/400443Reported-by: default avatarAdrian C. <anrxc@sysphere.org>
Signed-off-by: default avatarTyler Hicks <tyhicks@linux.vnet.ibm.com>
parent f8f484d1
...@@ -299,7 +299,6 @@ static int ecryptfs_ioctl(struct inode *inode, struct file *file, ...@@ -299,7 +299,6 @@ static int ecryptfs_ioctl(struct inode *inode, struct file *file,
const struct file_operations ecryptfs_dir_fops = { const struct file_operations ecryptfs_dir_fops = {
.readdir = ecryptfs_readdir, .readdir = ecryptfs_readdir,
.ioctl = ecryptfs_ioctl, .ioctl = ecryptfs_ioctl,
.mmap = generic_file_mmap,
.open = ecryptfs_open, .open = ecryptfs_open,
.flush = ecryptfs_flush, .flush = ecryptfs_flush,
.release = ecryptfs_release, .release = ecryptfs_release,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment