Hi Rui,
Thanks for the fix, LGTM, so ack.
Thanks,
Tao Liu
On Wed, May 6, 2026 at 3:43 PM Rui Qi <qirui.001(a)bytedance.com> wrote:
>
> Fix a bug in the PMD address calculation where the operator was
> incorrectly using '+' instead of '*'. This caused the PMD index
> to be added as an offset rather than multiplied by the entry size,
> resulting in incorrect page table traversal for 4-level 4KB paging.
>
> Signed-off-by: Rui Qi <qirui.001(a)bytedance.com>
> ---
> riscv64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/riscv64.c b/riscv64.c
> index ee9d4e321f6b..d1c7d4a36109 100644
> --- a/riscv64.c
> +++ b/riscv64.c
> @@ -1241,7 +1241,7 @@ riscv64_vtop_4level_4k(ulong *pgd, ulong vaddr, physaddr_t
*paddr, int verbose)
>
> /* PMD */
> FILL_PMD(PAGEBASE(pmd_base), PHYSADDR, PAGESIZE());
> - pmd_addr = pmd_base + sizeof(pmd_t) + pmd_index_l4_4k(vaddr);
> + pmd_addr = pmd_base + sizeof(pmd_t) * pmd_index_l4_4k(vaddr);
> pmd_val = ULONG(machdep->pmd + PAGEOFFSET(pmd_addr));
> if (verbose)
> fprintf(fp, " PMD: %016lx => %016lx\n", pmd_addr,
pmd_val);
> --
> 2.20.1
> --
> Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
> To unsubscribe send an email to devel-leave(a)lists.crash-utility.osci.io
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines:
https://github.com/crash-utility/crash/wiki
>