> On Feb 2, 2021, at 3:00 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > On Tue, Feb 02, 2021 at 01:32:36AM -0800, Nadav Amit wrote: >>> On Feb 1, 2021, at 3:36 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: >>> >>> >>> https://lkml.kernel.org/r/20210127235347.1402-1-will@xxxxxxxxxx >> >> I have seen this series, and applied my patches on it. >> >> Despite Will’s patches, there were still inconsistencies between fullmm >> and need_flush_all. >> >> Am I missing something? > > I wasn't aware you were on top. I'll look again. Looking on arm64’s tlb_flush() makes me think that there is currently a bug that this patch fixes. Arm64’s tlb_flush() does: /* * If we're tearing down the address space then we only care about * invalidating the walk-cache, since the ASID allocator won't * reallocate our ASID without invalidating the entire TLB. */ if (tlb->fullmm) { if (!last_level) flush_tlb_mm(tlb->mm); return; } But currently tlb_mmu_finish() can mistakenly set fullmm incorrectly (if mm_tlb_flush_nested() is true), which might skip the TLB flush. Lucky for us, arm64 flushes each VMA separately (which as we discussed separately may not be necessary), so the only PTEs that might not be flushed are PTEs that are updated concurrently by another thread that also defer their flushes. It therefore seems that the implications are more on the correctness of certain syscalls (e.g., madvise(DONT_NEED)) without implications on security or memory corruptions. Let me know if you want me to send this patch separately with an updated commit log for faster inclusion.