From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: mchehab@kernel.org, kstewart@linuxfoundation.org,
tomasbortoli@gmail.com, sean@mess.org, allison@lohutok.net,
tglx@linutronix.de, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: usb: ttusb-dec: avoid buffer overflow in ttusb_dec_handle_irq() when DMA failures/attacks occur
Date: Thu, 7 May 2020 00:48:47 +0800 [thread overview]
Message-ID: <46615f6e-11ec-6546-42a9-3490414f9550@gmail.com> (raw)
In-Reply-To: <20200506155257.GB3537174@kroah.com>
On 2020/5/6 23:52, Greg KH wrote:
> On Wed, May 06, 2020 at 11:30:22PM +0800, Jia-Ju Bai wrote:
>>
>> On 2020/5/6 19:07, Greg KH wrote:
>>> On Wed, May 06, 2020 at 06:13:01PM +0800, Jia-Ju Bai wrote:
>>>> I have never modified DMA memory in the real world, but an attacker can use
>>>> a malicious device to do this.
>>>> There is a video that shows how to use the Inception tool to perform DMA
>>>> attacks and login in the Windows OS without password:
>>>> https://www.youtube.com/watch?v=HDhpy7RpUjM
>>> If you have control over the hardware, and can write to any DMA memory,
>>> again, there's almost nothing a kernel can do to protect from that.
>> I think that each device can only access its own DMA memory, instead of any
>> DMA memory for other hardware devices.
> That's not true at all for all systems that Linux runs on.
I am not sure to understand this.
For example, a driver requests DMA memory with "len" size by using:
mem = dma_alloc_coherent(..., len, ...);
I think that the driver can only access DMA memory between "mem" and
"mem + len", is it true?
Can the driver access other DMA memory using some code like "mem + len *
10"?
>
>> A feasible example is that, the attacker inserts a malicious device via
>> PCI-E bus in a locked computer, when the owner of this computer leaves.
> This is a semi-well-known issue. It's been described in the past
> regarding thunderbolt devices, and odds are, more people will run across
> it again in the future and also complain about it.
>
> The best solution is to solve this at the bus level, preventing
> different devices access to other memory areas.
>
> And providing physical access control to systems that you care about
> this type of attack for.
>
> Again, this isn't a new thing, but the ability for us to do much about
> it depends on the specific hardware control, and how we set defaults up.
Yes, I agree that this issue is not new, because DMA attacks are old
problems.
But I am a little surprised that many current drivers are still
vulnerable to DMA attacks.
>
> If you trust a device enough to plug it in, well, you need to trust it
> :)
Well, maybe I need to trust all devices in my computer :)
Anyway, thanks a lot for your patient explanation and reply.
If you have encountered other kinds of DMA-related bugs/vulnerabilities,
maybe I can help to detect them using my static-analysis tool :)
Best wishes,
Jia-Ju Bai
next prev parent reply other threads:[~2020-05-06 16:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 14:21 [PATCH] media: usb: ttusb-dec: avoid buffer overflow in ttusb_dec_handle_irq() when DMA failures/attacks occur Jia-Ju Bai
2020-05-05 18:10 ` Greg KH
2020-05-06 10:13 ` Jia-Ju Bai
2020-05-06 11:07 ` Greg KH
2020-05-06 15:30 ` Jia-Ju Bai
2020-05-06 15:52 ` Greg KH
2020-05-06 16:48 ` Jia-Ju Bai [this message]
2020-05-06 17:43 ` Greg KH
2020-05-07 5:15 ` Jia-Ju Bai
2020-05-07 7:52 ` Greg KH
2020-05-07 9:59 ` Jia-Ju Bai
2020-05-07 8:43 ` Sean Young
2020-05-07 10:11 ` Jia-Ju Bai
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=46615f6e-11ec-6546-42a9-3490414f9550@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=allison@lohutok.net \
--cc=gregkh@linuxfoundation.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sean@mess.org \
--cc=tglx@linutronix.de \
--cc=tomasbortoli@gmail.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