<div dir="ltr"><div>Hi, Kazu and Qianli</div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 28, 2022 at 9:17 AM HAGIO KAZUHITO(萩尾 一仁) <<a href="mailto:k-hagio-ab@nec.com">k-hagio-ab@nec.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Qianli,<br>
<br>
thanks for the patch and explanation.  I was off.<br>
<br>
On 2022/06/27 11:24, qianli zhao wrote:<br>
> Hi,Kazu<br>
> <br>
> Would you like to help review this patch?<br>
<br>
Sure, I think I can review it this week.<br>
<br>
Lianbo, can you possibly reproduce and test this?</blockquote><div> </div><div>OK, I will have a look and give feedback later. </div><div><br></div><div>Thanks.</div><div>Lianbo</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Kazu<br>
<br>
> <br>
> qianli zhao <<a href="mailto:zhaoqianligood@gmail.com" target="_blank">zhaoqianligood@gmail.com</a>> 于2022年6月24日周五 10:56写道:<br>
> <br>
>><br>
>> Hi,all<br>
>><br>
>> Here's some explanation for this patch<br>
>><br>
>> Without patch:<br>
>> Consider the following scenario<br>
>> ->arm64_init(PRE_GDB)<br>
>> case PRE_GDB:<br>
>> ...<br>
>>   292                         } else if (ms->VA_BITS_ACTUAL) {<br>
>>   293                                 ms->modules_vaddr =<br>
>> (st->_stext_vmlinux & TEXT_OFFSET_MASK) -<br>
>> ARM64_MODULES_VSIZE;-->//ms->modules_vaddr=0xfffffffff8000000<br>
>>   294                                 ms->modules_end =<br>
>> ms->modules_vaddr + ARM64_MODULES_VSIZE<br>
>> -1;--->//ms->modules_end=0xffffffffffffffff<br>
>>   295                                 ms->vmalloc_start_addr =<br>
>> ms->modules_end + 1;--->//ms->vmalloc_start_addr=0<br>
>> 296                         } else {<br>
>>                                 ....<br>
>>                                 }<br>
>>                                 arm64_calc_kimage_voffset();<br>
>> .....<br>
>><br>
>> Since arm64_calc_kimage_voffset() depends on vmalloc_start_addr,<br>
>> kimage_voffset cannot be calculated correctly.<br>
>><br>
>> st->_stext_vmlinux can be initialized in numeric_forward(),just set<br>
>> st->_stext_vmlinux to UNINITIALIZED.<br>
>><br>
>> ============<br>
>> log as below:<br>
>><br>
>> $ ~/crash/crash/crash vmlinux DDRCS0.bin@0x80000000 --machdep vabits_actual=48<br>
>><br>
>> crash 8.0.1++<br>
>> Copyright (C) 2002-2022  Red Hat, Inc.<br>
>> Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation<br>
>> Copyright (C) 1999-2006  Hewlett-Packard Co<br>
>> Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited<br>
>> Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.<br>
>> Copyright (C) 2005, 2011, 2020-2022  NEC Corporation<br>
>> Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.<br>
>> Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.<br>
>> Copyright (C) 2015, 2021  VMware, Inc.<br>
>> This program is free software, covered by the GNU General Public License,<br>
>> and you are welcome to change it and/or distribute copies of it under<br>
>> certain conditions.  Enter "help copying" to see the conditions.<br>
>> This program has absolutely no warranty.  Enter "help warranty" for details.<br>
>><br>
>> NOTE: setting vabits_actual to: 48<br>
>><br>
>> WARNING: kimage_voffset cannot be determined from the dumpfile.<br>
>>         Try using the command line option: --machdep kimage_voffset=<addr><br>
>> GNU gdb (GDB) 10.2<br>
>> Copyright (C) 2021 Free Software Foundation, Inc.<br>
>> License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html" rel="noreferrer" target="_blank">http://gnu.org/licenses/gpl.html</a>><br>
>> This is free software: you are free to change and redistribute it.<br>
>> There is NO WARRANTY, to the extent permitted by law.<br>
>> Type "show copying" and "show warranty" for details.<br>
>> This GDB was configured as "--host=x86_64-pc-linux-gnu<br>
>> --target=aarch64-elf-linux".<br>
>> Type "show configuration" for configuration details.<br>
>> Find the GDB manual and other documentation resources online at:<br>
>>      <<a href="http://www.gnu.org/software/gdb/documentation/" rel="noreferrer" target="_blank">http://www.gnu.org/software/gdb/documentation/</a>>.<br>
>><br>
>> For help, type "help".<br>
>> Type "apropos word" to search for commands related to "word"...<br>
>><br>
>> crash: read error: kernel virtual address: ffff80001083d4a0  type:<br>
>> "kernel_config_data"<br>
>> WARNING: cannot read kernel_config_data<br>
>> crash: read error: kernel virtual address: ffff80001170e798  type: "possible"<br>
>> WARNING: cannot read cpu_possible_map<br>
>> crash: read error: kernel virtual address: ffff80001170e7a8  type: "present"<br>
>> WARNING: cannot read cpu_present_map<br>
>> crash: read error: kernel virtual address: ffff80001170e788  type: "online"<br>
>> WARNING: cannot read cpu_online_map<br>
>> crash: read error: kernel virtual address: ffff80001170e7c0  type: "active"<br>
>> WARNING: cannot read cpu_active_map<br>
>> crash: read error: kernel virtual address: ffff8000122e00f0  type:<br>
>> "shadow_timekeeper xtime_sec"<br>
>> crash: read error: kernel virtual address: ffff80001171dc04  type: "init_uts_ns"<br>
>> crash: vmlinux and /var/tmp/ramdump_elf_m2ivkg do not match!<br>
>><br>
>> Usage:<br>
>><br>
>>    crash [OPTION]... NAMELIST MEMORY-IMAGE[@ADDRESS]     (dumpfile form)<br>
>>    crash [OPTION]... [NAMELIST]                          (live system form)<br>
>><br>
>> Enter "crash -h" for details.<br>
>><br>
>> Qianli Zhao <<a href="mailto:zhaoqianligood@gmail.com" target="_blank">zhaoqianligood@gmail.com</a>> 于2022年6月24日周五 00:14写道:<br>
>>><br>
>>> From: Qianli Zhao <<a href="mailto:qianli.zhao@horizon.ai" target="_blank">qianli.zhao@horizon.ai</a>><br>
>>><br>
>>> Setting st->_stext_vmlinux to UNINITIALIZED to search for "_stext" from the vmlinux<br>
>>> Without the patch, if we do not enable kaslr, will get the wrong<br>
>>> MODULES/VMALLOC ranges, cause parsing dump failure<br>
>>><br>
>>> Signed-off-by: Qianli Zhao <<a href="mailto:qianli.zhao@horizon.ai" target="_blank">qianli.zhao@horizon.ai</a>><br>
>>> ---<br>
>>>   arm64.c | 3 +++<br>
>>>   1 file changed, 3 insertions(+)<br>
>>><br>
>>> diff --git a/arm64.c b/arm64.c<br>
>>> index 0f615cf..4458a66 100644<br>
>>> --- a/arm64.c<br>
>>> +++ b/arm64.c<br>
>>> @@ -149,6 +149,9 @@ arm64_init(int when)<br>
>>><br>
>>>                  ms = machdep->machspec;<br>
>>><br>
>>> +               if (ms->VA_BITS_ACTUAL)<br>
>>> +                       st->_stext_vmlinux = UNINITIALIZED;<br>
>>> +<br>
>>>                  if (!ms->kimage_voffset && STREQ(pc->live_memsrc, "/dev/crash"))<br>
>>>                          ioctl(pc->mfd, DEV_CRASH_ARCH_DATA, &ms->kimage_voffset);<br>
>>><br>
>>> --<br>
>>> 2.17.1<br>
>>></blockquote></div></div>