Skip to content

Memory corruption may occur due to incorrent tlb flush

Santosh Sivaraj linuxppc-dev stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6asm-generic/tlb: Track freeing of page-table directories in struct mmu_gatherinclude/asm-generic/tlb.h+23 -80 replies
2/6asm-generic/tlb: Track which levels of the page tables have been clearedinclude/asm-generic/tlb.h mm/memory.c+53 -90 replies
3/6asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATEarch/Kconfig arch/powerpc/Kconfig arch/sparc/Kconfig +2 more+4 -30 replies
4/6powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP casearch/powerpc/Kconfig arch/powerpc/include/asm/book3s/32/pgalloc.h arch/powerpc/include/asm/book3s/64/pgalloc.h +1 more+1 -180 replies
5/6mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flusharch/Kconfig arch/powerpc/Kconfig arch/powerpc/include/asm/tlb.h +4 more+43 -130 replies
6/6asm-generic/tlb: avoid potential double flushinclude/asm-generic/tlb.h+6 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] Memory corruption may occur due to incorrent tlb flush

The TLB flush optimisation (a46cc7a90f: powerpc/mm/radix: Improve TLB/PWC flushes) may result in random memory corruption. Any concurrent page-table walk could end up with a Use-after-Free. Even on UP this might give issues, since mmu_gather is preemptible these days. An interrupt or preempted task accessing user pages might stumble into the free page if the hardware caches page directories.

The series is a backport of the fix sent by Peter [1].

The first three patches are dependencies for the last patch (avoid potential double flush). If the performance impact due to double flush is considered trivial then the first three patches and last patch may be dropped.

[1] https://patchwork.kernel.org/cover/11284843/
--
Aneesh Kumar K.V (1):
powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case

Peter Zijlstra (4):
asm-generic/tlb: Track freeing of page-table directories in struct
mmu_gather
asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE mm/mmu_gather: invalidate TLB correctly on batch allocation failure
and flush
asm-generic/tlb: avoid potential double flush

Will Deacon (1):
asm-generic/tlb: Track which levels of the page tables have been
cleared

 arch/Kconfig                                 |   3 -
 arch/powerpc/Kconfig                         |   2 +-
 arch/powerpc/include/asm/book3s/32/pgalloc.h |   8 --
 arch/powerpc/include/asm/book3s/64/pgalloc.h |   2 -
 arch/powerpc/include/asm/tlb.h               |  11 ++
 arch/powerpc/mm/pgtable-book3s64.c           |   7 --
 arch/sparc/include/asm/tlb_64.h              |   9 ++
 arch/x86/Kconfig                             |   1 -
 include/asm-generic/tlb.h                    | 103 ++++++++++++++++---
 mm/memory.c                                  |  20 ++--
 10 files changed, 122 insertions(+), 44 deletions(-)
Signature · 1 line
2.24.1