Re: Prevent overriding of Symbols in the Kernel, avoiding Undefined behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/13/05, Ashutosh Naik <[email protected]> wrote:
> On 12/13/05, Rusty Russell <[email protected]> wrote:
> >
> > How about something like:
> >
> >         const struct kernel_symbol *sym;
> >         unsigned int i;
> >         const unsigned long *crc;
> >         struct module *owner;
> >
> >         spin_lock_irq(&modlist_lock);
> >         for (i = 0; i < mod->num_syms; i++)
> >                 if (__find_symbol(mod->syms[i].name, &owner, &crc, 1))
> >                         goto dup;
> >         for (i = 0; i < num->num_gpl_syms; i++)
> >                 if (__find_symbol(mod->gpl_syms[i].name,&owner,&crc,1))
> >                         goto dup;
> >         spin_unlock_irq(&modlist_lock);
> >         return 0;
> > dup:
> >         printk("%s: exports duplicate symbol (owned by %s)\n",
> >                 mod->name, module_name(owner));
> >         return -ENOEXEC;
> > }
>
> Have tried that in the attached patch. However,  mod->syms[i].name
> would be valid only after a long relocation for loop has run through.
> While this adds a wee bit extra overhead, that overhead is only in the
> case where the module does actually export a Duplicate Symbol.

Forgot to add
Signed-off-by: Ashutosh Naik <[email protected]>
Signed-off-by: Anand Krishnan <[email protected]>

Cheers
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux