[lkml]   [2020]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/2] x86/mm/pti: Check unaligned address for pmd clone in pti_clone_pagetable()
On 11/30/20 7:25 AM, Lai Jiangshan wrote:
> The commit 825d0b73cd752("x86/mm/pti: Handle unaligned address gracefully
> in pti_clone_pagetable()") handles unaligned address well for unmapped
> PUD/PMD etc. But unaligned address for pmd_large() or PTI_CLONE_PMD is also
> needed to be aware.

That 825d0b73cd752 changelog says:

> pti_clone_pmds() assumes that the supplied address is either:
> - properly PUD/PMD aligned
> or
> - the address is actually mapped which means that independently
> of the mapping level (PUD/PMD/PTE) the next higher mapping
> exists.

... and that was the root of the bug. If there was a large, unmapped
area, it would skip a PUD_SIZE or PMD_SIZE *area* instead of skipping to
the *next* pud/pmd.

The case being patched here is from a *present* PTE/PMD, so it's a
mapped area, not a hole.

That said, I think the previous changelog was wrong. An unaligned
address to a mapped, large (2M) region followed by a smaller (4k) region
would skip too far into the 4k region.

That said, I'm not sure I like this fix. If someone is explicitly
asking to clone a PMD (which pti_clone_pgtable() forces you to do), they
better align the address.

 \ /
  Last update: 2020-12-01 18:46    [W:0.200 / U:0.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site