lkml.org 
[lkml]   [1997]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectUpdate to binfmt_misc to use new dcache pre-[PATCH]
    Hi!

    I updated binfmt_misc to use the new dcache code to figure out the
    full filename of the executable. So no wrapper-script for determining
    the path/filename is necessary anymore.

    Its a 'hack' for now, but it works for me.

    Can people who use binfmt_misc actually send me their config-lines
    (the echo blabla > /proc/sys/fs/binfmt_misc/register ones) that are
    _not_ in the documentation (so I can include more (tested) ones).

    Patch follows. (its against 2.1.43)

    Richard.


    diff -u --recursive --new-file linux-2.1.43/fs/binfmt_misc.c linux-2.1.43x/fs/binfmt_misc.c
    --- linux-2.1.43/fs/binfmt_misc.c Sun Jun 22 12:55:07 1997
    +++ linux-2.1.43x/fs/binfmt_misc.c Sun Jun 22 19:37:59 1997
    @@ -10,6 +10,7 @@
    * 25.4.97 first version
    * [...]
    * 19.5.97 cleanup
    + * 22.6.97 use new dcache
    */

    #include <linux/module.h>
    @@ -23,6 +24,7 @@
    #include <linux/proc_fs.h>
    #include <linux/string.h>
    #include <linux/ctype.h>
    +#include <linux/dalloc.h>
    #include <asm/uaccess.h>
    #include <asm/spinlock.h>

    @@ -157,8 +159,8 @@
    static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
    {
    struct binfmt_entry *fmt;
    - char iname[128];
    - char *iname_addr = iname, *p;
    + char iname[128], fname[256];
    + char *argv[2] = {iname, fname}, *p;
    int retval, fmt_flags = 0;

    MOD_INC_USE_COUNT;
    @@ -180,19 +182,22 @@
    goto _ret;
    }

    + /* get full filename of executable via dcache */
    + /* there is no way to limit the filename size - BAD! */
    + if ((retval = d_path(bprm->inode->i_dentry, NULL, fname)) > 255)
    + /* what should we do here?? */;
    + fname[retval] = '\0';
    +
    iput(bprm->inode);
    bprm->dont_iput = 1;

    /* Build args for interpreter */
    if ((fmt_flags & ENTRY_STRIP_EXT) &&
    - (p = strrchr(bprm->filename, '.'))) {
    + (p = strrchr(fname, '.')))
    *p = '\0';
    - remove_arg_zero(bprm);
    - bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2);
    - bprm->argc++;
    - }
    - bprm->p = copy_strings(1, &iname_addr, bprm->page, bprm->p, 2);
    - bprm->argc++;
    + remove_arg_zero(bprm);
    + bprm->p = copy_strings(2, argv, bprm->page, bprm->p, 2);
    + bprm->argc += 2;
    if (!bprm->p) {
    retval = -E2BIG;
    goto _ret;
    diff -u --recursive --new-file linux-2.1.43/kernel/ksyms.c linux-2.1.43x/kernel/ksyms.c
    --- linux-2.1.43/kernel/ksyms.c Sun Jun 22 12:55:17 1997
    +++ linux-2.1.43x/kernel/ksyms.c Mon Jun 23 10:44:02 1997
    @@ -51,6 +51,7 @@
    #include <linux/swap.h>
    #include <linux/ctype.h>
    #include <linux/file.h>
    +#include <linux/dalloc.h>

    extern unsigned char aux_device_present, kbd_read_mask;

    @@ -177,6 +178,7 @@
    EXPORT_SYMBOL(posix_test_lock);
    EXPORT_SYMBOL(posix_block_lock);
    EXPORT_SYMBOL(posix_unblock_lock);
    +EXPORT_SYMBOL(d_path);

    #if !defined(CONFIG_NFSD) && defined(CONFIG_NFSD_MODULE)
    EXPORT_SYMBOL(do_nfsservctl);
    \
     
     \ /
      Last update: 2005-03-22 13:39    [W:0.028 / U:30.424 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site