[Crash-utility] [PATCH] mod: fix module object file lookup

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Sep 9 02:31:39 UTC 2021


-----Original Message-----
> On Fri, Sep 3, 2021 at 8:03 PM Hari Bathini <hbathini at linux.ibm.com <mailto:hbathini at linux.ibm.com> > wrote:
> 
> 
> 	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 at linux.ibm.com <mailto:naveen.n.rao at linux.ibm.com> >
> 	Signed-off-by: Hari Bathini <hbathini at linux.ibm.com <mailto:hbathini at linux.ibm.com> >
> 	---
> 	 kernel.c |   13 ++++++++++++-
> 	 1 file changed, 12 insertions(+), 1 deletion(-)
> 
> 	diff --git a/kernel.c b/kernel.c
> 	index 36fdea2..b2c8a0c 100644
> 	--- a/kernel.c
> 	+++ b/kernel.c
> 	@@ -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);
> 
> 
> 
> 
> 
> Acked-by: Lianbo Jiang <lijiang at redhat.com <mailto:lijiang at redhat.com> >

Looks good, applied.
https://github.com/crash-utility/crash/commit/cf0c8d10e1870d89b39f40382634db51aa8fcf2c

Thanks,
Kazu






More information about the Crash-utility mailing list