From: Harsh Bora <harsh@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Avi Kivity <avi@redhat.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] i_generation / st_gen support for handle based fs driver
Date: Thu, 11 Aug 2011 12:46:19 +0530 [thread overview]
Message-ID: <4E4381C3.2030707@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAJSP0QWdHq0wrqbUsB39T85TuHnA9vBm05tHR4SnrDLF2+XW4Q@mail.gmail.com>
On 08/10/2011 08:47 PM, Stefan Hajnoczi wrote:
> On Fri, Aug 5, 2011 at 1:53 PM, Stefan Hajnoczi<stefanha@gmail.com> wrote:
>> On Fri, Aug 5, 2011 at 12:32 PM, Aneesh Kumar K.V
>> <aneesh.kumar@linux.vnet.ibm.com> wrote:
>>> On Fri, 5 Aug 2011 10:24:42 +0100, Stefan Hajnoczi<stefanha@gmail.com> wrote:
>>>> On Fri, Aug 5, 2011 at 7:40 AM, Aneesh Kumar K.V
>>>> <aneesh.kumar@linux.vnet.ibm.com> wrote:
>>>>> On Thu, 4 Aug 2011 22:57:34 +0100, Stefan Hajnoczi<stefanha@gmail.com> wrote:
>>>>>> On Thu, Aug 4, 2011 at 7:45 PM, Aneesh Kumar K.V
>>>>>> <aneesh.kumar@linux.vnet.ibm.com> wrote:
>>>>>>> On Thu, 4 Aug 2011 15:31:08 +0100, Stefan Hajnoczi<stefanha@gmail.com> wrote:
>>>>>>>> On Thu, Aug 4, 2011 at 1:03 PM, Aneesh Kumar K.V
>>>>>>>> <aneesh.kumar@linux.vnet.ibm.com> wrote:
>>>>>>>>> On Thu, 4 Aug 2011 12:47:42 +0100, Stefan Hajnoczi<stefanha@gmail.com> wrote:
>>>>>>>>>> On Thu, Aug 4, 2011 at 12:20 PM, Aneesh Kumar K.V
>>>>>>>>>> <aneesh.kumar@linux.vnet.ibm.com> wrote:
>>>>>>>>>>> On Thu, 4 Aug 2011 11:21:05 +0100, Stefan Hajnoczi<stefanha@gmail.com> wrote:
>>>>>>>>>>>> On Thu, Aug 4, 2011 at 11:06 AM, Harsh Prateek Bora
>>>>>>>>>>>> <harsh@linux.vnet.ibm.com> wrote:
>>>>>>>>>>>>> This patch provides support for st_gen for handle based fs type server.
>>>>>>>>>>>>> Currently the support is provided for ext4, btrfs, reiserfs and xfs.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Signed-off-by: Harsh Prateek Bora<harsh@linux.vnet.ibm.com>
>>>>>>>>>>>>> ---
>>>>>>>>>>>>> hw/9pfs/virtio-9p-handle.c | 30 ++++++++++++++++++++++++++++++
>>>>>>>>>>>>> 1 files changed, 30 insertions(+), 0 deletions(-)
>>>>>>>>>>>>
>>>>>>>>>>>> Does handle-based file I/O really need to duplicate all this code? Is
>>>>>>>>>>>> it possible to use either regular open or handle-based open from a
>>>>>>>>>>>> single local fs codebase?
>>>>>>>>>>>
>>>>>>>>>>> The only details common between handle based and local based getversion
>>>>>>>>>>> callback is the ioctl. Moving that into a helper may not really help in
>>>>>>>>>>> this case ?.
>>>>>>>>>>
>>>>>>>>>> Aneesh, do you have a public virtfs tree that I can look at? In
>>>>>>>>>> qemu.git we don't have virtio-9p-handle.c yet, so I can't give any
>>>>>>>>>> specific feedback.
>>>>>>>>>
>>>>>>>>> http://repo.or.cz/w/qemu/v9fs.git for-upstream
>>>>>>>>>
>>>>>>>>> I should send the patchset to qemu list soon. Was waiting for the
>>>>>>>>> co-routine patches to go upstream.
>>>>>>>>
>>>>>>>> The handle code looks like a copy of the local backend minus security
>>>>>>>> models. It just needs to use handle syscalls instead of using paths.
>>>>>>>>
>>>>>>>> If you treat the path as the "handle" and use regular openat(2), then
>>>>>>>> the handle code could do what the local backend does today. Except
>>>>>>>> compared to the local backend it would not have security models and be
>>>>>>>> a bit slower due to extra syscalls.
>>>>>>>>
>>>>>>>> Is the plan to add security models to the handle backend? If so, then
>>>>>>>> handle and local will be equivalent and duplicate code.
>>>>>>>>
>>>>>>>
>>>>>>> handle require root user privileges to run. So security model with
>>>>>>> handle fs driver doesn't make sense. We added mapped security model to
>>>>>>> avoid requiring user to run as root.
>>>>>>
>>>>>> Does it really require root or is a specific set of capabilities
>>>>>> enough?
>>>>>
>>>>> CAP_DAC_READ_SEARCH is needed.
>>>>>
>>>>>>
>>>>>> A feature that requires QEMU to run as root has really limited value.
>>>>>> Unprivileged users cannot use the feature, so ad-hoc QEMU users are
>>>>>> left behind. People don't want to deploy production guests as root,
>>>>>> may not be allowed to, or might find that their management tool
>>>>>> doesn't support that. So who will be able to use this feature?
>>>>>>
>>>>>
>>>>> One of the main issue that handle based backend fix is the complexity
>>>>> involved in handling renames, both on the guest and on the host. I am
>>>>> also not sure how effective it would be to run the qemu as non root user
>>>>> when exporting a directory with VirtFS. In the mapped security model the
>>>>> user credentials with which the files are created are stored in xattr
>>>>> and that mostly implies host cannot look at the files the same way.
>>>>>
>>>>> My understanding is passthrough security model (which require qemu to
>>>>> run as root) will be used if somebody wants to export a directory on the
>>>>> host to guest. In my case I use none security model, simply because i
>>>>> don't want new xattr on the file created and I am ok even the files
>>>>> get created on the host with the credentials on qemu.
>>>>
>>>> With xattrs you have to mount the directory on the host in order to
>>>> see the same view as the guest.
>>>
>>> How will that help ? There is nothing on the host that maps those xattr
>>> to mode/ownership bits currently. We will have to do something similar to fuse to
>>> make that work ?
>>
>> Sorry, what I suggested is not actually possible today. We only have
>> a virtio-9p transport in the QEMU 9pfs code, not a TCP transport. I
>> meant mount -t 9p on the host - don't access the backing directory
>> directly, instead mount it using 9p on localhost.
>>
>>> My understanding was passthrough will be preferred
>>> option. But i may be mistaken.
>>
>> If passthrough requires all of QEMU to run as root, then we need to
>> find a way to run that code separately and drop privileges in QEMU.
>>
>> The chroot helper process patches that Mohan posted might be a
>> solution. The chroot helper does all path and permissions-related
>> operations in a separate process. File descriptor passing is used so
>> that QEMU can perform read/write operations itself without copying
>> data.
>>
>> Then we just need to make sure that QEMU itself runs unprivileged and
>> the chroot helper is able to run as root for the passthrough security
>> model.
>
> Harsh, any thoughts on this?
Hi Stefan,
I am still not sure if it is really a big concern for VirtFS users, and
if really required, we can move the functionality to a privileged
process and but that would require Qemu to be initially run as root and
then drop privileges to a certain non-root user. However, lets take this
discussion separately and see what community thinks about it. If the
community agrees, we can do it when we merge the chroot patch series. I
therefore posted v2 for the st_gen patch to keep that isolated.
- Harsh
>
> Stefan
prev parent reply other threads:[~2011-08-11 7:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 10:06 [Qemu-devel] [PATCH 0/2] Support for i_generation / st_gen in 9p server Harsh Prateek Bora
2011-08-04 10:06 ` [Qemu-devel] [PATCH 1/2] i_generation / st_gen support for local fs type Harsh Prateek Bora
2011-08-04 10:17 ` Stefan Hajnoczi
2011-08-04 10:06 ` [Qemu-devel] [PATCH 2/2] i_generation / st_gen support for handle based fs driver Harsh Prateek Bora
2011-08-04 10:21 ` Stefan Hajnoczi
2011-08-04 11:20 ` Aneesh Kumar K.V
2011-08-04 11:47 ` Stefan Hajnoczi
2011-08-04 12:03 ` Aneesh Kumar K.V
2011-08-04 14:31 ` Stefan Hajnoczi
2011-08-04 18:45 ` Aneesh Kumar K.V
2011-08-04 21:57 ` Stefan Hajnoczi
2011-08-05 6:40 ` Aneesh Kumar K.V
2011-08-05 9:24 ` Stefan Hajnoczi
2011-08-05 11:32 ` Aneesh Kumar K.V
2011-08-05 12:53 ` Stefan Hajnoczi
2011-08-10 15:17 ` Stefan Hajnoczi
2011-08-10 15:17 ` Stefan Hajnoczi
2011-08-10 17:33 ` Aneesh Kumar K.V
2011-08-11 7:16 ` Harsh Bora [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=4E4381C3.2030707@linux.vnet.ibm.com \
--to=harsh@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=avi@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.