Re: [PATCH] Fix get_linux_banner_from_vmlinux() for vmlinux without ".rodata" symbol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023/07/24 18:05, lijiang wrote:
> On Mon, Jul 24, 2023 at 4:48 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx>
> wrote:
> 
>> From: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
>>
>> As written in the previous patch, some recent kernels do not have the
>> ".rodata" symbol.  As a result, the get_linux_banner_from_vmlinux()
>> returns FALSE and the slower fallback routine is used.
>>
>> Use "__start_rodata" symbol if the ".rodata" symbol is not available.
>>
>> Reported-by: Lianbo Jiang <lijiang@xxxxxxxxxx>
>> Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
>> ---
>> Note that I chose to use ".rodata" first to not change the current
>> stable behavior for old vmcores, in this case.
>>
>>   kernel.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel.c b/kernel.c
>> index 9801812387bd..2114700eecc8 100644
>> --- a/kernel.c
>> +++ b/kernel.c
>> @@ -11891,8 +11891,13 @@ int get_linux_banner_from_vmlinux(char *buf,
>> size_t size)
>>   {
>>          struct bfd_section *sect;
>>          long offset;
>> +       ulong start_rodata;
>>
>> -       if (!kernel_symbol_exists(".rodata"))
>> +       if (kernel_symbol_exists(".rodata"))
>> +               start_rodata = symbol_value(".rodata");
>> +       else if (kernel_symbol_exists("__start_rodata"))
>> +               start_rodata = symbol_value("__start_rodata");
>> +       else
>>                  return FALSE;
>>
>>          sect = bfd_get_section_by_name(st->bfd, ".rodata");
>> @@ -11905,7 +11910,7 @@ int get_linux_banner_from_vmlinux(char *buf,
>> size_t size)
>>           * value in vmlinux file, but relative offset to linux_banner
>>           * object in .rodata section is idential.
>>           */
>> -       offset = symbol_value("linux_banner") - symbol_value(".rodata");
>> +       offset = symbol_value("linux_banner") - start_rodata;
>>
>>          if (!bfd_get_section_contents(st->bfd,
>>                                        sect,
>>
> 
> Looks good to me. So: Ack.

Thanks, applied.
Kazu
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux