Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel 5.4.3, arm: crash: system.map and dump do not match! (with fix) #64

Open
mthenault opened this issue Sep 10, 2020 · 3 comments
Open

Comments

@mthenault
Copy link

mthenault commented Sep 10, 2020

Hi, I have a problem with kernel 5.4 on arm.
crash is invoked like this:
./crash vmlinux system.map dump

I get the following result:

kernel 5.4: DBG: WARNING: invalid linux_banner pointer: 756e694c
DBG: crash: system.map and dump do not match!

Here are my observations:

cat system.map | grep linux_banner
c0c00084 D linux_banner
kernel.c:

	if (!(sp = symbol_search("linux_banner")))  // 1. struct syment sp gets filled here
		error(FATAL, "linux_banner symbol does not exist?\n");
	else if ((sp->type == 'R') || (sp->type == 'r') ||
		 (machine_type("ARM") && sp->type == 'T') ||
		 (machine_type("ARM64")))
		linux_banner = symbol_value("linux_banner");   // 2. we don't enter here because sp->type == 'D'
	else                         
		get_symbol_data("linux_banner", sizeof(ulong), &linux_banner); // 3. This doesn't work and gives a wrong address		

With gdb debugging I can see that the struct syment is fine address-wise:

(gdb) print sp->type
$2 = 68 'D'
(gdb) print sp->name
$3 = 0xf73de297 "linux_banner"
(gdb) print sp->value
$4 = 3233808516 (note: c0c00084 hex)

sp->type is equal to 'D' this prevents us to enter the else if even though calling symbol_value("linux_banner"); would be fine:

ulong
symbol_value(char *symbol)
{
        struct syment *sp;

        if (!(sp = symbol_search(symbol))) // calls symbol_search again
                error(FATAL, "cannot resolve \"%s\"\n", symbol);

        return(sp->value);  // correct value (see gdb output)
}

I fixed this locally by adding sp->type == 'D' in the else if condition.

What does 'D' mean in struct syment type ? Is this a bug ? If yes I can submit a patch.

mthenault added a commit to mthenault/crash that referenced this issue Sep 10, 2020
@bhupesh-sharma
Copy link

bhupesh-sharma commented Sep 10, 2020 via email

@mthenault
Copy link
Author

ok, here is the output
output.txt

@k-hagio
Copy link
Contributor

k-hagio commented Nov 24, 2020

Thanks for your report.

What does 'D' mean in struct syment type ?

I think this description in the man page of nm command is it:

           "D"
           "d" The symbol is in the initialized data section.

Is this a bug ?

It would be depending on why its type is 'D' on your arm32 machine.
If it is due to an upstream kernel patch or a configuration and it can happen commonly,
then crash should support it.

@bhupesh-sharma Does your arm32 system have the same type 'D'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants