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-- 8.3 KB
Makefile -rw-r--r-- 785 bytes
asn1.c -rw-r--r-- 13.6 KB
cache.c -rw-r--r-- 3.7 KB
cifs_debug.c -rw-r--r-- 24.3 KB
cifs_debug.h -rw-r--r-- 2.3 KB
cifs_dfs_ref.c -rw-r--r-- 10.0 KB
cifs_fs_sb.h -rw-r--r-- 3.4 KB
cifs_ioctl.h -rw-r--r-- 1.6 KB
cifs_spnego.c -rw-r--r-- 6.3 KB
cifs_spnego.h -rw-r--r-- 1.6 KB
cifs_unicode.c -rw-r--r-- 16.2 KB
cifs_unicode.h -rw-r--r-- 10.2 KB
cifs_uniupr.h -rw-r--r-- 12.6 KB
cifsacl.c -rw-r--r-- 33.4 KB
cifsacl.h -rw-r--r-- 3.4 KB
cifsencrypt.c -rw-r--r-- 23.4 KB
cifsfs.c -rw-r--r-- 40.9 KB
cifsfs.h -rw-r--r-- 6.1 KB
cifsglob.h -rw-r--r-- 59.8 KB
cifspdu.h -rw-r--r-- 83.8 KB
cifsproto.h -rw-r--r-- 25.3 KB
cifssmb.c -rw-r--r-- 191.0 KB
connect.c -rw-r--r-- 120.4 KB
dir.c -rw-r--r-- 25.0 KB
dns_resolve.c -rw-r--r-- 2.8 KB
dns_resolve.h -rw-r--r-- 1.2 KB
export.c -rw-r--r-- 2.4 KB
file.c -rw-r--r-- 106.6 KB
fscache.c -rw-r--r-- 9.2 KB
fscache.h -rw-r--r-- 5.1 KB
inode.c -rw-r--r-- 65.3 KB
ioctl.c -rw-r--r-- 6.4 KB
link.c -rw-r--r-- 17.3 KB
misc.c -rw-r--r-- 24.8 KB
netmisc.c -rw-r--r-- 39.6 KB
nterr.c -rw-r--r-- 33.5 KB
nterr.h -rw-r--r-- 30.0 KB
ntlmssp.h -rw-r--r-- 5.7 KB
readdir.c -rw-r--r-- 24.7 KB
rfc1002pdu.h -rw-r--r-- 2.8 KB
sess.c -rw-r--r-- 39.6 KB
smb1ops.c -rw-r--r-- 32.4 KB
smb2file.c -rw-r--r-- 7.5 KB
smb2glob.h -rw-r--r-- 1.9 KB
smb2inode.c -rw-r--r-- 8.3 KB
smb2maperror.c -rw-r--r-- 127.2 KB
smb2misc.c -rw-r--r-- 23.3 KB
smb2ops.c -rw-r--r-- 97.5 KB
smb2pdu.c -rw-r--r-- 114.8 KB
smb2pdu.h -rw-r--r-- 41.3 KB
smb2proto.h -rw-r--r-- 10.9 KB
smb2status.h -rw-r--r-- 125.2 KB
smb2transport.c -rw-r--r-- 18.1 KB
smbdirect.c -rw-r--r-- 74.3 KB
smbdirect.h -rw-r--r-- 9.1 KB
smbencrypt.c -rw-r--r-- 5.4 KB
smberr.h -rw-r--r-- 7.5 KB
smbfsctl.h -rw-r--r-- 6.5 KB
trace.c -rw-r--r-- 717 bytes
trace.h -rw-r--r-- 10.6 KB
transport.c -rw-r--r-- 30.0 KB
winucase.c -rw-r--r-- 36.9 KB
xattr.c -rw-r--r-- 9.5 KB

back to top