lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF6AEGuUWGjXaACzi4D2AeSEHzy5dxV6aQSqMFf6Bc0e3+XXuA@mail.gmail.com>
Date:	Thu, 18 Aug 2016 06:55:12 -0400
From:	Rob Clark <robdclark@...il.com>
To:	Rob Clark <robdclark@...il.com>, Al Viro <viro@...iv.linux.org.uk>,
	Vaishali Thakkar <vaishali.thakkar@...cle.com>,
	David Airlie <airlied@...ux.ie>,
	linux-arm-msm <linux-arm-msm@...r.kernel.org>,
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
	freedreno@...ts.freedesktop.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Julia Lawall <julia.lawall@...6.fr>
Cc:	Daniel Vetter <daniel@...ll.ch>
Subject: Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock

On Thu, Aug 18, 2016 at 4:36 AM, Daniel Vetter <daniel@...ll.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!

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.

BR,
-R

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ