[LWN Logo]

Date:   Wed, 15 Dec 1999 19:21:59 -0500 (EST)
From:   Chris Wing <wingc@engin.umich.edu>
To:     torvalds@transmeta.com
Subject: [PATCH] Core patch for 32-bit UIDs

Linus:

Is it possible to merge in support for 32-bit UIDs before 2.4 is out?

Ted Ts'o has approved the ext2 format change, which is compatible with the
HURD's layout for 32-bit UIDs.

The ipc patch is in the form that Manfred Spraul wanted.

I've spoken with the glibc developer Andreas Jaeger <aj@suse.de>, and he
is basically happy. A working glibc patch exists, and should make it into
the next glibc if you accept the kernel stuff.

I've ironed out the namespace problems, so there should be no breakage
even with old libc5 compiles that include header files from the kernel
source tree.

Adding the 32-bit UID stuff amounts to an extra 1.6 kbytes in the
compressed kernel, and 3 kbytes more kernel code at runtime. (on i386,
with everything enabled)

There should be no appreciable performance penalty. The majority of the
backwards compatibility stuff is not in a fast path (msgctl(), semctl(),
shmctl(), etc), and the stuff that is is implemented quickly (getuid(),
etc.)

Finally, although I'd rather not try to appeal to you with political
issues instead of technical ones, consider the following: although there
may be few groups asking for 32-bit UIDs, any organization that requires
them has more than 65,000 users almost by definition. Thus, even if only a
few such organizations exist, they represent hundreds of thousands of
users for whom Linux will simply not be an option.

For us, as well as these users, I ask that you consider adding this
support before 2.4. The patch works, it's simple, it's small, it's
necessary, and it breaks less stuff than the 64-bit file support did :)

It also will fix properly the ABI compatibility breakage with SysV shared
memory on the Alpha...



Thanks,
Chris Wing
wingc@engin.umich.edu


The following patch fixes all the basic stuff; the rest of it is SysVipc,
filesystems, and architecture-specific. This patch is safe to apply; it
will not change any existing behavior until the proper
architecture-specific stuff is merged.

The rest of the stuff is at:

http://www.engin.umich.edu/caen/systems/Linux/code/misc/2.3/19991215/
	linux-ext2.patch	- support 32-bit UIDs on ext2
	linux-i386.patch	- new system calls for i386
	linux-ipc.patch		- support 32-bit UIDs for SysVipc, this
				  also fixes the Alpha ABI issue





diff -uNr linux-2.3.33/Documentation/sysctl/fs.txt linux-uid32-core/Documentation/sysctl/fs.txt
--- linux-2.3.33/Documentation/sysctl/fs.txt	Mon Jul  5 23:04:47 1999
+++ linux-uid32-core/Documentation/sysctl/fs.txt	Wed Dec 15 18:13:06 1999
@@ -23,6 +23,8 @@
 - inode-max
 - inode-nr
 - inode-state
+- overflowuid
+- overflowgid
 - super-max
 - super-nr
 
@@ -114,6 +116,18 @@
 preshrink is nonzero when the nr_inodes > inode-max and the
 system needs to prune the inode list instead of allocating
 more.
+
+==============================================================
+
+overflowgid & overflowuid:
+
+Some filesystems only support 16-bit UIDs and GIDs, although in Linux
+UIDs and GIDs are 32 bits. When one of these filesystems is mounted
+with writes enabled, any UID or GID that would exceed 65535 is translated
+to a fixed value before being written to disk.
+
+These sysctls allow you to change the value of the fixed UID and GID.
+The default is 65534.
 
 ==============================================================
 
diff -uNr linux-2.3.33/Documentation/sysctl/kernel.txt linux-uid32-core/Documentation/sysctl/kernel.txt
--- linux-2.3.33/Documentation/sysctl/kernel.txt	Mon Jul  5 23:04:47 1999
+++ linux-uid32-core/Documentation/sysctl/kernel.txt	Wed Dec 15 18:13:06 1999
@@ -28,6 +28,8 @@
 - modprobe                    ==> Documentation/kmod.txt
 - osrelease
 - ostype
+- overflowgid
+- overflowuid
 - panic
 - powersave-nap               [ PPC only ]
 - printk
@@ -123,6 +125,18 @@
 this is the fifth kernel built from this source base and the
 date behind it indicates the time the kernel was built.
 The only way to tune these values is to rebuild the kernel :-)
+
+==============================================================
+
+overflowgid & overflowuid:
+
+if your architecture did not always support 32-bit UIDs (i.e. arm, i386,
+m68k, sh, and sparc32), a fixed UID and GID will be returned to
+applications that use the old 16-bit UID/GID system calls, if the actual
+UID or GID would exceed 65535.
+
+These sysctls allow you to change the value of the fixed UID and GID.
+The default is 65534.
 
 ==============================================================
 
diff -uNr linux-2.3.33/fs/binfmt_elf.c linux-uid32-core/fs/binfmt_elf.c
--- linux-2.3.33/fs/binfmt_elf.c	Sat Nov 20 13:09:05 1999
+++ linux-uid32-core/fs/binfmt_elf.c	Wed Dec 15 18:13:06 1999
@@ -29,6 +29,7 @@
 #include <linux/personality.h>
 #include <linux/elfcore.h>
 #include <linux/init.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -1160,8 +1161,8 @@
 	psinfo.pr_zomb = psinfo.pr_sname == 'Z';
 	psinfo.pr_nice = current->priority-15;
 	psinfo.pr_flag = current->flags;
-	psinfo.pr_uid = current->uid;
-	psinfo.pr_gid = current->gid;
+	psinfo.pr_uid = NEW_TO_OLD_UID(current->uid);
+	psinfo.pr_gid = NEW_TO_OLD_GID(current->gid);
 	{
 		int i, len;
 
diff -uNr linux-2.3.33/fs/open.c linux-uid32-core/fs/open.c
--- linux-2.3.33/fs/open.c	Tue Dec  7 18:32:51 1999
+++ linux-uid32-core/fs/open.c	Wed Dec 15 18:13:06 1999
@@ -9,6 +9,7 @@
 #include <linux/file.h>
 #include <linux/smp_lock.h>
 #include <linux/quotaops.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 
@@ -641,6 +642,23 @@
 out:
 	return error;
 }
+
+#ifdef UID16_COMPAT_NEEDED
+asmlinkage long sys_chown16(const char * filename, old_uid_t user, old_gid_t group)
+{
+	return(sys_chown(filename, low2highuid(user), low2highgid(group)));
+}
+
+asmlinkage long sys_lchown16(const char * filename, old_uid_t user, old_gid_t group)
+{
+	return(sys_lchown(filename, low2highuid(user), low2highgid(group)));
+}
+
+asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
+{
+	return(sys_fchown(fd, low2highuid(user), low2highgid(group)));
+}
+#endif /* UID16_COMPAT_NEEDED */
 
 /*
  * Note that while the flag value (low two bits) for sys_open means:
diff -uNr linux-2.3.33/fs/stat.c linux-uid32-core/fs/stat.c
--- linux-2.3.33/fs/stat.c	Mon Aug 23 14:15:53 1999
+++ linux-uid32-core/fs/stat.c	Wed Dec 15 18:13:06 1999
@@ -8,9 +8,22 @@
 #include <linux/errno.h>
 #include <linux/file.h>
 #include <linux/smp_lock.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 
+#ifdef UID16_COMPAT_NEEDED
+#define SET_OLDSTAT_UID(stat, uid)	(stat).st_uid = high2lowuid(uid)
+#define SET_OLDSTAT_GID(stat, gid)	(stat).st_gid = high2lowgid(gid)
+#define SET_STAT_UID(stat, uid)		(stat).st_uid32 = uid; (stat).st_uid = high2lowuid(uid)
+#define SET_STAT_GID(stat, gid)		(stat).st_gid32 = gid; (stat).st_gid = high2lowgid(gid)
+#else
+#define SET_OLDSTAT_UID(stat, uid)	(stat).st_uid = uid
+#define SET_OLDSTAT_GID(stat, gid)	(stat).st_gid = gid
+#define SET_STAT_UID(stat, uid)		(stat).st_uid = uid
+#define SET_STAT_GID(stat, gid)		(stat).st_gid = gid
+#endif /* UID16_COMPAT_NEEDED */
+
 /*
  * Revalidate the inode. This is required for proper NFS attribute caching.
  */
@@ -45,8 +58,8 @@
 	tmp.st_ino = inode->i_ino;
 	tmp.st_mode = inode->i_mode;
 	tmp.st_nlink = inode->i_nlink;
-	tmp.st_uid = inode->i_uid;
-	tmp.st_gid = inode->i_gid;
+	SET_OLDSTAT_UID(tmp, inode->i_uid);
+	SET_OLDSTAT_GID(tmp, inode->i_gid);
 	tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
 	tmp.st_size = inode->i_size;
 	tmp.st_atime = inode->i_atime;
@@ -67,8 +80,8 @@
 	tmp.st_ino = inode->i_ino;
 	tmp.st_mode = inode->i_mode;
 	tmp.st_nlink = inode->i_nlink;
-	tmp.st_uid = inode->i_uid;
-	tmp.st_gid = inode->i_gid;
+	SET_STAT_UID(tmp, inode->i_uid);
+	SET_STAT_GID(tmp, inode->i_gid);
 	tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
 	tmp.st_size = inode->i_size;
 	tmp.st_atime = inode->i_atime;
diff -uNr linux-2.3.33/include/linux/elfcore.h linux-uid32-core/include/linux/elfcore.h
--- linux-2.3.33/include/linux/elfcore.h	Tue Dec 14 14:30:30 1999
+++ linux-uid32-core/include/linux/elfcore.h	Wed Dec 15 18:13:06 1999
@@ -71,8 +71,8 @@
 	char	pr_zomb;	/* zombie */
 	char	pr_nice;	/* nice val */
 	unsigned long pr_flag;	/* flags */
-	uid_t	pr_uid;
-	gid_t	pr_gid;
+	__kernel_uid_t	pr_uid;
+	__kernel_gid_t	pr_gid;
 	pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
 	/* Lots missing */
 	char	pr_fname[16];	/* filename of executable */
diff -uNr linux-2.3.33/include/linux/highuid.h linux-uid32-core/include/linux/highuid.h
--- linux-2.3.33/include/linux/highuid.h	Wed Dec 31 19:00:00 1969
+++ linux-uid32-core/include/linux/highuid.h	Wed Dec 15 18:13:06 1999
@@ -0,0 +1,93 @@
+#ifndef _LINUX_HIGHUID_H
+#define _LINUX_HIGHUID_H
+
+#include <linux/types.h>
+
+/*
+ * general notes:
+ *
+ * UID16_COMPAT_NEEDED is defined in include/asm-{arch}/posix_types.h
+ * if the given architecture needs to support backwards compatibility
+ * for old system calls.
+ *
+ * old_uid_t and old_gid_t are only used if UID16_COMPAT_NEEDED
+ * is defined.
+ *
+ * uid16_t and gid16_t are used on all architectures. (when dealing
+ * with structures hard coded to 16 bits, such as in filesystems)
+ */
+
+
+#ifdef UID16_COMPAT_NEEDED
+
+/*
+ * This is the "overflow" UID and GID. They are used to signify uid/gid
+ * overflow to old programs when they request uid/gid information but are
+ * using the old 16 bit interfaces.
+ * When you run a libc5 program, it will think that all highuid files or
+ * processes are owned by this uid/gid.
+ * The idea is that it's better to do so than possibly return 0 in lieu of
+ * 65536, etc.
+ */
+
+extern int overflowuid;
+extern int overflowgid;
+
+#define DEFAULT_OVERFLOWUID	65534
+#define DEFAULT_OVERFLOWGID	65534
+
+
+/* prevent uid mod 65536 effect by returning a default value for high UIDs */
+#define high2lowuid(uid) (uid > 65535) ? (old_uid_t)overflowuid : (old_uid_t)uid
+#define high2lowgid(gid) (gid > 65535) ? (old_gid_t)overflowgid : (old_gid_t)gid
+
+/*
+ * -1 is different in 16 bits than it is in 32 bits
+ * these macros are used by chown(), setreuid(), ...,
+ */
+#define low2highuid(uid) (uid == (old_uid_t)-1) ? (uid_t)-1 : (uid_t)uid
+#define low2highgid(gid) (gid == (old_gid_t)-1) ? (gid_t)-1 : (gid_t)gid
+
+/* Avoid extra ifdefs with these macros */
+
+#define SET_UID16(var, uid)	var = high2lowuid(uid)
+#define SET_GID16(var, gid)	var = high2lowgid(gid)
+#define NEW_TO_OLD_UID(uid)	high2lowuid(uid)
+#define NEW_TO_OLD_GID(gid)	high2lowgid(gid)
+
+#else
+
+#define SET_UID16(var, uid)	do { ; } while (0)
+#define SET_GID16(var, gid)	do { ; } while (0)
+#define NEW_TO_OLD_UID(uid)	uid
+#define NEW_TO_OLD_GID(gid)	gid
+
+#endif /* UID16_COMPAT_NEEDED */
+
+
+/*
+ * Everything below this line is needed on all architectures, to deal with
+ * filesystems that only store 16 bits of the UID/GID, etc.
+ */
+
+/*
+ * This is the UID and GID that will get written to disk if a filesystem
+ * only supports 16-bit UIDs and the kernel has a high UID/GID to write
+ */
+extern int fs_overflowuid;
+extern int fs_overflowgid;
+
+#define DEFAULT_FS_OVERFLOWUID	65534
+#define DEFAULT_FS_OVERFLOWGID	65534
+
+/*
+ * Since these macros are used in architectures that only need limited
+ * 16-bit UID back compatibility, we won't use old_uid_t and old_gid_t
+ */
+#define fs_high2lowuid(uid) (uid > 65535) ? (uid16_t)fs_overflowuid : (uid16_t)uid
+#define fs_high2lowgid(gid) (gid > 65535) ? (gid16_t)fs_overflowgid : (gid16_t)gid
+
+#define low_16_bits(x)	x & 0xFFFF
+#define high_16_bits(x)	(x & 0xFFFF0000) >> 16
+
+#endif /* _LINUX_HIGHUID_H */
diff -uNr linux-2.3.33/include/linux/sysctl.h linux-uid32-core/include/linux/sysctl.h
--- linux-2.3.33/include/linux/sysctl.h	Sat Nov 27 18:27:49 1999
+++ linux-uid32-core/include/linux/sysctl.h	Wed Dec 15 18:13:06 1999
@@ -108,7 +108,9 @@
  	KERN_MSGMNI=42,		/* int: msg queue identifiers */
  	KERN_SEM=43,		/* struct: sysv semaphore limits */
  	KERN_SPARC_STOP_A=44,	/* int: Sparc Stop-A enable */
- 	KERN_SHMMNI=45		/* int: shm array identifiers */
+ 	KERN_SHMMNI=45,		/* int: shm array identifiers */
+	KERN_OVERFLOWUID=46,	/* int: overflow UID */
+	KERN_OVERFLOWGID=47	/* int: overflow GID */
 };
 
 
@@ -486,7 +488,9 @@
 	FS_MAXFILE=7,	/* int:maximum number of filedescriptors that can be allocated */
 	FS_DENTRY=8,
 	FS_NRSUPER=9,	/* int:current number of allocated super_blocks */
-	FS_MAXSUPER=10 	/* int:maximum number of super_blocks that can be allocated */
+	FS_MAXSUPER=10,	/* int:maximum number of super_blocks that can be allocated */
+	FS_OVERFLOWUID=11,	/* int: overflow UID */
+	FS_OVERFLOWGID=12	/* int: overflow GID */
 };
 
 /* CTL_DEBUG names: */
diff -uNr linux-2.3.33/kernel/signal.c linux-uid32-core/kernel/signal.c
--- linux-2.3.33/kernel/signal.c	Mon Oct 11 13:15:40 1999
+++ linux-uid32-core/kernel/signal.c	Wed Dec 15 18:13:06 1999
@@ -12,6 +12,7 @@
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 
@@ -143,6 +144,7 @@
 			info->si_code = 0;
 			info->si_pid = 0;
 			info->si_uid = 0;
+			SET_UID16(info->si_uid16, 0);
 		} else {
 			struct signal_queue *q, **pp;
 			pp = &current->sigqueue;
@@ -178,6 +180,7 @@
 				info->si_code = 0;
 				info->si_pid = 0;
 				info->si_uid = 0;
+				SET_UID16(info->si_uid16, 0);
 			}
 		}
 
@@ -340,6 +343,7 @@
 				q->info.si_code = SI_USER;
 				q->info.si_pid = current->pid;
 				q->info.si_uid = current->uid;
+				SET_UID16(q->info.si_uid16, current->uid);
 				break;
 			case 1:
 				q->info.si_signo = sig;
@@ -347,6 +351,7 @@
 				q->info.si_code = SI_KERNEL;
 				q->info.si_pid = 0;
 				q->info.si_uid = 0;
+				SET_UID16(q->info.si_uid16, 0);
 				break;
 			default:
 				q->info = *info;
@@ -795,6 +800,7 @@
 	info.si_code = SI_USER;
 	info.si_pid = current->pid;
 	info.si_uid = current->uid;
+	SET_UID16(info.si_uid16, current->uid);
 
 	return kill_something_info(sig, &info, pid);
 }
diff -uNr linux-2.3.33/kernel/sys.c linux-uid32-core/kernel/sys.c
--- linux-2.3.33/kernel/sys.c	Fri Oct 29 16:19:49 1999
+++ linux-uid32-core/kernel/sys.c	Wed Dec 15 18:14:06 1999
@@ -12,11 +12,30 @@
 #include <linux/reboot.h>
 #include <linux/prctl.h>
 #include <linux/init.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
 /*
+ * this is where the system-wide overflow UID and GID are defined, for
+ * architectures that now have 32-bit UID/GID but didn't in the past
+ */
+
+#ifdef UID16_COMPAT_NEEDED
+int overflowuid = DEFAULT_OVERFLOWUID;
+int overflowgid = DEFAULT_OVERFLOWGID;
+#endif /* UID16_COMPAT_NEEDED */
+
+/*
+ * the same as above, but for filesystems which can only store a 16-bit
+ * UID and GID. as such, this is needed on all architectures
+ */
+
+int fs_overflowuid = DEFAULT_FS_OVERFLOWUID;
+int fs_overflowgid = DEFAULT_FS_OVERFLOWUID;
+
+/*
  * this indicates whether you can reboot with ctrl-alt-del: the default is yes
  */
 
@@ -599,6 +618,72 @@
 	return old_fsgid;
 }
 
+#ifdef UID16_COMPAT_NEEDED
+asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
+{
+	return sys_setregid(low2highgid(rgid), low2highgid(egid));
+}
+
+asmlinkage long sys_setgid16(old_gid_t gid)
+{
+	return sys_setgid((gid_t)low_16_bits(gid));
+}
+
+asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
+{
+	return sys_setreuid(low2highuid(ruid), low2highuid(euid));
+}
+
+asmlinkage long sys_setuid16(old_uid_t uid)
+{
+	return sys_setuid((uid_t)low_16_bits(uid));
+}
+
+asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
+{
+	return(sys_setresuid(low2highuid(ruid), low2highuid(euid),
+		low2highuid(suid)));
+}
+
+asmlinkage long sys_getresuid16(old_uid_t *ruid, old_uid_t *euid, old_uid_t *suid)
+{
+	int retval;
+
+	if (!(retval = put_user(high2lowuid(current->uid), ruid)) &&
+	    !(retval = put_user(high2lowuid(current->euid), euid)))
+		retval = put_user(high2lowuid(current->suid), suid);
+
+	return retval;
+}
+
+asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
+{
+	return(sys_setresgid(low2highgid(rgid), low2highgid(egid),
+		low2highgid(sgid)));
+}
+
+asmlinkage long sys_getresgid16(old_gid_t *rgid, old_gid_t *egid, old_gid_t *sgid)
+{
+	int retval;
+
+	if (!(retval = put_user(high2lowgid(current->gid), rgid)) &&
+	    !(retval = put_user(high2lowgid(current->egid), egid)))
+		retval = put_user(high2lowgid(current->sgid), sgid);
+
+	return retval;
+}
+
+asmlinkage long sys_setfsuid16(old_uid_t uid)
+{
+	return sys_setfsuid((uid_t)low_16_bits(uid));
+}
+
+asmlinkage long sys_setfsgid16(old_gid_t gid)
+{
+	return sys_setfsgid((gid_t)low_16_bits(gid));
+}
+#endif /* UID16_COMPAT_NEEDED */
+
 asmlinkage long sys_times(struct tms * tbuf)
 {
 	/*
@@ -784,6 +869,44 @@
 	current->ngroups = gidsetsize;
 	return 0;
 }
+
+#ifdef UID16_COMPAT_NEEDED
+asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t *grouplist)
+{
+	old_gid_t groups[NGROUPS];
+	int i,j;
+
+	if (gidsetsize < 0)
+		return -EINVAL;
+	i = current->ngroups;
+	if (gidsetsize) {
+		if (i > gidsetsize)
+			return -EINVAL;
+		for(j=0;j<i;j++)
+			groups[j] = current->groups[j];
+		if (copy_to_user(grouplist, groups, sizeof(old_gid_t)*i))
+			return -EFAULT;
+	}
+	return i;
+}
+
+asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t *grouplist)
+{
+	old_gid_t groups[NGROUPS];
+	int i;
+
+	if (!capable(CAP_SETGID))
+		return -EPERM;
+	if ((unsigned) gidsetsize > NGROUPS)
+		return -EINVAL;
+	if(copy_from_user(groups, grouplist, gidsetsize * sizeof(old_gid_t)))
+		return -EFAULT;
+	for(i=0;i<gidsetsize;i++)
+		current->groups[i] = (gid_t)groups[i];
+	current->ngroups = gidsetsize;
+	return 0;
+}
+#endif /* UID16_COMPAT_NEEDED */
 
 int in_group_p(gid_t grp)
 {
diff -uNr linux-2.3.33/kernel/sysctl.c linux-uid32-core/kernel/sysctl.c
--- linux-2.3.33/kernel/sysctl.c	Mon Dec  6 20:09:24 1999
+++ linux-uid32-core/kernel/sysctl.c	Wed Dec 15 18:13:07 1999
@@ -25,6 +25,7 @@
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/sysrq.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 
@@ -42,6 +43,10 @@
 extern int max_threads;
 extern int nr_queued_signals, max_queued_signals;
 
+/* this is needed for the proc_dointvec_minmax for overflow UID and GID */
+static int maxolduid = 65535;
+static int minolduid = 0;
+
 #ifdef CONFIG_KMOD
 extern char modprobe_path[];
 #endif
@@ -239,6 +244,14 @@
 	{KERN_MAX_THREADS, "threads-max", &max_threads, sizeof(int),
 	 0644, NULL, &proc_dointvec},
 	{KERN_RANDOM, "random", NULL, 0, 0555, random_table},
+#ifdef UID16_COMPAT_NEEDED
+	{KERN_OVERFLOWUID, "overflowuid", &overflowuid, sizeof(int), 0644, NULL,
+	 &proc_dointvec_minmax, &sysctl_intvec, NULL,
+	 &minolduid, &maxolduid},
+	{KERN_OVERFLOWGID, "overflowgid", &overflowgid, sizeof(int), 0644, NULL,
+	 &proc_dointvec_minmax, &sysctl_intvec, NULL,
+	 &minolduid, &maxolduid},
+#endif /* UID16_COMPAT_NEEDED */
 	{0}
 };
 
@@ -286,6 +299,12 @@
 	 0644, NULL, &proc_dointvec},
 	{FS_DENTRY, "dentry-state", &dentry_stat, 6*sizeof(int),
 	 0444, NULL, &proc_dointvec},
+	{FS_OVERFLOWUID, "overflowuid", &fs_overflowuid, sizeof(int), 0644, NULL,
+	 &proc_dointvec_minmax, &sysctl_intvec, NULL,
+	 &minolduid, &maxolduid},
+	{FS_OVERFLOWGID, "overflowgid", &fs_overflowgid, sizeof(int), 0644, NULL,
+	 &proc_dointvec_minmax, &sysctl_intvec, NULL,
+	 &minolduid, &maxolduid},
 	{0}
 };
 
diff -uNr linux-2.3.33/kernel/timer.c linux-uid32-core/kernel/timer.c
--- linux-2.3.33/kernel/timer.c	Mon Dec 13 19:13:36 1999
+++ linux-uid32-core/kernel/timer.c	Wed Dec 15 18:13:07 1999
@@ -21,6 +21,7 @@
 #include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
+#include <linux/highuid.h>
 
 #include <asm/uaccess.h>
 
@@ -745,6 +746,28 @@
 	/* Only we change this so SMP safe */
 	return  current->egid;
 }
+
+#ifdef UID16_COMPAT_NEEDED
+asmlinkage long sys_getuid16(void)
+{
+	return high2lowuid(current->uid);
+}
+
+asmlinkage long sys_geteuid16(void)
+{
+	return high2lowuid(current->euid);
+}
+
+asmlinkage long sys_getgid16(void)
+{
+	return high2lowgid(current->gid);
+}
+
+asmlinkage long sys_getegid16(void)
+{
+	return high2lowgid(current->egid);
+}
+#endif /* UID16_COMPAT_NEEDED */
 
 #endif
 






-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/