UID16

From: Jason Baron <jbaron_at_redhat.com>
Date: 2003-10-23 09:20:06
Although the CONFIG_UID16 is not set for ia64, the emulation layer
probably wants it set, as it is set to yes in arch/i386/config.in.  The
proposal is thus to force it on in in ia64's ia32 emulation layer.  This
patch was already accepted for the x86_64 emulation layer. See the thread
at: http://www.x86-64.org/lists/discuss/msg04027.html

thanks,

-Jason


--- 10-22-03/arch/ia64/ia32/sys_ia32.c.orig	2003-10-22 17:28:59.000000000 -0400
+++ 10-22-03/arch/ia64/ia32/sys_ia32.c	2003-10-22 17:38:27.000000000 -0400
@@ -76,6 +76,25 @@
 #define PAGE_OFF(addr)		((addr) & ~PAGE_MASK)
 #define MINSIGSTKSZ_IA32	2048
 
+/* backwards compatability for 16-bit uids */
+
+#undef high2lowuid
+#undef high2lowgid
+#undef low2highuid
+#undef low2highgid
+
+#define high2lowuid(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
+#define high2lowgid(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid)
+#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid)
+#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid)
+
+extern int overflowuid,overflowgid;
+
+typedef u16 old_uid_t;
+typedef u16 old_gid_t;
+
+#include "../../../kernel/uid16.c"
+
 extern asmlinkage long sys_execve (char *, char **, char **, struct pt_regs *);
 extern asmlinkage long sys_mprotect (unsigned long, size_t, unsigned long);
 extern asmlinkage long sys_munmap (unsigned long, size_t);
@@ -86,6 +105,8 @@ extern unsigned long arch_get_unmapped_a
 asmlinkage long sys32_mprotect (unsigned int, unsigned int, int);
 asmlinkage unsigned long sys_brk(unsigned long);
 
+
+
 /*
  * Anything that modifies or inspects ia32 user virtual memory must hold this semaphore
  * while doing so.
@@ -185,8 +206,8 @@ putstat (struct stat32 *ubuf, struct sta
 	err |= __put_user(kbuf->st_ino, &ubuf->st_ino);
 	err |= __put_user(kbuf->st_mode, &ubuf->st_mode);
 	err |= __put_user(kbuf->st_nlink, &ubuf->st_nlink);
-	err |= __put_user(kbuf->st_uid, &ubuf->st_uid);
-	err |= __put_user(kbuf->st_gid, &ubuf->st_gid);
+	err |= __put_user(high2lowuid(kbuf->st_uid), &ubuf->st_uid);
+	err |= __put_user(high2lowgid(kbuf->st_gid), &ubuf->st_gid);
 	err |= __put_user(kbuf->st_rdev, &ubuf->st_rdev);
 	err |= __put_user(kbuf->st_size, &ubuf->st_size);
 	err |= __put_user(kbuf->st_atime, &ubuf->st_atime);

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Oct 22 19:20:05 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:19 EST