Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1465258
| From | Daniel Vetter <daniel@ffwll.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock |
| Date | 2016-08-18 15:10 +0200 |
| Message-ID | <s7vf4-dJ-29@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <s7e4x-4Qk-1@gated-at.bofh.it> <s7exz-5ga-5@gated-at.bofh.it> <s7hlL-7r8-1@gated-at.bofh.it> <s7rXP-6j1-3@gated-at.bofh.it> <s7tdh-75c-49@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Aug 18, 2016 at 06:55:12AM -0400, Rob Clark wrote: > On Thu, Aug 18, 2016 at 4:36 AM, Daniel Vetter <daniel@ffwll.ch> wrote: > > On Wed, Aug 17, 2016 at 05:29:31PM -0400, Rob Clark wrote: > >> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c > >> index 6cd4af4..4502e4b 100644 > >> --- a/drivers/gpu/drm/msm/msm_gem.c > >> +++ b/drivers/gpu/drm/msm/msm_gem.c > >> @@ -201,6 +201,13 @@ int msm_gem_fault(struct vm_area_struct *vma, > >> struct vm_fault *vmf) > >> pgoff_t pgoff; > >> int ret; > >> > >> + /* I think this should only happen if userspace tries to pass a > >> + * mmap'd but unfaulted gem bo vaddr into submit ioctl, triggering > >> + * a page fault while struct_mutex is already held > >> + */ > >> + if (mutex_is_locked_by(&dev->struct_mutex, current)) > >> + return VM_FAULT_SIGBUS; > > > > This is an ok (well still horrible) heuristics for the shrinker, but for > > correctness it kinda doesn't cut it. What you need to do instead is drop > > all the locks, copy relocations into a temp memory area and then proceed > > in the msm command submission path above. > > > > Also reentrant mutexes are evil ;-) > > Please note that this is not a reentrant mutex in the fault path, it > bails with VM_FAULT_SIGBUG! Except on UP it totally deadlocks ;-) -Daniel > There is never a legit reason to use a gem bo for the bos (or cmds) > table in the ioctl, so while this may not be pretty, I believe it is > an acceptable solution. -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Vaishali Thakkar <vaishali.thakkar@oracle.com> - 2016-08-17 13:50 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-17 17:10 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-17 19:10 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-17 20:50 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-17 21:20 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-17 21:30 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-17 21:40 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Daniel Vetter <daniel@ffwll.ch> - 2016-08-18 10:40 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-18 00:20 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Daniel Vetter <daniel@ffwll.ch> - 2016-08-18 11:40 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-18 13:00 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Daniel Vetter <daniel@ffwll.ch> - 2016-08-18 15:10 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-18 15:20 +0200
Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Rob Clark <robdclark@gmail.com> - 2016-08-17 21:20 +0200
csiph-web