Skip to content

Instantly share code, notes, and snippets.

@dch
Last active May 22, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dch/febc5819a2c26da554e10c9e0b2af6cd to your computer and use it in GitHub Desktop.
Save dch/febc5819a2c26da554e10c9e0b2af6cd to your computer and use it in GitHub Desktop.
diff of D10335 patch vs CBSD-provided 13.0 diff, both rebased against latest current https://reviews.freebsd.org/D10335 & https://github.com/cbsd/cbsd/tree/develop/upgrade/patch/p9-13.0
diff --git etc/mtree/BSD.include.dist etc/mtree/BSD.include.dist
index 385e096b7e9..88b60c8794c 100644
--- etc/mtree/BSD.include.dist
+++ etc/mtree/BSD.include.dist
@@ -259,10 +259,10 @@
..
lib80211
..
- lib9p
- ..
libipt
..
+ lib9p
+ .
libmilter
..
libxo
diff --git lib/Makefile lib/Makefile
index b5937b3e00d..659383e2490 100644
--- lib/Makefile
+++ lib/Makefile
@@ -11,6 +11,7 @@
SUBDIR_BOOTSTRAP= \
csu \
.WAIT \
+ lib9p \
libc \
libc_nonshared \
libcompiler_rt \
@@ -25,7 +26,6 @@ SUBDIR_BOOTSTRAP= \
SUBDIR= ${SUBDIR_BOOTSTRAP} \
.WAIT \
geom \
- lib9p \
libalias \
libarchive \
libauditd \
diff --git lib/lib9p/Makefile lib/lib9p/Makefile
index 36c7a8f7238..fe014ca158b 100644
--- lib/lib9p/Makefile
+++ lib/lib9p/Makefile
@@ -2,12 +2,12 @@
.PATH: ${.CURDIR}/../../contrib/lib9p
CFLAGS+=-I${.CURDIR}/../../contrib/lib9p
-CFLAGS+=-DWITH_CASPER
-DEBUG_FLAGS= -DL9P_DEBUG=L9P_DEBUG -DACE_DEBUG -g -O0
+CFLAGS+=-DL9P_DEBUG=L9P_DEBUG -DACE_DEBUG -g -O0 -DWITHOUT_CAPSICUM
LIB= 9p
PACKAGE= lib${LIB}
SHLIB_MAJOR= 1
+WARNS= 2
SRCS= pack.c \
connection.c \
request.c \
diff --git usr.sbin/bhyve/Makefile usr.sbin/bhyve/Makefile
index 98c79602d33..15e565ecb27 100644
--- usr.sbin/bhyve/Makefile
+++ usr.sbin/bhyve/Makefile
@@ -3,8 +3,6 @@
#
.include <src.opts.mk>
-CFLAGS+=-I${.CURDIR}/../../contrib/lib9p
-.PATH: ${.CURDIR}/../../contrib/lib9p
CFLAGS+=-I${SRCTOP}/sys
.PATH: ${SRCTOP}/sys/cam/ctl
@@ -14,6 +12,7 @@ PACKAGE= bhyve
MAN= bhyve.8
BHYVE_SYSDIR?=${SRCTOP}
+.PATH: ${BHYVE_SYSDIR}/contrib/lib9p
SRCS= \
atkbdc.c \
@@ -72,7 +71,7 @@ SRCS= \
.PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm
SRCS+= vmm_instruction_emul.c
-LIBADD= vmmapi md pthread z util sbuf cam 9p casper cap_pwd cap_grp
+LIBADD= vmmapi md pthread z util sbuf cam 9p
.if ${MK_INET_SUPPORT} != "no"
CFLAGS+=-DINET
@@ -86,6 +85,8 @@ CFLAGS+=-DNO_OPENSSL
LIBADD+= crypto
.endif
+CFLAGS+= -DWITHOUT_CAPSICUM
+CFLAGS+= -I${BHYVE_SYSDIR}/contrib/lib9p
CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/e1000
CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/mii
CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/usb/controller
diff --git usr.sbin/bhyve/pci_virtio_9p.c usr.sbin/bhyve/pci_virtio_9p.c
index 0033f6d9e05..f6a24c171da 100644
--- usr.sbin/bhyve/pci_virtio_9p.c
+++ usr.sbin/bhyve/pci_virtio_9p.c
@@ -1,8 +1,10 @@
/*-
- * Copyright (c) 2015 iXsystems Inc.
- * Copyright (c) 2017-2018 Jakub Klama <jceel@FreeBSD.org>
+ * Copyright (c) 2015-2017 iXsystems Inc.
* All rights reserved.
*
+ * This software was developed by Jakub Klama under sponsorship
+ * from iXsystems, Inc.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -45,10 +47,9 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <assert.h>
#include <pthread.h>
-#include <sys/capsicum.h>
#include <lib9p.h>
-#include <backend/fs.h>
+//#include <lib9p/fs.h>
#include "bhyverun.h"
#include "pci_emul.h"
@@ -63,6 +64,8 @@ static int pci_vt9p_debug;
#define DPRINTF(params) if (pci_vt9p_debug) printf params
#define WPRINTF(params) printf params
+int l9p_backend_fs_init(struct l9p_backend **backendp, const char *root);
+
/*
* Per-device softc
*/
@@ -235,8 +238,6 @@ pci_vt9p_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
char *opt;
char *sharename = NULL;
char *rootpath = NULL;
- int rootfd;
- cap_rights_t rootcap;
if (opts == NULL) {
printf("virtio-9p: share name and path required\n");
@@ -260,24 +261,10 @@ pci_vt9p_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
DPRINTF(("read-only mount requested\r\n"));
}
- rootfd = open(rootpath, O_DIRECTORY);
- if (rootfd < 0)
- return (-1);
-
- cap_rights_init(&rootcap,
- CAP_LOOKUP, CAP_ACL_CHECK, CAP_ACL_DELETE, CAP_ACL_GET,
- CAP_ACL_SET, CAP_READ, CAP_WRITE, CAP_SEEK, CAP_FSTAT,
- CAP_CREATE, CAP_FCHMODAT, CAP_FCHOWNAT, CAP_FTRUNCATE,
- CAP_LINKAT_SOURCE, CAP_LINKAT_TARGET, CAP_MKDIRAT, CAP_MKNODAT,
- CAP_PREAD, CAP_PWRITE, CAP_RENAMEAT_SOURCE, CAP_RENAMEAT_TARGET,
- CAP_SEEK, CAP_SYMLINKAT, CAP_UNLINKAT, CAP_EXTATTR_DELETE,
- CAP_EXTATTR_GET, CAP_EXTATTR_LIST, CAP_EXTATTR_SET,
- CAP_FUTIMES, CAP_FSTATFS, CAP_FSYNC, CAP_FPATHCONF);
-
sc->vsc_config->tag_len = (uint16_t)strlen(sharename);
strncpy(sc->vsc_config->tag, sharename, strlen(sharename));
- if (l9p_backend_fs_init(&sc->vsc_fs_backend, rootfd) != 0) {
+ if (l9p_backend_fs_init(&sc->vsc_fs_backend, rootpath) != 0) {
errno = ENXIO;
return (1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment