lkml.org 
[lkml]   [2013]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] module: don't modify argument of module_kallsyms_lookup_name()
Date
Mathias Krause <minipli@googlemail.com> writes:
> If we pass a pointer to a const string of the form "module:symbol"
> module_kallsyms_lookup_name() will try to split the string at the colon,
> i.e., will try to modify r/o data. That will, in fact, fail on a kernel
> with enabled CONFIG_DEBUG_RODATA.
>
> Avoid modifying the string passed as argument and operate on a copy
> instead in case we need to split the string.

Wow, this has been there forever.

If we've oopsed because we're OOM, this will fail, so I'd rather not do
that.

How about we add a len arg to find_module_all, like so:

/* Search for module by name: must hold module_mutex. */
static struct module *find_module_all(const char *name,
size_t len,
bool even_unformed)
{
struct module *mod;

list_for_each_entry(mod, &modules, list) {
if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
continue;
if (strlen(mod->name) == len && !memcmp(mod->name, name, len))
return mod;
}
return NULL;
}

Cheers,
Rusty.


\
 
 \ /
  Last update: 2013-06-14 04:21    [W:0.037 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site