Page MenuHomeFreeBSD

VirtFS/9p filesystem passthrough support (virtio-9p)
Needs RevisionPublic

Authored by jceel on Apr 9 2017, 9:45 PM.

Details

Reviewers
grehan
emaste
rgrimes
Group Reviewers
bhyve
Summary

Finally I think this is good enough to start upstreaming process.

The patch contains virtio-9p bhyve piece and associated 9p server library, lib9p. lib9p is standalone and can be also used to build a TCP-based 9p server.

New bhyve(8) syntax:

-s <slot>,virtio-9p,sharename=/path/to/the/share # creates virtio-9p device called "sharename" in the guest pointing to /path/to/the/share directory.

As for now, virtio-9p doesn't work in capability mode (bhyve has to be built with WITHOUT_CAPSICUM defined).

Thanks to Chris Torek for writing large parts of the lib9p library and to Sean Eric Fagan for his contributions.

Test Plan

Add virtio-9p device to the bhyve(8) command line, as speciftied above. Boot linux guest. Type the following:

mount -t 9p -o cache=mmap -o msize=512000 testshare /mnt/9p

enjoy fast host filesystem access and overall awesomeness.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

jceel created this revision.Apr 9 2017, 9:45 PM
jceel edited the summary of this revision. (Show Details)Apr 9 2017, 9:48 PM
jceel edited the summary of this revision. (Show Details)
jceel edited the test plan for this revision. (Show Details)Apr 9 2017, 9:52 PM
jceel retitled this revision from 9p filesystem passthrough support (virtio-9p) to VirtFS/9p filesystem passthrough support (virtio-9p).Apr 9 2017, 10:13 PM
grehan edited edge metadata.Apr 9 2017, 10:17 PM

Any thoughts on the interaction with capsicum ? Seems like you just need blanket access underneath a particular directory.

jceel added a comment.Apr 9 2017, 10:21 PM

Any thoughts on the interaction with capsicum ? Seems like you just need blanket access underneath a particular directory.

Yeah, absolutely. I'm not too proficient in capsicum, but that sounds easy enough :-)

You'll have to use openat(), with the fd set up prior to cap_enter(). Here's a small example from theraven@freebsd.org, who I'm sure will be happy to provide further advice :) http://www.informit.com/articles/article.aspx?p=1924012&seqNum=2

araujo added a subscriber: araujo.Apr 10 2017, 4:52 PM

Is there another upstream repo where you'll maintain lib9p? I'm slightly surprised to see bespoke code landing in contrib/

emaste requested changes to this revision.Apr 10 2017, 5:51 PM

I've looked at the changes exclusive of the new files in contrib/lib9p, and am marking this as needs revision for the Capsicum issue discussed inline.

If/when you upload a new diff with changes for this review, can you please add full/more context to make it easier? See https://wiki.freebsd.org/Phabricator.

lib/lib9p/Makefile
11–21

sort these?

usr.sbin/bhyve/Makefile
68

This can't be committed as is (unconditionally disabling Capsicum in bhyve). For initial testing purposes you could add some sort of off-by-default conditional block that disables Capsicum and enables 9p, although it's preferable if we can address Capsicum in 3p before commit.

This revision now requires changes to proceed.Apr 10 2017, 5:51 PM

Is there another upstream repo where you'll maintain lib9p? I'm slightly surprised to see bespoke code landing in contrib/

Yes, the upstream is maintained at https://github.com/freenas/lib9p. I would like to keep it in a separate repo, as xhyve folks would also like to use it (as a git submodule).

emaste added a comment.Dec 5 2017, 8:26 PM

Yes, the upstream is maintained at https://github.com/freenas/lib9p. I would like to keep it in a separate repo, as xhyve folks would also like to use it (as a git submodule).

Ok, thanks.

Any update on a reworked patch that avoids universally forcing capsicum off for bhyve?

grehan added a subscriber: tychon.Dec 6 2017, 1:19 AM

Adding tychon@ as a subscriber: he's been doing some 9P work in recent times.

seanc added a subscriber: seanc.Jan 17 2018, 6:46 PM