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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Apr 2016 10:35:18 -0500
From:	"Eric W. Biederman" <ebiederm@...ssion.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>, security@...ian.org,
	security@...nel.org, Al Viro <viro@...iv.linux.org.uk>,
	security@...ntu.com, Peter Hurley <peter@...leysoftware.com>,
	Serge Hallyn <serge.hallyn@...ntu.com>,
	Willy Tarreau <w@....eu>,
	Aurelien Jarno <aurelien@...el32.net>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
	Jann Horn <jann@...jh.net>, Greg KH <greg@...ah.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Jiri Slaby <jslaby@...e.com>,
	Florian Weimer <fw@...eb.enyo.de>,
	"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: [PATCH 02/16] devpts: Set the proper fops for /dev/pts/ptmx

Simplify things and accelerate the open a bit by setting ptmx_fops
directly on the /dev/pts/ptmx inode.

Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
 drivers/tty/pty.c         | 2 +-
 fs/devpts/inode.c         | 6 +++---
 include/linux/devpts_fs.h | 2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index e16a49b507ef..c71d5b6ddbb8 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -803,7 +803,7 @@ err_file:
 	return retval;
 }
 
-static struct file_operations ptmx_fops;
+struct file_operations ptmx_fops;
 
 static void __init unix98_pty_init(void)
 {
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index e8bf61cd1bf8..4fc6c49b0efd 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -232,7 +232,6 @@ static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts)
 #ifdef CONFIG_DEVPTS_MULTIPLE_INSTANCES
 static int mknod_ptmx(struct super_block *sb)
 {
-	int mode;
 	int rc = -ENOMEM;
 	struct dentry *dentry;
 	struct inode *inode;
@@ -274,8 +273,9 @@ static int mknod_ptmx(struct super_block *sb)
 	inode->i_ino = 2;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 
-	mode = S_IFCHR|opts->ptmxmode;
-	init_special_inode(inode, mode, MKDEV(TTYAUX_MAJOR, 2));
+	inode->i_mode = S_IFCHR|opts->ptmxmode;
+	inode->i_fop = &ptmx_fops;
+	inode->i_rdev = MKDEV(TTYAUX_MAJOR, PTMX_MINOR);
 	inode->i_uid = root_uid;
 	inode->i_gid = root_gid;
 
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index db329cd3d14e..ff2b7c274435 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -20,6 +20,8 @@
 
 #ifdef CONFIG_UNIX98_PTYS
 
+extern struct file_operations ptmx_fops;
+
 int devpts_new_index(struct inode *ptmx_inode);
 void devpts_kill_index(struct inode *ptmx_inode, int idx);
 void devpts_add_ref(struct inode *ptmx_inode);
-- 
2.8.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ