Messages in this thread Patch in this message |  | | Date | Thu, 21 Nov 1996 13:43:30 +0100 (MET) | From | Farzad FARID <> | Subject | Patch: 3 bugfixes for sysctl |
| |
Hello Linus and everybody else,
Here are a few bugs fixes for the sysctl mechanism. This patch fixes the following things:
* The function in_egroup_p() compares a GID with a UID. * The binary IDs of /proc/sys/kernel/nfs-root-name and /proc/sys/kernel/nfs-root-addrs were the same. * /proc/sys/kernel/java-[interpreter|appletviewer] was not created if binfmt_java is compiled as a module. So I made the sysctl registration dynamic as in IPv6.
The patch also fixes a minor prototype warning in the softdog.c file.
It has been successfully tested under linux 2.0.25, 2.1.8 and 2.1.10.
Cheers, Farzad
diff -ur linux.orig/drivers/char/softdog.c linux/drivers/char/softdog.c --- linux.orig/drivers/char/softdog.c Sun Nov 17 22:24:10 1996 +++ linux/drivers/char/softdog.c Sun Nov 17 22:20:06 1996 @@ -93,7 +93,7 @@ #endif } -static int softdog_write(struct inode *inode, struct file *file, const char *data, int len) +static long softdog_write(struct inode *inode, struct file *file, const char *data, unsigned long len) { /* * Refresh the timer. diff -ur linux.orig/fs/binfmt_java.c linux/fs/binfmt_java.c --- linux.orig/fs/binfmt_java.c Mon Nov 11 19:54:06 1996 +++ linux/fs/binfmt_java.c Sun Nov 17 22:28:17 1996 @@ -10,6 +10,7 @@ #include <linux/stat.h> #include <linux/malloc.h> #include <linux/binfmts.h> +#include <linux/sysctl.h> #define _PATH_JAVA "/usr/bin/java" #define _PATH_APPLET "/usr/bin/appletviewer" @@ -17,6 +18,20 @@ char binfmt_java_interpreter[65] = _PATH_JAVA; char binfmt_java_appletviewer[65] = _PATH_APPLET; +static struct ctl_table_header *java_sysctl_header; + +static struct ctl_table java_table[] = { + {KERN_JAVA_INTERPRETER, "java-interpreter", binfmt_java_interpreter, + 64, 0644, NULL, &proc_dostring, &sysctl_string }, + {KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer, + 64, 0644, NULL, &proc_dostring, &sysctl_string }, + {0} +}; + +static struct ctl_table java_root_table[] = { + {CTL_KERN, "kernel", NULL, 0, 0555, java_table}, + {0} +}; static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs) { @@ -171,6 +186,7 @@ int init_java_binfmt(void) { printk(KERN_INFO "JAVA Binary support v1.01 for Linux 1.3.98 (C)1996 Brian A. Lantz\n"); + java_sysctl_header = register_sysctl_table(java_root_table, 0); register_binfmt(&java_format); return register_binfmt(&applet_format); } @@ -185,5 +201,6 @@ printk(KERN_INFO "Removing JAVA Binary support...\n"); unregister_binfmt(&java_format); unregister_binfmt(&applet_format); + unregister_sysctl_table(java_sysctl_header); } #endif diff -ur linux.orig/kernel/sysctl.c linux/kernel/sysctl.c --- linux.orig/kernel/sysctl.c Mon Nov 11 19:53:47 1996 +++ linux/kernel/sysctl.c Mon Nov 11 19:57:10 1996 @@ -99,8 +99,6 @@ static int do_securelevel_strategy (ctl_table *, int *, int, void *, size_t *, void *, size_t, void **); -extern char binfmt_java_interpreter[], binfmt_java_appletviewer[]; - /* The default sysctl tables: */ static ctl_table root_table[] = { @@ -140,15 +138,9 @@ #ifdef CONFIG_ROOT_NFS {KERN_NFSRNAME, "nfs-root-name", nfs_root_name, NFS_ROOT_NAME_LEN, 0644, NULL, &proc_dostring, &sysctl_string }, - {KERN_NFSRNAME, "nfs-root-addrs", nfs_root_addrs, NFS_ROOT_ADDRS_LEN, + {KERN_NFSRADDRS, "nfs-root-addrs", nfs_root_addrs, NFS_ROOT_ADDRS_LEN, 0644, NULL, &proc_dostring, &sysctl_string }, #endif -#ifdef CONFIG_BINFMT_JAVA - {KERN_JAVA_INTERPRETER, "java-interpreter", binfmt_java_interpreter, - 64, 0644, NULL, &proc_dostring, &sysctl_string }, - {KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer, - 64, 0644, NULL, &proc_dostring, &sysctl_string }, -#endif {0} }; @@ -231,7 +223,7 @@ { int i; - if (grp == current->euid) + if (grp == current->egid) return 1; for (i = 0; i < NGROUPS; i++) {
-- Farzad FARID Administrateur Reseau SGIP - Publicis
|  |