Skip to content

Commit

Permalink
mod: fix module object file lookup
Browse files Browse the repository at this point in the history
On systems where vmlinux file is not under /usr/lib/debug/lib/modules
directory, 'mod -s|-S' command may fail to find the module's object
file with the below error:

    mod: cannot find or load object file for sd_mod module

Fix it by trying all possible module object file extentions while
searching for the object file under /usr/lib/debug/lib/modules
directory.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
  • Loading branch information
hbathini authored and k-hagio committed Sep 9, 2021
1 parent 1576586 commit cf0c8d1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion kernel.c
Expand Up @@ -4796,7 +4796,18 @@ module_objfile_search(char *modref, char *filename, char *tree)

sprintf(dir, "%s/%s", DEFAULT_REDHAT_DEBUG_LOCATION,
kt->utsname.release);
retbuf = search_directory_tree(dir, file, 0);
if (!(retbuf = search_directory_tree(dir, file, 0))) {
switch (kt->flags & (KMOD_V1|KMOD_V2))
{
case KMOD_V2:
sprintf(file, "%s.ko", modref);
retbuf = search_directory_tree(dir, file, 0);
if (!retbuf) {
sprintf(file, "%s.ko.debug", modref);
retbuf = search_directory_tree(dir, file, 0);
}
}
}

if (!retbuf && (env = getenv("CRASH_MODULE_PATH"))) {
sprintf(dir, "%s", env);
Expand Down

0 comments on commit cf0c8d1

Please sign in to comment.