From: Liam Mark <lmark@codeaurora.org>
To: "Sumit Semwal" <sumit.semwal@linaro.org>,
"Ørjan Eide" <Orjan.Eide@arm.com>
Cc: Brian Starkey <Brian.Starkey@arm.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"tkjos@android.com" <tkjos@android.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"arve@android.com" <arve@android.com>,
"joel@joelfernandes.org" <joel@joelfernandes.org>,
nd <nd@arm.com>, "maco@android.com" <maco@android.com>,
"christian@brauner.io" <christian@brauner.io>
Subject: Re: [Linaro-mm-sig] [PATCH 2/4] staging: android: ion: Restrict cache maintenance to dma mapped memory
Date: Thu, 28 Feb 2019 15:49:26 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.10.1902281541260.16374@lmark-linux.qualcomm.com> (raw)
In-Reply-To: <20190206154021.GC3768@e106893-lin.trondheim.arm.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1901 bytes --]
+ Sumit
Hi Sumit,
Do you have any thoughts on this patch?
It fixes a potential crash in on older kernel and I think limiting
begin/end_cpu_access to only apply cache maintenance when the buffer is
dma mapped makes sense from a logical perspective and performance
perspective.
On Wed, 6 Feb 2019, Ørjan Eide wrote:
>
> I've run some testing, and this patch does indeed fix the crash in
> dma_sync_sg_for_cpu when it tried to use the 0 dma_address from the sg
> list.
>
> Tested-by: Ørjan Eide <orjan.eide@arm.com>
>
> I tested this on an older kernel, v4.14, since the dma-mapping code
> moved, in v4.19, to ignore the dma_address and instead use sg_phys() to
> get a valid address from the page, which is always valid in the ion sg
> lists. While this wouldn't crash on newer kernels, it's still good to
> avoid the unnecessary work when no CMO is needed.
>
Isn't a fix like this also required from a stability perspective for
future kernels? I understand from your analysis below that the crash has
been fixed after 4.19 by using sg_phys to get the address but aren't we
breaking the DMA API contract by calling dma_sync_* without first dma
mapping the memory, if so then we have no guarantee that future
implementations of functions like dma_direct_sync_sg_for_cpu will properly
handle calls to dma_sync_* if the memory is not dma mapped.
> Is this patch a candidate for the relevant stable kernels, those that
> have this bug exposed to user space via Ion and DMA_BUF_IOCTL_SYNC?
>
My belief is that is relevant for older kernels otherwise an unprivileged
malicious userspace application may be able to crash the system if they
can call DMA_BUF_IOCTL_SYNC at the right time.
BTW thanks Ørjan testing and anaalsyis you have carried out on this
change.
Liam
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2019-02-28 23:49 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-18 18:37 [PATCH 0/4] ION stability and perf changes Liam Mark
2019-01-18 18:37 ` [PATCH 1/4] staging: android: ion: Support cpu access during dma_buf_detach Liam Mark
2019-01-18 19:34 ` Andrew F. Davis
2019-01-18 20:40 ` Laura Abbott
2019-01-18 18:37 ` [PATCH 2/4] staging: android: ion: Restrict cache maintenance to dma mapped memory Liam Mark
2019-01-18 20:20 ` Andrew F. Davis
2019-01-18 21:18 ` Liam Mark
2019-01-29 23:44 ` Liam Mark
2019-01-30 11:31 ` Brian Starkey
2019-02-06 15:40 ` [Linaro-mm-sig] " Ørjan Eide
2019-02-07 7:31 ` Christoph Hellwig
2019-02-07 15:45 ` Ørjan Eide
2019-02-28 23:49 ` Liam Mark [this message]
2019-01-30 14:31 ` Andrew F. Davis
2019-01-18 18:37 ` [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes Liam Mark
2019-01-18 20:48 ` Laura Abbott
2019-01-18 21:32 ` Liam Mark
2019-01-18 22:45 ` Laura Abbott
2019-01-19 10:25 ` Christoph Hellwig
2019-01-19 16:50 ` Laura Abbott
2019-01-21 8:30 ` Christoph Hellwig
2019-01-21 19:44 ` Liam Mark
2019-01-21 19:49 ` Andrew F. Davis
2019-01-21 20:20 ` Liam Mark
2019-01-21 20:24 ` Andrew F. Davis
2019-01-21 22:18 ` Liam Mark
2019-01-22 15:42 ` Andrew F. Davis
2019-01-22 22:47 ` Liam Mark
2019-01-21 21:30 ` Christoph Hellwig
2019-01-21 22:14 ` Liam Mark
2019-01-21 21:29 ` Christoph Hellwig
2019-01-21 22:12 ` Liam Mark
2019-01-22 16:06 ` Andrew F. Davis
2019-01-22 22:50 ` Liam Mark
2019-01-18 18:37 ` [PATCH 4/4] staging: android: ion: Support " Liam Mark
2019-01-21 12:19 ` Brian Starkey
2019-01-22 22:37 ` Liam Mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.10.1902281541260.16374@lmark-linux.qualcomm.com \
--to=lmark@codeaurora.org \
--cc=Brian.Starkey@arm.com \
--cc=Orjan.Eide@arm.com \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=devel@driverdev.osuosl.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=joel@joelfernandes.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=nd@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=tkjos@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome