Re: [PATCH v2] x86/mm/pti: in pti_clone_pgtable(), increase addr properly

From: Song Liu
Date: Fri Aug 23 2019 - 22:13:48 EST




> On Aug 21, 2019, at 3:30 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Wed, Aug 21, 2019 at 12:10:08PM +0200, Peter Zijlstra wrote:
>> On Tue, Aug 20, 2019 at 01:23:14PM -0700, Song Liu wrote:
>
>>> host-5.2-after # grep "x pmd" /sys/kernel/debug/page_tables/dump_pid
>>> 0x0000000000600000-0x0000000000e00000 8M USR ro PSE x pmd
>>> 0xffffffff81000000-0xffffffff81e00000 14M ro PSE GLB x pmd
>>>
>>> So after this patch, the 5.2 based kernel has 7 PMDs instead of 1 PMD
>>> in 4.16 kernel.
>>
>> This basically gives rise to more questions than it provides answers.
>> You seem to have 'forgotten' to provide the equivalent mappings on the
>> two older kernels. The fact that they're not PMD is evident, but it
>> would be very good to know what is mapped, and what -- if anything --
>> lives in the holes we've (accidentally) created.
>>
>> Can you please provide more complete mappings? Basically provide the
>> whole cpu_entry_area mapping.
>
> I tried on my local machine and:
>
> cat /debug/page_tables/kernel | awk '/^---/ { p=0 } /CPU entry/ { p=1 } { if (p) print $0 }' > ~/cea-{before,after}.txt
>
> resulted in _identical_ files ?!?!
>
> Can you share your before and after dumps?

I was really dumb on this. The actual issue this that kprobe on
CONFIG_KPROBES_ON_FTRACE splits kernel text PMDs (0xffffffff81000000-).

I will dig more into this.

Sorry for being silent, somehow I didn't see this email until just now.

Song