Page MenuHomeFreeBSD

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

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

Details

Reviewers
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

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 21733

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
12–22

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
emaste added a subscriber: jhb.Nov 20 2018, 5:32 PM
krion added a subscriber: krion.Dec 23 2018, 7:51 PM
jceel updated this revision to Diff 52326.Dec 27 2018, 1:33 AM

This update adds the Capsicum/Casper support to lib9p. It definitely needs more polishing, though.

dch added a subscriber: dch.Jan 25 2019, 11:20 AM
rgrimes removed a reviewer: grehan.Feb 20 2019, 5:55 PM