2019-06-22 15:30:27

by Ajay Garg

[permalink] [raw]
Subject: Difference in values of addresses in System.map and /proc/kallsyms

Hi All.

My system is

ajay@latitude-3480:~$ uname -a
Linux latitude-3480 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar
14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


When I see the address for a symbol, say linux_banner, in
/boot/System.map-4.13.0-38-generic, it shows
ffffffff81e00120 R linux_banner

However, when I see it in /proc/kallsyms, it shows
ffffffffa7000120 R linux_banner


Also, I note that /proc/kallsyms addresses vary upon reboots, so I am
a little confused as to what the entries in /proc/kallsyms really
mean.
So, will be grateful for some pointers from the experts :)


Thanks and Regards,
Ajay


2020-05-19 16:01:32

by Randy Dunlap

[permalink] [raw]
Subject: Re: Difference in values of addresses in System.map and /proc/kallsyms

Hi--

On 6/22/19 8:28 AM, Ajay Garg wrote:
> Hi All.
>
> My system is
>
> ajay@latitude-3480:~$ uname -a
> Linux latitude-3480 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar
> 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
>
>
> When I see the address for a symbol, say linux_banner, in
> /boot/System.map-4.13.0-38-generic, it shows
> ffffffff81e00120 R linux_banner

That's a static (build-time) address.

>
> However, when I see it in /proc/kallsyms, it shows
> ffffffffa7000120 R linux_banner
>

That's where it actually was loaded to at boot time.

>
> Also, I note that /proc/kallsyms addresses vary upon reboots, so I am
> a little confused as to what the entries in /proc/kallsyms really
> mean.

You forgot to provide the kernel config file.

Possibly it has this config item:
CONFIG_RANDOMIZE_BASE=y

You can read the help text for that config option in
arch/x86/Kconfig.


> So, will be grateful for some pointers from the experts :)
>
>
> Thanks and Regards,
> Ajay

If this doesn't explain what you are seeing, then
I don't know. Maybe someone else can help.

--
~Randy