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: <6a34823b-4a1d-c7de-a4c7-87587705708b@linaro.org>
Date:   Wed, 28 Aug 2019 09:48:03 +0100
From:   Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To:     Jorge Ramirez <jorge.ramirez-ortiz@...aro.org>
Cc:     Greg KH <gregkh@...uxfoundation.org>, arnd@...db.de,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Mayank Chopra <mak.chopra@...eaurora.org>
Subject: Re: [PATCH 4/5] misc: fastrpc: fix double refcounting on dmabuf



On 28/08/2019 08:50, Jorge Ramirez wrote:
> On 8/27/19 23:45, Srinivas Kandagatla wrote:
>> On 23/08/2019 16:23, Jorge Ramirez-Ortiz wrote:
>>> can you add me as a co-author to this patch please?
>> No problem I can do that if you feel so!
> yes please. thanks!
> 
>>> since I spent about a day doing the analysis, sent you  a fix that
>>> maintained the API used by the library and explained you how to
>>> reproduce the issue I think it is just fair. > the  fact that the api
>>> could be be modified and the fix be done a bit
>>> differently- free dma buf ioctl removed- seems just a minor
>>> implementation detail to me.
>> No, that's not true, this is a clear fastrpc design issue.
> IMO the ioctls defines the contract with userspace and the contract
> establishes that userspace must call deallocate. the kernel wrongly
> implemented to that contract since it doesn't handle the cases where
> userspace can't send the release calls which leads to memory leaks. this
> is what I meant by and implementation issue.
> 
> if we had many fastrpc users, rolling out the design change that you
> propose - removing an ioctl- would definitively have an impact. But
> since that is not yet the case, there is not doubt that your patch makes
> more sense.

Exactly before it make a way into other projects!

> 
> but my point was that there is not a huge gap in efforts between doing
> one or the other.

Thats not the point, point is about right fix!

> 
>> Userspace is already doing a refcount via mmap/unmap on that dmabuf fd,
>> having an additional api adds another level of refcount which is totally
>> redundant and is the root cause for this leak.
> yes it is redundant but is not the root cause for this leak. the root
> cause is that the driver doesnt handle the case where userspace didnt or
> was not able to call release (and that is no more than adding allocated
> buffers to a list and clean on exit)

I don't agree with you on that. We should not take an extra refcount in 
first place in driver.

let me explain it one more time!

dmabuf has to be mmaped in userspace app before it is used, and
"Memory mappings that were created in the process shall be unmapped 
before the process is destroyed" so the refcount is taken care by 
mmap/unmap automatically.

--srini


> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ