Facing issue with va to pa conversion in arm64/makedumpfile

aadiga at qti.qualcomm.com aadiga at qti.qualcomm.com
Wed Nov 18 04:08:39 EST 2020


Hi Pratyush/ Kazuhito ,

While attempting to create dumpfile on arm64, I was face issues with 
virtual address to physical address conversion when kalsr is enable. 
Linux kernel version is 5.4.42 stable kernel.

The following patch seems to add patch to enable kalsr support :

[PATCH 10/10] arm64: fix memory layout as per changes in v4.6 kernel

https://sourceforge.net/p/makedumpfile/code/ci/b6fe70c7ffef9affb540412407702b15d4a196e9


static unsigned long long
+__pa(unsigned long vaddr)
+{
+       if (kimage_voffset == NOT_FOUND_NUMBER ||
+                       (vaddr >= PAGE_OFFSET))
+               return (vaddr - PAGE_OFFSET + info->phys_base);
+       else
+               return (vaddr - kimage_voffset);
+}


I see that even when kimage_voffset is available , it calculates pa 
using PAGE_OFFSET.
But as KALSR is enabled it should ideally use kimage_voffset.

Not sure what is the significance of the check (vaddr >= PAGE_OFFSET) if 
kimage_voffset is available.

i think this should be something like

+       if (kimage_voffset == NOT_FOUND_NUMBER) && (vaddr >= 
PAGE_OFFSET))
+               return (vaddr - PAGE_OFFSET + info->phys_base);
+       else
+               return (vaddr - kimage_voffset);



Because we want to check vaddr is greater than PAGE_OFFSET when we are 
considering linear mapping without kaslr seed.

Or may be we should have a separate check which will error out all vaddr 
less than PAGE_OFFSET and kimage_voffset.

+       if  (vaddr < PAGE_OFFSET)
+              return -EINVAL;
+       if (kimage_voffset == NOT_FOUND_NUMBER)
+               return (vaddr - PAGE_OFFSET + info->phys_base);
+       else
+               return (vaddr - kimage_voffset);

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project



More information about the kexec mailing list