mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* getgroups16() problem
@ 2004-05-04 22:12 Tomas Olsson
  0 siblings, 0 replies; only message in thread
From: Tomas Olsson @ 2004-05-04 22:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Hi,
sys_getgroups16 (or rather groups16_to_user()) returns large gids
truncated. Needs to be fixed, one way or another. Don't know why the other
similar casts are still there.

Any thoughts?

/Tomas

--- linux-2.6.5/kernel/uid16.c	2004-04-04 05:37:07.000000000 +0200
+++ linux/kernel/uid16.c	2004-05-04 16:28:03.000000000 +0200
@@ -39,7 +39,7 @@
 
 asmlinkage long sys_setgid16(old_gid_t gid)
 {
-	return sys_setgid((gid_t)gid);
+	return sys_setgid(low2highgid(gid));
 }
 
 asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
@@ -49,7 +49,7 @@
 
 asmlinkage long sys_setuid16(old_uid_t uid)
 {
-	return sys_setuid((uid_t)uid);
+	return sys_setuid(low2highuid(uid));
 }
 
 asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
@@ -88,12 +88,12 @@
 
 asmlinkage long sys_setfsuid16(old_uid_t uid)
 {
-	return sys_setfsuid((uid_t)uid);
+	return sys_setfsuid(low2highuid(uid));
 }
 
 asmlinkage long sys_setfsgid16(old_gid_t gid)
 {
-	return sys_setfsgid((gid_t)gid);
+	return sys_setfsgid(low2highgid(gid));
 }
 
 static int groups16_to_user(old_gid_t __user *grouplist,
@@ -103,7 +103,7 @@
 	old_gid_t group;
 
 	for (i = 0; i < group_info->ngroups; i++) {
-		group = (old_gid_t)GROUP_AT(group_info, i);
+		group = high2lowgid(GROUP_AT(group_info, i));
 		if (put_user(group, grouplist+i))
 			return -EFAULT;
 	}
@@ -120,7 +120,7 @@
 	for (i = 0; i < group_info->ngroups; i++) {
 		if (get_user(group, grouplist+i))
 			return  -EFAULT;
-		GROUP_AT(group_info, i) = (gid_t)group;
+		GROUP_AT(group_info, i) = low2highgid(group);
 	}
 
 	return 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-04 22:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-04 22:12 getgroups16() problem Tomas Olsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®