Re: [RFC PATCH] drm/nouveau: fix nested locking in mmap handler

From: Ingo Molnar
Date: Tue Sep 24 2013 - 04:20:59 EST

* Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxx> wrote:

> > I think the Nouveau guys need to comment further on this, but
> > returning -EFAULT might break existing user-space, and that's not
> > allowed, but IIRC the return value of "presumed" is only a hint, and
> > if it's incorrect will only trigger future command stream patching.
> >
> > Otherwise reviewing mostly the TTM stuff. FWIW, from wat I can tell
> > the vmwgfx driver doesn't need any fixups.
> Well because we read the list of buffer objects the presumed offsets are
> at least read-mapped. Although I guess in the worst case the mapping
> might disappear before the syscall copies back the data. So if -EFAULT
> happens here then userspace messed up in some way, either by forgetting
> to map the offsets read-write, which cannot happen with libdrm or
> free'ing the bo list before the syscall returns, which would probably
> result in libdrm crashing shortly afterwards anyway.
> So I don't know whether to swallow that -EFAULT or not, which is what I
> asked.

In such a case returning -EFAULT is very strongly preferred.

If there's a user-space bug, such as a context life time race between
graphics context creation/destruction and user threads making use of the
graphics context, then getting the -EFAULT would be very helpful to
user-space debugging as well.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at