On Sat, Jul 21, 2018 at 3:49 PM Linus Torvalds torvalds@linux-foundation.org wrote:
IOW, Kirill's patch now just boils down to the attached trial patch.
Side note: we have a few rdma drivers that mess with vm_ops.
One does so intentionally, see mlx4_ib_vma_open() in
drivers/infiniband/hw/mlx4/main.c
and one *may* be intentional but it's not entirely clear: hns_roce_vma_open() may bve the same issue, but hns_roce_disassociate_ucontext() just looks pointless in
drivers/infiniband/hw/hns/hns_roce_main.c
Afaik, they should just use VM_DONTCOPY to not see the fork open case, VM_DONTEXPAND to fail a size-changing mremap, and set a vm_ops->split() function that returns an error.
Maybe we should have a VM_DONTSPLIT to make that ->split() case be simpler.
Their vma->vm_ops games seem very bogus, and will cause oddities. So right now they *will* get copied on fork and split, and then you have random crazy pages being mapped but not the right vm_ops. In addition to the confusion with vma_is_anonymous().
Doug/Jason/etc?
(There's also scif_munmap() that clears vm_ops, but at minmap time it doesn't really matter..)
Linus