PATCH 2.3.40.1: 32-bit UID fixes (for Alpha)

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Wed Jan 12 2000 - 05:34:03 EST


Attached is a patch against 2.3.40 pre1 which incorporates several fixes
to the recently-added 32-bit uid support. These fixes have been tested
on my Alpha, and were necessary in order to compile (and boot) it.

The UID16_COMPAT_NEEDED define becomes CONFIG_UID16, mainly to make it
easy to conditionally compile kernel/uid16.c. Switches like UID16 are
much better as CONFIG_xxx as we have already a nice
makefile+config+header system which deals nicely with such things.

Aside from the rename change, the patch include several fixes to the
core 32-bit support in order to fulfill its promise of disappearing when
not necessary.

If there are no problems, would you (Linus) consider applying this
patch?

Regards,

        Jeff

-- 
Jeff Garzik         | Another priceless gem from slashdot:
Building 1024       | "I use Mandrake for the same reason I flip the
MandrakeSoft, Inc.  |  lightswitch 17 times every time I leave
                    |  the room...   If I don't, my family will die."

diff -urN ../vanilla/linux-2.3.40-pre1/arch/alpha/config.in linux_2_3/arch/alpha/config.in --- ../vanilla/linux-2.3.40-pre1/arch/alpha/config.in Wed Jan 12 04:53:25 2000 +++ linux_2_3/arch/alpha/config.in Wed Jan 12 04:23:47 2000 @@ -2,6 +2,9 @@ # For a description of the syntax of this configuration file, # see the Configure script. # + +define_bool CONFIG_UID16 n + mainmenu_name "Kernel configuration of Linux for Alpha machines" mainmenu_option next_comment @@ -179,6 +182,12 @@ fi source drivers/pci/Config.in + +bool 'Support for hot-pluggable devices' CONFIG_HOTPLUG + +if [ "$CONFIG_HOTPLUG" = "y" ] ; then + source drivers/pcmcia/Config.in +fi bool 'Networking support' CONFIG_NET bool 'System V IPC' CONFIG_SYSVIPC diff -urN ../vanilla/linux-2.3.40-pre1/arch/arm/config.in linux_2_3/arch/arm/config.in --- ../vanilla/linux-2.3.40-pre1/arch/arm/config.in Tue Dec 7 18:38:22 1999 +++ linux_2_3/arch/arm/config.in Wed Jan 12 03:01:58 2000 @@ -6,6 +6,8 @@ define_bool CONFIG_ARM y +define_bool CONFIG_UID16 y + mainmenu_option next_comment comment 'Code maturity level options' bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL diff -urN ../vanilla/linux-2.3.40-pre1/arch/i386/config.in linux_2_3/arch/i386/config.in --- ../vanilla/linux-2.3.40-pre1/arch/i386/config.in Wed Jan 12 04:53:25 2000 +++ linux_2_3/arch/i386/config.in Wed Jan 12 03:01:58 2000 @@ -7,6 +7,8 @@ define_bool CONFIG_X86 y define_bool CONFIG_ISA y +define_bool CONFIG_UID16 y + mainmenu_option next_comment comment 'Code maturity level options' bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL diff -urN ../vanilla/linux-2.3.40-pre1/arch/m68k/config.in linux_2_3/arch/m68k/config.in --- ../vanilla/linux-2.3.40-pre1/arch/m68k/config.in Tue Dec 7 18:38:22 1999 +++ linux_2_3/arch/m68k/config.in Wed Jan 12 03:01:58 2000 @@ -2,6 +2,9 @@ # For a description of the syntax of this configuration file, # see the Configure script. # + +define_bool CONFIG_UID16 y + mainmenu_name "Linux/68k Kernel Configuration" mainmenu_option next_comment diff -urN ../vanilla/linux-2.3.40-pre1/include/asm-alpha/posix_types.h linux_2_3/include/asm-alpha/posix_types.h --- ../vanilla/linux-2.3.40-pre1/include/asm-alpha/posix_types.h Mon Jan 10 21:15:58 2000 +++ linux_2_3/include/asm-alpha/posix_types.h Wed Jan 12 03:01:58 2000 @@ -28,12 +28,17 @@ typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; -typedef unsigned int __kernel_uid32_t; -typedef unsigned int __kernel_gid32_t; typedef struct { int val[2]; } __kernel_fsid_t; + +#ifdef __KERNEL__ +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +typedef __kernel_uid_t __kernel_uid32_t; +typedef __kernel_gid_t __kernel_gid32_t; +#endif /* __KERNEL__ */ #ifdef __KERNEL__ diff -urN ../vanilla/linux-2.3.40-pre1/include/asm-arm/posix_types.h linux_2_3/include/asm-arm/posix_types.h --- ../vanilla/linux-2.3.40-pre1/include/asm-arm/posix_types.h Mon Jan 10 21:15:58 2000 +++ linux_2_3/include/asm-arm/posix_types.h Wed Jan 12 03:01:58 2000 @@ -9,6 +9,10 @@ #ifndef __ARCH_ARM_POSIX_TYPES_H #define __ARCH_ARM_POSIX_TYPES_H +#if defined(__KERNEL__) +#include <linux/config.h> +#endif /* __KERNEL__ */ + /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -37,11 +41,10 @@ typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#ifdef __KERNEL__ -#define UID16_COMPAT_NEEDED +#if defined(__KERNEL__) && defined(CONFIG_UID16) typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ && CONFIG_UID16 */ #ifdef __GNUC__ typedef long long __kernel_loff_t; diff -urN ../vanilla/linux-2.3.40-pre1/include/asm-i386/posix_types.h linux_2_3/include/asm-i386/posix_types.h --- ../vanilla/linux-2.3.40-pre1/include/asm-i386/posix_types.h Mon Jan 10 21:15:58 2000 +++ linux_2_3/include/asm-i386/posix_types.h Wed Jan 12 03:01:58 2000 @@ -1,6 +1,10 @@ #ifndef __ARCH_I386_POSIX_TYPES_H #define __ARCH_I386_POSIX_TYPES_H +#if defined(__KERNEL__) +#include <linux/config.h> +#endif /* __KERNEL__ */ + /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -29,8 +33,7 @@ typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#ifdef __KERNEL__ -#define UID16_COMPAT_NEEDED +#if defined(__KERNEL__) && defined(CONFIG_UID16) typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; #endif /* __KERNEL__ */ diff -urN ../vanilla/linux-2.3.40-pre1/include/asm-m68k/posix_types.h linux_2_3/include/asm-m68k/posix_types.h --- ../vanilla/linux-2.3.40-pre1/include/asm-m68k/posix_types.h Mon Jan 10 21:15:58 2000 +++ linux_2_3/include/asm-m68k/posix_types.h Wed Jan 12 03:01:58 2000 @@ -1,6 +1,10 @@ #ifndef __ARCH_M68K_POSIX_TYPES_H #define __ARCH_M68K_POSIX_TYPES_H +#if defined(__KERNEL__) +#include <linux/config.h> +#endif /* __KERNEL__ */ + /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -29,8 +33,7 @@ typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#ifdef __KERNEL__ -#define UID16_COMPAT_NEEDED +#if defined(__KERNEL__) && defined(CONFIG_UID16) typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; #endif /* __KERNEL__ */ diff -urN ../vanilla/linux-2.3.40-pre1/include/linux/highuid.h linux_2_3/include/linux/highuid.h --- ../vanilla/linux-2.3.40-pre1/include/linux/highuid.h Mon Jan 10 21:29:08 2000 +++ linux_2_3/include/linux/highuid.h Wed Jan 12 03:01:58 2000 @@ -1,24 +1,23 @@ #ifndef _LINUX_HIGHUID_H #define _LINUX_HIGHUID_H +#include <linux/config.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. + * CONFIG_UID16 is defined 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. + * old_uid_t and old_gid_t are only used if CONFIG_UID16 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 +#ifdef CONFIG_UID16 /* * This is the "overflow" UID and GID. They are used to signify uid/gid @@ -73,7 +72,7 @@ #define high2lowuid(x) (x) -#endif /* UID16_COMPAT_NEEDED */ +#endif /* CONFIG_UID16 */ /* diff -urN ../vanilla/linux-2.3.40-pre1/kernel/Makefile linux_2_3/kernel/Makefile --- ../vanilla/linux-2.3.40-pre1/kernel/Makefile Mon Jan 10 21:15:58 2000 +++ linux_2_3/kernel/Makefile Wed Jan 12 03:01:58 2000 @@ -13,9 +13,13 @@ O_TARGET := kernel.o O_OBJS = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \ module.o exit.o itimer.o info.o time.o softirq.o resource.o \ - sysctl.o acct.o capability.o ptrace.o timer.o uid16.o + sysctl.o acct.o capability.o ptrace.o timer.o OX_OBJS += signal.o + +ifeq ($(CONFIG_UID16),y) +O_OBJS += uid16.o +endif ifeq ($(CONFIG_KMOD),y) O_OBJS += kmod.o diff -urN ../vanilla/linux-2.3.40-pre1/kernel/sys.c linux_2_3/kernel/sys.c --- ../vanilla/linux-2.3.40-pre1/kernel/sys.c Mon Jan 10 21:15:58 2000 +++ linux_2_3/kernel/sys.c Wed Jan 12 03:01:58 2000 @@ -4,6 +4,7 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ +#include <linux/config.h> #include <linux/mm.h> #include <linux/utsname.h> #include <linux/mman.h> @@ -17,6 +18,8 @@ #include <asm/uaccess.h> #include <asm/io.h> +#ifdef CONFIG_UID16 + /* * 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 @@ -24,6 +27,8 @@ int overflowuid = DEFAULT_OVERFLOWUID; int overflowgid = DEFAULT_OVERFLOWGID; + +#endif /* CONFIG_UID16 */ /* * the same as above, but for filesystems which can only store a 16-bit diff -urN ../vanilla/linux-2.3.40-pre1/kernel/sysctl.c linux_2_3/kernel/sysctl.c --- ../vanilla/linux-2.3.40-pre1/kernel/sysctl.c Mon Jan 10 21:15:58 2000 +++ linux_2_3/kernel/sysctl.c Wed Jan 12 03:01:58 2000 @@ -247,12 +247,14 @@ {KERN_MAX_THREADS, "threads-max", &max_threads, sizeof(int), 0644, NULL, &proc_dointvec}, {KERN_RANDOM, "random", NULL, 0, 0555, random_table}, +#ifdef CONFIG_UID16 {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 /* CONFIG_UID16 */ {0} };

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



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:20 EST