[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130825175524.GB31703@redhat.com>
Date: Sun, 25 Aug 2013 19:55:24 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andy Lutomirski <luto@...capital.net>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Al Viro <viro@...iv.linux.org.uk>, Willy Tarreau <w@....eu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Brad Spengler <spender@...ecurity.net>,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] anon_inodefs: forbid open via /proc
open("/proc/pid/$anon-fd") should fail, we can't create the new
file with correct f_op/etc correctly. Currently this creates the
bogus file with the empty anon_inode_fops, this is harmless but
still wrong and misleading.
Add anon_inode_fops->anon_open() which simply returns ENXIO like
sock_no_open() does in this case.
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
fs/anon_inodes.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 47a65df..af25036 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -24,7 +24,15 @@
static struct vfsmount *anon_inode_mnt __read_mostly;
static struct inode *anon_inode_inode;
-static const struct file_operations anon_inode_fops;
+
+static int anon_open(struct inode *inode, struct file *file)
+{
+ return -ENXIO;
+}
+
+static const struct file_operations anon_inode_fops = {
+ .open = anon_open,
+};
/*
* anon_inodefs_dname() is called from d_path().
--
1.5.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists