Re: [PATCH v2] fix mmap return value when vma is merged after call_mmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 04, 2020 at 03:25:35PM +0000, Matthew Wilcox wrote:

> This commit makes no sense.  I know it's eight years old, so maybe the
> device driver which did this has long been removed from the tree, but
> davem's comment was (iirc) related to a device driver for a graphics
> card that would 256MB-align the user address.  Another possibility is
> that userspace always asks for a 256MB-aligned address these days.

Presumably the latter, otherwise people would be complaining about the
WARN_ON.

With some grep I could only find this:

static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
#ifndef MMU
        /* this is uClinux (no MMU) specific code */

        vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_start = videomemory;

        return 0;
#else
        return -EINVAL;
#endif
}

So it does seem gone

> I don't understand why prev/rb_link/rb_parent would need to be changed
> in this case.  It's going to be inserted at the exact same location in
> the rbtree, just at a slightly shifted address.

If the driver adjust the address, and it doesn't collide with another
vma, and it doesn't change the tree position, then it could work

But if the driver radically changes the vm_start all bets are off and
you end up with an unsorted rb_tree at worst.

Banning drivers from adjusting the vm_start/end makes sense to me, at
least. How could a driver do this correctly anyhow?

Jason



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux