Messages in this thread Patches in this message | | | Date | Fri, 1 Jan 1999 12:47:02 +0100 (MET) | From | Richard Guenther <> | Subject | bogous binfmt_misc patch in 2.2.0-pre1 |
| |
Hi Linus!
Could you please revert the patch you got for binfmt_misc? Its wrong as it leaves binfmt_misc in a completely unusuable state if CONFIG_PROC_FS is not set. (patch to revert the changes and one pending change from me (remove stale variable) is attached)
Although there is no chance of misconfiguration if one reads the Configure.help entry, to prevent even silly misconfiguration you may consider patch #2, that makes CONFIG_PROC_FS depend on CONFIG_BINFMT_MISC (yes, I dont like the order, too - but there is no way to make CONFIG_BINFMT_MISC depend on CONFIG_PROC_FS), or alternatively patch #3, that makes binfmt_misc compile conditionaly on CONFIG_PROC_FS (i.e. it leaves the user without binfmt_misc, if he/she was unable to select CONFIG_PROC_FS).
Thanx, Richard.
PS: it seems, this patch was caused by a "random config compile" - naaah... :(
-- Richard Guenther <richard.guenther@student.uni-tuebingen.de> PGP: 2E829319 - 2F 83 FC 93 E9 E4 19 E2 93 7A 32 42 45 37 23 57 WWW: http://www.anatom.uni-tuebingen.de/~richi/ --- linux-2.2.0-pre2/fs/binfmt_misc.c.original Thu Dec 31 18:23:57 1998 +++ linux-2.2.0-pre2/fs/binfmt_misc.c Thu Dec 31 18:38:59 1998 @@ -67,7 +67,7 @@ static int free_id = 1; static int enabled = 1; -#ifdef __SMP__ +#ifdef CONFIG_SMP static rwlock_t entries_lock = RW_LOCK_UNLOCKED; #endif @@ -179,26 +179,23 @@ struct dentry * dentry; char iname[128]; char *iname_addr = iname; - int retval, fmt_flags = 0; + int retval; MOD_INC_USE_COUNT; - if (!enabled) { - retval = -ENOEXEC; + retval = -ENOEXEC; + if (!enabled) goto _ret; - } /* to keep locking time low, we copy the interpreter string */ read_lock(&entries_lock); - if ((fmt = check_file(bprm))) { + fmt = check_file(bprm); + if (fmt) { strncpy(iname, fmt->interpreter, 127); iname[127] = '\0'; - fmt_flags = fmt->flags; } read_unlock(&entries_lock); - if (!fmt) { - retval = -ENOEXEC; + if (!fmt) goto _ret; - } dput(bprm->dentry); bprm->dentry = NULL; @@ -209,10 +206,9 @@ bprm->argc++; bprm->p = copy_strings(1, &iname_addr, bprm->page, bprm->p, 2); bprm->argc++; - if (!bprm->p) { - retval = -E2BIG; + retval = -E2BIG; + if (!bprm->p) goto _ret; - } bprm->filename = iname; /* for binfmt_script */ dentry = open_namei(iname, 0, 0); @@ -452,9 +448,7 @@ */ static void entry_proc_cleanup(struct binfmt_entry *e) { -#ifdef CONFIG_PROC_FS remove_proc_entry(e->proc_name, bm_dir); -#endif } /* @@ -462,7 +456,6 @@ */ static int entry_proc_setup(struct binfmt_entry *e) { -#ifdef CONFIG_PROC_FS if (!(e->proc_dir = create_proc_entry(e->proc_name, S_IFREG | S_IRUGO | S_IWUSR, bm_dir))) return -ENOMEM; @@ -470,7 +463,6 @@ e->proc_dir->data = (void *) (e->id); e->proc_dir->read_proc = proc_read_status; e->proc_dir->write_proc = proc_write_status; -#endif return 0; } @@ -495,7 +487,6 @@ int __init init_misc_binfmt(void) { int error = -ENOMEM; -#ifdef CONFIG_PROC_FS struct proc_dir_entry *status = NULL, *reg; bm_dir = create_proc_entry("sys/fs/binfmt_misc", S_IFDIR, NULL); @@ -516,7 +507,6 @@ if (!reg) goto cleanup_status; reg->write_proc = proc_write_register; -#endif /* CONFIG_PROC_FS */ error = register_binfmt(&misc_format); out:--- linux-2.2.0-pre2/fs/Config.in.original Thu Dec 31 18:18:57 1998 +++ linux-2.2.0-pre2/fs/Config.in Thu Dec 31 18:22:38 1998 @@ -30,7 +30,11 @@ bool ' NTFS read-write support (experimental)' CONFIG_NTFS_RW fi tristate 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS -bool '/proc filesystem support' CONFIG_PROC_FS +if [ "$CONFIG_BINFMT_MISC" != "n" ]; then + define_bool CONFIG_PROC_FS y +else + bool '/proc filesystem support' CONFIG_PROC_FS +fi if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then tristate '/dev/pts filesystem for Unix98 PTYs' CONFIG_DEVPTS_FS fi--- linux-2.2.0-pre2/fs/Makefile.original Thu Dec 31 18:28:21 1998 +++ linux-2.2.0-pre2/fs/Makefile Thu Dec 31 18:28:23 1998 @@ -272,11 +272,13 @@ endif -ifeq ($(CONFIG_BINFMT_MISC),y) -BINFMTS += binfmt_misc.o -else - ifeq ($(CONFIG_BINFMT_MISC),m) - M_OBJS += binfmt_misc.o +ifeq ($(CONFIG_PROC_FS),y) + ifeq ($(CONFIG_BINFMT_MISC),y) + BINFMTS += binfmt_misc.o + else + ifeq ($(CONFIG_BINFMT_MISC),m) + M_OBJS += binfmt_misc.o + endif endif endif | |