qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	Ryan Harper <ryanh@us.ibm.com>, Amit Shah <amit.shah@redhat.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] To O_EXCL or not to O_EXCL open host_cdrom
Date: Tue, 12 Apr 2011 10:14:58 +0100	[thread overview]
Message-ID: <BANLkTimrsWk94+N++-CDvvkHC1H7bXMePQ@mail.gmail.com> (raw)
In-Reply-To: <20110412081932.GC10071@redhat.com>

On Tue, Apr 12, 2011 at 9:19 AM, Daniel P. Berrange <berrange@redhat.com> wrote:
> On Tue, Apr 12, 2011 at 10:10:44AM +0200, Kevin Wolf wrote:
>> Am 12.04.2011 09:52, schrieb Daniel P. Berrange:
>> >  - If the -drive specification has  readonly=on (thus O_RDONLY to
>> >    open(2) call) , I expect QEMU (or the kernel) to forbid the
>> >    "eject" command on the host CDROM. This should prevent two guests
>> >    interfering seriously with each other.
>> >
>> > So I think using O_EXCL would be OK, in the case where the block
>> > driver was  host_cdrom and readonly=off.
>>
>> This would overload readonly with a completely unrelated option (should
>> eject be allowed). Doesn't sound like a great idea.
>
> Use of the "host_cdrom" block driver enables passthrough of
> commands to the host device.
>
> Use of "readonly" is what controls whether individual passthrough
> commands are actually permitted.
>
> To me, "readonly" means don't allow anything that would impact
> another guests view of the file/device. So forbidding 'eject'
> is within scope of that IMHO.

I agree with Kevin here.  You're overloading the option.

Today I doubt readonly will prevent the eject/lock ioctls but I haven't tested.

I'm becoming more convinced now that we should be using O_EXCL.  Like
you say, forcing raw gives us the option to share the device for
reading without allowing the dangerous ioctls.

Stefan

      reply	other threads:[~2011-04-12  9:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 11:33 [Qemu-devel] To O_EXCL or not to O_EXCL open host_cdrom Stefan Hajnoczi
2011-04-11  5:07 ` [Qemu-devel] " Amit Shah
2011-04-11  8:31   ` Stefan Hajnoczi
2011-04-11 13:30     ` Avi Kivity
2011-04-11 13:27 ` [Qemu-devel] " Avi Kivity
2011-04-11 18:19 ` Christoph Hellwig
2011-04-12  7:52 ` Daniel P. Berrange
2011-04-12  8:10   ` Kevin Wolf
2011-04-12  8:19     ` Daniel P. Berrange
2011-04-12  9:14       ` Stefan Hajnoczi [this message]

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=BANLkTimrsWk94+N++-CDvvkHC1H7bXMePQ@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ryanh@us.ibm.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;
as well as URLs for NNTP newsgroup(s).