Skip to contentSkip to conversation

debugfs: convert gid= argument from decimal, not octal

PATCH In review Dave Reisner 5 participants 6 messages Jan 2, 2013 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 debugfs: convert gid= argument from decimal, not octal

This patch technically breaks userspace, but I suspect that anyone who actually used this flag would have encountered this brokenness, declared it lunacy, and already sent a patch.

---
 fs/debugfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/debugfs/inode.c +1 -1
index 153bb1e..a5f12b7 100644
@@ -176,7 +176,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
 			opts->uid = uid;
 			break;
 		case Opt_gid:
-			if (match_octal(&args[0], &option))
+			if (match_int(&args[0], &option))
 				return -EINVAL;
 			gid = make_kgid(current_user_ns(), option);
 			if (!gid_valid(gid))
Signature · 1 line
1.8.0.3
#1 lore raw
Quoted 3 lines · Dave Reisner

This patch technically breaks userspace, but I suspect that anyone who actually used this flag would have encountered this brokenness, declared it lunacy, and already sent a patch.

Kees is the one that originally did this change (I think, right?)

Kees, any objection to this patch? Will it break your existing systems?

thanks,

greg k-h

Quoted 21 lines
---
 fs/debugfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/debugfs/inode.c +1 -1
index 153bb1e..a5f12b7 100644
@@ -176,7 +176,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
 			opts->uid = uid;
 			break;
 		case Opt_gid:
-			if (match_octal(&args[0], &option))
+			if (match_int(&args[0], &option))
 				return -EINVAL;
 			gid = make_kgid(current_user_ns(), option);
 			if (!gid_valid(gid))
Signature · 1 line
1.8.0.3
#2 lore raw
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Dave Reisner

This patch technically breaks userspace, but I suspect that anyone who actually used this flag would have encountered this brokenness, declared it lunacy, and already sent a patch.

Kees is the one that originally did this change (I think, right?)

I recommended the default change, but I think it was Vasiliy that added the gid option, IIRC.

Quoted 1 line

Kees, any objection to this patch? Will it break your existing systems?

Regardless, I have no objection -- this should be int, not octal.

-Kees

Quoted 11 lines

thanks,

greg k-h

Quoted 6 lines
---
 fs/debugfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 14 lines
fs/debugfs/inode.c +1 -2
index 153bb1e..a5f12b7 100644
@@ -176,7 +176,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
                      opts->uid = uid;
                      break;
              case Opt_gid:
-                     if (match_octal(&args[0], &option))
+                     if (match_int(&args[0], &option))
                              return -EINVAL;
                      gid = make_kgid(current_user_ns(), option);
                      if (!gid_valid(gid))
--
Quoted 1 line

1.8.0.3

--
Kees Cook
Chrome OS Security

#3 lore raw
Quoted 11 lines · Kees Cook
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Dave Reisner

This patch technically breaks userspace, but I suspect that anyone who actually used this flag would have encountered this brokenness, declared it lunacy, and already sent a patch.

Kees is the one that originally did this change (I think, right?)

I recommended the default change, but I think it was Vasiliy that added the gid option, IIRC.

Ah, you are right, sorry about that.

Quoted 3 lines
Quoted 1 line

Kees, any objection to this patch? Will it break your existing systems?

Regardless, I have no objection -- this should be int, not octal.

Ok, I'll queue this up when I get back from vacation next week.

thanks,

greg k-h

Reviewed-by
#4 lore raw
In reply to Kees Cook

Hi,

(CC'ed kernel-hardening ML)

Quoted 11 lines · Kees Cook
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Dave Reisner

This patch technically breaks userspace, but I suspect that anyone who actually used this flag would have encountered this brokenness, declared it lunacy, and already sent a patch.

Kees is the one that originally did this change (I think, right?)

I recommended the default change, but I think it was Vasiliy that added the gid option, IIRC.

Wow. It was not me :-) IIRC, I haven't proposed debugfs uid/gid stuff after Greg NACK'ed my sysfs uid/gid/umask mount options patch. IIRC, there were talks that debugfs must not be mounted on production systems because it exists for debug reasons only, so no additional security settings are needed.

My version of the patch (which was not posted on LKML):

http://www.openwall.com/lists/kernel-hardening/2011/06/05/4 (FWIW, it doesn't contain the bug in question.)

Quoted 4 lines
Quoted 2 lines

Kees, any objection to this patch? Will it break your existing systems?

Regardless, I have no objection -- this should be int, not octal.

No objection. GID should be decimal.

Quoted 9 lines

-Kees

Quoted 7 lines

thanks,

greg k-h

Quoted 2 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
---
 fs/debugfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
#5 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman
Quoted 3 lines · Dave Reisner

This patch technically breaks userspace, but I suspect that anyone who actually used this flag would have encountered this brokenness, declared it lunacy, and already sent a patch.

Quoted 8 lines

Kees is the one that originally did this change (I think, right?)

Kees, any objection to this patch? Will it break your existing systems?

thanks,

greg k-h

Actually the original patch was provided by Ludwig Nussel (cc'd) and commited as d6e486868cde58. Sorry, I should have mentioned at least the commit that introduced this in the original mailing.

d

Quoted 21 lines
Quoted 21 lines
---
 fs/debugfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/debugfs/inode.c +1 -1
index 153bb1e..a5f12b7 100644
@@ -176,7 +176,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
 			opts->uid = uid;
 			break;
 		case Opt_gid:
-			if (match_octal(&args[0], &option))
+			if (match_int(&args[0], &option))
 				return -EINVAL;
 			gid = make_kgid(current_user_ns(), option);
 			if (!gid_valid(gid))
Signature · 1 line
1.8.0.3