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-next>] [day] [month] [year] [list]
Date:	Tue, 18 Aug 2015 16:31:11 +0200
From:	Dongsu Park <dpark@...teo.net>
To:	linux-kernel@...r.kernel.org
Cc:	linux-fsdevel@...r.kernel.org,
	Peter Hurley <peter@...leysoftware.com>,
	Josh Triplett <josh@...htriplett.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Howells <dhowells@...hat.com>,
	Alban Crequy <alban@...ocode.com>,
	Dongsu Park <dpark@...teo.net>
Subject: [PATCH] devpts: allow mounting with uid/gid of uint32_t

To allow devpts to be mounted with options of uid/gid of uint32_t,
use kstrtouint() instead of match_int(). Doing that, mounting devpts
with uid or gid > (2^31 - 1) will work as expected, e.g.:

 # mount -t devpts devpts /tmp/devptsdir -o \
   newinstance,ptmxmode=0666,mode=620,uid=3598450688,gid=3598450693

It was originally by reported on systemd github issues:
https://github.com/systemd/systemd/issues/956

Reported-by: Alban Crequy <alban@...ocode.com>
Signed-off-by: Dongsu Park <dpark@...teo.net>
---
 fs/devpts/inode.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index c35ffdc12bba..83c3e7368f38 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -188,23 +188,33 @@ static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts)
 		token = match_token(p, tokens, args);
 		switch (token) {
 		case Opt_uid:
-			if (match_int(&args[0], &option))
+		{
+			char *uidstr = args[0].from;
+			uid_t uidval;
+			int rc = kstrtouint(uidstr, 0, &uidval);
+			if (rc)
 				return -EINVAL;
-			uid = make_kuid(current_user_ns(), option);
+			uid = make_kuid(current_user_ns(), uidval);
 			if (!uid_valid(uid))
 				return -EINVAL;
 			opts->uid = uid;
 			opts->setuid = 1;
 			break;
+                }
 		case Opt_gid:
-			if (match_int(&args[0], &option))
+                {
+			char *gidstr = args[0].from;
+			gid_t gidval;
+			int rc = kstrtouint(gidstr, 0, &gidval);
+			if (rc)
 				return -EINVAL;
-			gid = make_kgid(current_user_ns(), option);
+			gid = make_kgid(current_user_ns(), gidval);
 			if (!gid_valid(gid))
 				return -EINVAL;
 			opts->gid = gid;
 			opts->setgid = 1;
 			break;
+                }
 		case Opt_mode:
 			if (match_octal(&args[0], &option))
 				return -EINVAL;
-- 
2.1.0

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ