On Wed, Feb 13, 2019 at 05:40:45PM +0900, Naoki Fukaumi wrote:
> Hi Mike Larkin,
> 
> since pmap_kernel is randomized, savecore(libkvm) cannot save core
> dump from dump device. (savecore: magic number mismatch)
> 
> updating PTDpaddr fixes this issue.
> 
> by the way, is there any problem to use proc0.p_addr->u_pcb.pcb_cr3
> instead of PTDpaddr in cpu_dump()?
> 

Thanks for noticing this!

Does using the proc0.p_addr->u_pcb.pcb_cr3 expansion also work?
If so, we may be able to remove PTPpaddr entirely, if we remove the
other usage in cpu_dump also.

-ml

> --
> FUKAUMI Naoki
> 
> Index: sys/arch/amd64/amd64/pmap.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/pmap.c,v
> retrieving revision 1.128
> diff -u -p -u -p -r1.128 pmap.c
> --- sys/arch/amd64/amd64/pmap.c       1 Feb 2019 21:48:48 -0000       1.128
> +++ sys/arch/amd64/amd64/pmap.c       13 Feb 2019 07:43:27 -0000
> @@ -835,6 +835,9 @@ pmap_randomize(void)
>       pmap_kernel()->pm_pdir = pml4va;
>       proc0.p_addr->u_pcb.pcb_cr3 = pml4pa;
>  
> +     /* Fixup PTDpaddr for libkvm */
> +     PTDpaddr = pml4pa;
> +
>       /* Fixup recursive PTE PML4E slot. We are only changing the PA */       
>       pml4va[PDIR_SLOT_PTE] = pml4pa | (pml4va[PDIR_SLOT_PTE] & ~PG_FRAME);
>  
> 

Reply via email to