Revision 8b11ec1b5ffb54f71cb5a5e5c8c4d36e5d113085 authored by Linus Torvalds on 01 August 2018, 20:43:38 UTC, committed by Linus Torvalds on 01 August 2018, 20:43:38 UTC
Commit 2c4541e24c55 ("mm: use vma_init() to initialize VMAs on stack and
data segments") tried to initialize various left-over ad-hoc vma's
"properly", but actually made things worse for the temporary vma's used
for TLB flushing.

vma_init() doesn't actually initialize all of the vma, just a few
fields, so doing something like

   -       struct vm_area_struct vma = { .vm_mm = tlb->mm, };
   +       struct vm_area_struct vma;
   +
   +       vma_init(&vma, tlb->mm);

was actually very bad: instead of having a nicely initialized vma with
every field but "vm_mm" zeroed, you'd have an entirely uninitialized vma
with only a couple of fields initialized.  And they weren't even fields
that the code in question mostly cared about.

The flush_tlb_range() function takes a "struct vma" rather than a
"struct mm_struct", because a few architectures actually care about what
kind of range it is - being able to only do an ITLB flush if it's a
range that doesn't have data accesses enabled, for example.  And all the
normal users already have the vma for doing the range invalidation.

But a few people want to call flush_tlb_range() with a range they just
made up, so they also end up using a made-up vma.  x86 just has a
special "flush_tlb_mm_range()" function for this, but other
architectures (arm and ia64) do the "use fake vma" thing instead, and
thus got caught up in the vma_init() changes.

At the same time, the TLB flushing code really doesn't care about most
other fields in the vma, so vma_init() is just unnecessary and
pointless.

This fixes things by having an explicit "this is just an initializer for
the TLB flush" initializer macro, which is used by the arm/arm64/ia64
people who mis-use this interface with just a dummy vma.

Fixes: 2c4541e24c55 ("mm: use vma_init() to initialize VMAs on stack and data segments")
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 53406ed
History
File Mode Size
Kconfig -rw-r--r-- 5.1 KB
Makefile -rw-r--r-- 918 bytes
acl.h -rw-r--r-- 2.4 KB
auth.c -rw-r--r-- 2.1 KB
auth.h -rw-r--r-- 378 bytes
blocklayout.c -rw-r--r-- 11.2 KB
blocklayoutxdr.c -rw-r--r-- 5.2 KB
blocklayoutxdr.h -rw-r--r-- 1.4 KB
cache.h -rw-r--r-- 1.7 KB
current_stateid.h -rw-r--r-- 1.4 KB
export.c -rw-r--r-- 31.8 KB
export.h -rw-r--r-- 3.0 KB
fault_inject.c -rw-r--r-- 3.7 KB
flexfilelayout.c -rw-r--r-- 3.4 KB
flexfilelayoutxdr.c -rw-r--r-- 2.7 KB
flexfilelayoutxdr.h -rw-r--r-- 1.1 KB
idmap.h -rw-r--r-- 2.3 KB
lockd.c -rw-r--r-- 1.7 KB
netns.h -rw-r--r-- 3.8 KB
nfs2acl.c -rw-r--r-- 9.3 KB
nfs3acl.c -rw-r--r-- 6.6 KB
nfs3proc.c -rw-r--r-- 24.0 KB
nfs3xdr.c -rw-r--r-- 27.3 KB
nfs4acl.c -rw-r--r-- 21.8 KB
nfs4callback.c -rw-r--r-- 30.0 KB
nfs4idmap.c -rw-r--r-- 16.1 KB
nfs4layouts.c -rw-r--r-- 18.9 KB
nfs4proc.c -rw-r--r-- 70.2 KB
nfs4recover.c -rw-r--r-- 35.6 KB
nfs4state.c -rw-r--r-- 186.8 KB
nfs4xdr.c -rw-r--r-- 114.7 KB
nfscache.c -rw-r--r-- 15.4 KB
nfsctl.c -rw-r--r-- 33.6 KB
nfsd.h -rw-r--r-- 16.8 KB
nfsfh.c -rw-r--r-- 18.5 KB
nfsfh.h -rw-r--r-- 7.5 KB
nfsproc.c -rw-r--r-- 21.2 KB
nfssvc.c -rw-r--r-- 21.6 KB
nfsxdr.c -rw-r--r-- 13.3 KB
pnfs.h -rw-r--r-- 2.7 KB
state.h -rw-r--r-- 22.7 KB
stats.c -rw-r--r-- 2.7 KB
stats.h -rw-r--r-- 1.5 KB
trace.c -rw-r--r-- 48 bytes
trace.h -rw-r--r-- 4.4 KB
vfs.c -rw-r--r-- 50.8 KB
vfs.h -rw-r--r-- 5.8 KB
xdr.h -rw-r--r-- 3.6 KB
xdr3.h -rw-r--r-- 7.2 KB
xdr4.h -rw-r--r-- 23.9 KB
xdr4cb.h -rw-r--r-- 1.4 KB

back to top