Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751573AbcDOPqo (ORCPT ); Fri, 15 Apr 2016 11:46:44 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:51069 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbcDOPqm (ORCPT ); Fri, 15 Apr 2016 11:46:42 -0400 From: "Eric W. Biederman" To: Linus Torvalds Cc: "H. Peter Anvin" , Andy Lutomirski , security@debian.org, security@kernel.org, Al Viro , security@ubuntu.com, Peter Hurley , Serge Hallyn , Willy Tarreau , Aurelien Jarno , One Thousand Gnomes , Jann Horn , Greg KH , Linux Kernel Mailing List , Jiri Slaby , Florian Weimer , "Eric W. Biederman" Date: Fri, 15 Apr 2016 10:35:17 -0500 Message-Id: <1460734532-20134-1-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <877ffyzy1j.fsf_-_@x220.int.ebiederm.org> References: <877ffyzy1j.fsf_-_@x220.int.ebiederm.org> X-XM-AID: U2FsdGVkX1+i3tL7/VsOlzngmoBmgt03QNpcfJ5jypY= X-SA-Exim-Connect-IP: 67.3.249.252 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 329 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 9 (2.6%), b_tie_ro: 6 (2.0%), parse: 0.73 (0.2%), extract_message_metadata: 12 (3.7%), get_uri_detail_list: 1.44 (0.4%), tests_pri_-1000: 6 (1.9%), tests_pri_-950: 1.23 (0.4%), tests_pri_-900: 1.12 (0.3%), tests_pri_-400: 23 (6.9%), check_bayes: 21 (6.5%), b_tokenize: 7 (2.2%), b_tok_get_all: 7 (2.0%), b_comp_prob: 1.82 (0.6%), b_tok_touch_all: 3.3 (1.0%), b_finish: 0.67 (0.2%), tests_pri_0: 270 (82.1%), check_dkim_signature: 0.51 (0.2%), check_dkim_adsp: 2.7 (0.8%), tests_pri_500: 3.7 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 01/16] devpts: Use the same default mode for both /dev/ptmx and dev/pts/ptmx X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1899 Lines: 63 The default mode is 0666 on /dev/ptmx so we really don't gain anything except a bunch of hassle by not having the default mode on /dev/pts/ptmx also being 0666. Signed-off-by: "Eric W. Biederman" --- drivers/tty/tty_io.c | 5 +++-- fs/devpts/inode.c | 8 -------- include/linux/devpts_fs.h | 3 +++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 8d26ed79bb4c..438b2209ea41 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -3597,9 +3597,10 @@ static char *tty_devnode(struct device *dev, umode_t *mode) { if (!mode) return NULL; - if (dev->devt == MKDEV(TTYAUX_MAJOR, 0) || - dev->devt == MKDEV(TTYAUX_MAJOR, 2)) + if (dev->devt == MKDEV(TTYAUX_MAJOR, 0)) *mode = 0666; + if (dev->devt == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)) + *mode = DEVPTS_DEFAULT_PTMX_MODE; return NULL; } diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 655f21f99160..e8bf61cd1bf8 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -29,14 +29,6 @@ #include #define DEVPTS_DEFAULT_MODE 0600 -/* - * ptmx is a new node in /dev/pts and will be unused in legacy (single- - * instance) mode. To prevent surprises in user space, set permissions of - * ptmx to 0. Use 'chmod' or remount with '-o ptmxmode' to set meaningful - * permissions. - */ -#define DEVPTS_DEFAULT_PTMX_MODE 0000 -#define PTMX_MINOR 2 /* * sysctl support for setting limits on the number of Unix98 ptys allocated. diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h index e0ee0b3000b2..db329cd3d14e 100644 --- a/include/linux/devpts_fs.h +++ b/include/linux/devpts_fs.h @@ -15,6 +15,9 @@ #include +#define DEVPTS_DEFAULT_PTMX_MODE 0666 +#define PTMX_MINOR 2 + #ifdef CONFIG_UNIX98_PTYS int devpts_new_index(struct inode *ptmx_inode); -- 2.8.1