Skip to content

no modules installed, is there a bug? #205

@kinggate

Description

@kinggate

Hi ,

On my platform, armv7l + linux 32bit (android 11),
when I run crash>mod or crash>mod -s xxx ./xxx.ko ,it returns " no modules installed",
so I debug it,in kernel.c module_init() , add some debug info:

module_init(void)
{
	//......
	error(INFO, "module init 1 kt->flags=0x%x\n",kt->flags);
	if (kernel_symbol_exists("module_list")){
		error(INFO, "module init KMOD_V1\n");
		kt->flags |= KMOD_V1; //----(1)
	}
	else if (kernel_symbol_exists("modules")) {
		error(INFO, "module init KMOD_V2\n");
		kt->flags |= KMOD_V2;  //----(2)
	}
        //........
	error(INFO, "module init 2 kt->flags=0x%x\n",kt->flags);
	switch (kt->flags & (KMOD_V1|KMOD_V2))
	{
	case KMOD_V1:
		error(INFO, "use KMOD_V1\n");
		......
        case KMOD_V2:
		error(INFO, "use KMOD_V2\n");
                                .......
         }
        error(INFO, "111111\n");
         //......

}

$ ./crash vmlinux DDRCS0_0.BIN@0x0000000040000000
crash: module init 1 kt->flags=0x1782600
crash: module init KMOD_V1
crash: module init 2 kt->flags=0x1783600
crash: 111111

#define KMOD_V1 (0x1000)
#define KMOD_V2 (0x2000)
that is to say,when entering module_init(), kt->flags was set KMOD_V2, and also be set KMOD_V1 at (1) ,
so,in switch (kt->flags & (KMOD_V1|KMOD_V2)),it can't get into case KMOD_V1 , and also can't get into the case KMOD_V2,
Therefore, the module enumeration fails.

I do the following change, force using KMOD_V2:

	//fix
	kt->flags &= ~ (KMOD_V1|KMOD_V2);
	kt->flags |= KMOD_V2; //force KMOD_V2 mode
	switch (kt->flags & (KMOD_V1|KMOD_V2))

and run again, it work !
$ ./crash vmlinux DDRCS0_0.BIN@0x0000000040000000
crash: module init 1 kt->flags=0x1782600
crash: module init KMOD_V1
crash: module init 2 kt->flags=0x1783600
crash: use KMOD_V2
crash: 111111

crash> mod
MODULE NAME BASE SIZE OBJECT FILE
bf002200 q6_pdr_dlkm bf000000 16384 (not loaded) [CONFIG_KALLSYMS]
bf007880 q6_notifier_dlkm bf005000 16384 (not loaded) [CONFIG_KALLSYMS]
......
crash> mod -s my_test
MODULE NAME BASE SIZE OBJECT FILE
bf1ced40 my_test bf15c000 630784 ***** /elf_file/my_test.ko

Is this question unique to my platform, or do other platforms have the same error ?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions