https://github.com/torvalds/linux
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
Tip revision: 8b11ec1b5ffb54f71cb5a5e5c8c4d36e5d113085 authored by Linus Torvalds on 01 August 2018, 20:43:38 UTC
mm: do not initialize TLB stack vma's with vma_init()
mm: do not initialize TLB stack vma's with vma_init()
Tip revision: 8b11ec1
File | Mode | Size |
---|---|---|
partitions | ||
Kconfig | -rw-r--r-- | 6.2 KB |
Kconfig.iosched | -rw-r--r-- | 2.7 KB |
Makefile | -rw-r--r-- | 1.5 KB |
badblocks.c | -rw-r--r-- | 14.5 KB |
bfq-cgroup.c | -rw-r--r-- | 33.5 KB |
bfq-iosched.c | -rw-r--r-- | 184.2 KB |
bfq-iosched.h | -rw-r--r-- | 31.6 KB |
bfq-wf2q.c | -rw-r--r-- | 52.2 KB |
bio-integrity.c | -rw-r--r-- | 13.8 KB |
bio.c | -rw-r--r-- | 52.3 KB |
blk-cgroup.c | -rw-r--r-- | 38.7 KB |
blk-core.c | -rw-r--r-- | 104.6 KB |
blk-exec.c | -rw-r--r-- | 2.9 KB |
blk-flush.c | -rw-r--r-- | 17.3 KB |
blk-integrity.c | -rw-r--r-- | 12.1 KB |
blk-ioc.c | -rw-r--r-- | 11.0 KB |
blk-lib.c | -rw-r--r-- | 10.9 KB |
blk-map.c | -rw-r--r-- | 5.9 KB |
blk-merge.c | -rw-r--r-- | 20.7 KB |
blk-mq-cpumap.c | -rw-r--r-- | 1.6 KB |
blk-mq-debugfs.c | -rw-r--r-- | 24.2 KB |
blk-mq-debugfs.h | -rw-r--r-- | 2.1 KB |
blk-mq-pci.c | -rw-r--r-- | 1.7 KB |
blk-mq-rdma.c | -rw-r--r-- | 1.7 KB |
blk-mq-sched.c | -rw-r--r-- | 16.1 KB |
blk-mq-sched.h | -rw-r--r-- | 2.8 KB |
blk-mq-sysfs.c | -rw-r--r-- | 8.1 KB |
blk-mq-tag.c | -rw-r--r-- | 11.2 KB |
blk-mq-tag.h | -rw-r--r-- | 2.3 KB |
blk-mq-virtio.c | -rw-r--r-- | 1.7 KB |
blk-mq.c | -rw-r--r-- | 74.2 KB |
blk-mq.h | -rw-r--r-- | 5.6 KB |
blk-settings.c | -rw-r--r-- | 28.6 KB |
blk-softirq.c | -rw-r--r-- | 4.4 KB |
blk-stat.c | -rw-r--r-- | 4.7 KB |
blk-stat.h | -rw-r--r-- | 4.4 KB |
blk-sysfs.c | -rw-r--r-- | 24.1 KB |
blk-tag.c | -rw-r--r-- | 9.3 KB |
blk-throttle.c | -rw-r--r-- | 68.7 KB |
blk-timeout.c | -rw-r--r-- | 6.0 KB |
blk-wbt.c | -rw-r--r-- | 18.2 KB |
blk-wbt.h | -rw-r--r-- | 3.6 KB |
blk-zoned.c | -rw-r--r-- | 8.7 KB |
blk.h | -rw-r--r-- | 12.1 KB |
bounce.c | -rw-r--r-- | 6.8 KB |
bsg-lib.c | -rw-r--r-- | 8.7 KB |
bsg.c | -rw-r--r-- | 21.1 KB |
cfq-iosched.c | -rw-r--r-- | 126.6 KB |
cmdline-parser.c | -rw-r--r-- | 4.9 KB |
compat_ioctl.c | -rw-r--r-- | 10.9 KB |
deadline-iosched.c | -rw-r--r-- | 13.2 KB |
elevator.c | -rw-r--r-- | 27.4 KB |
genhd.c | -rw-r--r-- | 48.8 KB |
ioctl.c | -rw-r--r-- | 15.2 KB |
ioprio.c | -rw-r--r-- | 5.1 KB |
kyber-iosched.c | -rw-r--r-- | 25.3 KB |
mq-deadline.c | -rw-r--r-- | 20.0 KB |
noop-iosched.c | -rw-r--r-- | 2.6 KB |
opal_proto.h | -rw-r--r-- | 9.3 KB |
partition-generic.c | -rw-r--r-- | 16.9 KB |
scsi_ioctl.c | -rw-r--r-- | 19.1 KB |
sed-opal.c | -rw-r--r-- | 58.8 KB |
t10-pi.c | -rw-r--r-- | 4.9 KB |
Computing file changes ...