From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] [ide] Check that asynchronous (DMA) submission succeeds
Date: Sat, 06 Sep 2008 21:48:31 -0500 [thread overview]
Message-ID: <48C340FF.3000503@codemonkey.ws> (raw)
In-Reply-To: <18615.50224.233594.405241@mariner.uk.xensource.com>
Ian Jackson wrote:
> Anthony Liguori writes ("Re: [Qemu-devel] [PATCH] [ide] Check that asynchronous (DMA) submission succeeds"):
>
>> It's generally dangerous to call callbacks from the code that is issuing
>> a bdrv_aio_ operation. A malicious guest could potentially force the
>> emulation into an infinite loop.
>>
>
> I'm not sure exactly what you mean but I'm sure that this is not a
> problem in this case. In my patch ide_dma_submit_check is called from
> two places:
> * ide_read_dma_cb, with ide_read_dma_cb as the callback argument
> * ide_write_dma_cb, with ide_write_dma_cb as the callback argument
>
> In both places the only situation where the callback is reentered
> immediately is if the aio submission failed. So in that case we
> recursively enter the callback function, and we do so exactly once
> since we're going to execute the error handling case (ret==-1).
>
> Note that the call to ide_dma_submit_check is at the end of
> ide_{read,write}_dma_cb precisely to avoid any kind of reentrancy
> problem.
>
I'll have to look more closely, but most of the code goes to great
lengths to use bottom halves to avoid the possibility of infinite
recursion. The concern with recursion is not CPU consumption, it's that
you'll eventually overrun the stack and potentially crash the QEMU process.
You may be right that in this case, recursion is impossible but it's
probably better to use a bottom half just for the sake of consistency.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2008-09-07 2:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 16:52 [Qemu-devel] [PATCH] [ide] Check that asynchronous (DMA) submission succeeds Ian Jackson
2008-08-28 20:23 ` Anthony Liguori
2008-08-29 9:41 ` Ian Jackson
2008-09-07 2:48 ` Anthony Liguori [this message]
2008-09-07 4:16 ` Jamie Lokier
2008-08-31 6:42 ` Gleb Natapov
2008-09-01 11:31 ` Ian Jackson
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=48C340FF.3000503@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).