Skip to contentSkip to conversation

virtiofsd xattr name mappings

PATCH In review Dr. David Alan Gilbert (git) 2 participants 14 messages Oct 23, 2020 – Oct 26, 2020

lore
Share & tools
lore
#0 lore raw

v4 cover virtiofsd xattr name mappings

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 4th cut of an xattr name mapping option for virtiofsd. It allows the user of virtiofsd to define a fairly flexible mapping from the view of the xattr names the host fs has and the ones that the guest sees.

The hope is this allows things like:
a) Different selinux attributes on host/guest
b) separation of trusted. attributes that clash on overlayfs
c) support for privileged xattr's in guests running with an unprivileged virtiofsd.

There's no apparent standard for this kind of mapping, so I made it flexible by specifying a mapping rule in the option.

Prefix's can be added (selectively or globally), xattr's can be dropped in either direction or passed through.

v4
cleanups from Stefan and Vivek's reviews

Dave

Dr. David Alan Gilbert (5):
tools/virtiofsd: xattr name mappings: Add option tools/virtiofsd: xattr name mappings: Map client xattr names tools/virtiofsd: xattr name mappings: Map server xattr names tools/virtiofsd: xattr name mapping examples tools/virtiofsd: xattr name mappings: Simple 'map'

 docs/tools/virtiofsd.rst         | 161 +++++++++++
 tools/virtiofsd/passthrough_ll.c | 474 ++++++++++++++++++++++++++++++-
 2 files changed, 632 insertions(+), 3 deletions(-)
Signature · 1 line
2.28.0
#1 lore raw

PATCH v4 1/5 tools/virtiofsd: xattr name mappings: Add option

From: "Dr. David Alan Gilbert" <[email protected]>

Add an option to define mappings of xattr names so that the client and server filesystems see different views. This can be used to have different SELinux mappings as seen by the guest, to run the virtiofsd with less privileges (e.g. in a case where it can't set trusted/system/security xattrs but you want the guest to be able to), or to isolate multiple users of the same name; e.g. trusted attributes used by stacking overlayfs.

A mapping engine is used with 3 simple rules; the rules can be combined to allow most useful mapping scenarios. The ruleset is defined by -o xattrmap='rules...'.

This patch doesn't use the rule maps yet.

---
 docs/tools/virtiofsd.rst         |  92 ++++++++++++++++
 tools/virtiofsd/passthrough_ll.c | 173 +++++++++++++++++++++++++++++++
 2 files changed, 265 insertions(+)
docs/tools/virtiofsd.rst +92 -0
index 7ecee49834..868fa0e97b 100644
@@ -109,6 +109,98 @@ Options
   timeout.  ``always`` sets a long cache lifetime at the expense of coherency.
   The default is ``auto``.
 
+xattr-mapping
+-------------
+
+By default the name of xattr's used by the client are passed through to the server
+file system.  This can be a problem where either those xattr names are used
+by something on the server (e.g. selinux client/server confusion) or if the
+virtiofsd is running in a container with restricted privileges where it cannot
+access some attributes.
+
+A mapping of xattr names can be made using -o xattrmap=mapping where the ``mapping``
+string consists of a series of rules.
+
+The first matching rule terminates the mapping.
+The set of rules must include a terminating rule to match any remaining attributes
+at the end.
+
+Each rule consists of a number of fields separated with a separator that is the
+first non-white space character in the rule.  This separator must then be used
+for the whole rule.
+White space may be added before and after each rule.
+Using ':' as the separator a rule is of the form:
+
+``:type:scope:key:prepend:``
+
+**scope** is:
+
+- 'client' - match 'key' against a xattr name from the client for
+             setxattr/getxattr/removexattr
+- 'server' - match 'prepend' against a xattr name from the server
+             for listxattr
+- 'all' - can be used to make a single rule where both the server
+          and client matches are triggered.
+
+**type** is one of:
+
+- 'prefix' - is designed to prepend and strip a prefix;  the modified
+  attributes then being passed on to the client/server.
+
+- 'ok' - Causes the rule set to be terminated when a match is found
+  while allowing matching xattr's through unchanged.
+  It is intended both as a way of explicitly terminating
+  the list of rules, and to allow some xattr's to skip following rules.
+
+- 'bad' - If a client tries to use a name matching 'key' it's
+  denied using EPERM; when the server passes an attribute
+  name matching 'prepend' it's hidden.  In many ways it's use is very like
+  'ok' as either an explict terminator or for special handling of certain
+  patterns.
+
+**key** is a string tested as a prefix on an attribute name originating
+on the client.  It maybe empty in which case a 'client' rule
+will always match on client names.
+
+**prepend** is a string tested as a prefix on an attribute name originating
+on the server, and used as a new prefix.  It may be empty
+in which case a 'server' rule will always match on all names from
+the server.
+
+e.g.:
+
+  ``:prefix:client:trusted.:user.virtiofs.:``
+
+  will match 'trusted.' attributes in client calls and prefix them before
+  passing them to the server.
+
+  ``:prefix:server::user.virtiofs.:``
+
+  will strip 'user.virtiofs.' from all server replies.
+
+  ``:prefix:all:trusted.:user.virtiofs.:``
+
+  combines the previous two cases into a single rule.
+
+  ``:ok:client:user.::``
+
+  will allow get/set xattr for 'user.' xattr's and ignore
+  following rules.
+
+  ``:ok:server::security.:``
+
+  will pass 'securty.' xattr's in listxattr from the server
+  and ignore following rules.
+
+  ``:ok:all:::``
+
+  will terminate the rule search passing any remaining attributes
+  in both directions.
+
+  ``:bad:server::security.:``
+
+  would hide 'security.' xattr's in listxattr from the server.
+
 Examples
 --------
 
tools/virtiofsd/passthrough_ll.c +173 -0

221 lines not on this page · raw message

Signature · 1 line
2.28.0
#3 lore raw

PATCH v4 2/5 tools/virtiofsd: xattr name mappings: Map client xattr names

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Map xattr names originating at the client; from get/set/remove xattr.

---
 tools/virtiofsd/passthrough_ll.c | 101 ++++++++++++++++++++++++++++++-
 1 file changed, 98 insertions(+), 3 deletions(-)
tools/virtiofsd/passthrough_ll.c +98 -3
index d47fe3db31..ec3ef7b50d 100644
@@ -2176,20 +2176,80 @@ static void parse_xattrmap(struct lo_data *lo)
     }
 }
 
-static void lo_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
+/*
+ * For use with getxattr/setxattr/removexattr, where the client
+ * gives us a name and we may need to choose a different one.
+ * Allocates a buffer for the result placing it in *out_name.
+ *   If there's no change then *out_name is not set.
+ * Returns 0 on success
+ * Can return -EPERM to indicate we block a given attribute
+ *   (in which case out_name is not allocated)
+ * Can return -ENOMEM to indicate out_name couldn't be allocated.
+ */
+static int xattr_map_client(const struct lo_data *lo, const char *client_name,
+                            char **out_name)
+{
+    size_t i;
+    for (i = 0; i < lo->xattr_map_nentries; i++) {
+        const XattrMapEntry *cur_entry = lo->xattr_map_list + i;
+
+        if ((cur_entry->flags & XATTR_MAP_FLAG_CLIENT) &&
+            (strstart(client_name, cur_entry->key, NULL))) {
+            if (cur_entry->flags & XATTR_MAP_FLAG_BAD) {
+                return -EPERM;
+            }
+            if (cur_entry->flags & XATTR_MAP_FLAG_OK) {
+                /* Unmodified name */
+                return 0;
+            }
+            if (cur_entry->flags & XATTR_MAP_FLAG_PREFIX) {
+                *out_name = g_try_malloc(strlen(client_name) +
+                                         strlen(cur_entry->prepend) + 1);
+                if (!*out_name) {
+                    return -ENOMEM;
+                }
+                sprintf(*out_name, "%s%s", cur_entry->prepend, client_name);
+                return 0;
+            }
+        }
+    }
+
+    return -EPERM;
+}
+
+static void lo_getxattr(fuse_req_t req, fuse_ino_t ino, const char *in_name,
                         size_t size)
 {
     struct lo_data *lo = lo_data(req);
     char *value = NULL;
     char procname[64];
+    const char *name;
+    char *mapped_name;
     struct lo_inode *inode;
     ssize_t ret;
     int saverr;
     int fd = -1;
 
+    mapped_name = NULL;
+    name = in_name;
+    if (lo->xattrmap) {
+        ret = xattr_map_client(lo, in_name, &mapped_name);
+        if (ret < 0) {
+            if (ret == -EPERM) {
+                ret = -ENODATA;
+            }
+            fuse_reply_err(req, -ret);
+            return;
+        }
+        if (mapped_name) {
+            name = mapped_name;
+        }
+    }
+
     inode = lo_inode(req, ino);
     if (!inode) {
         fuse_reply_err(req, EBADF);
+        g_free(mapped_name);
         return;
     }
 
@@ -2254,6 +2314,7 @@ out_err:
     saverr = errno;
 out:
     fuse_reply_err(req, saverr);
+    g_free(mapped_name);
     goto out_free;
 }
 
@@ -2331,19 +2392,35 @@ out:
     goto out_free;
 }
 
-static void lo_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
+static void lo_setxattr(fuse_req_t req, fuse_ino_t ino, const char *in_name,
                         const char *value, size_t size, int flags)
 {
     char procname[64];
+    const char *name;
+    char *mapped_name;
     struct lo_data *lo = lo_data(req);
     struct lo_inode *inode;
     ssize_t ret;
     int saverr;
     int fd = -1;
 
+    mapped_name = NULL;
+    name = in_name;
+    if (lo->xattrmap) {
+        ret = xattr_map_client(lo, in_name, &mapped_name);
+        if (ret < 0) {
+            fuse_reply_err(req, -ret);
+            return;
+        }
+        if (mapped_name) {
+            name = mapped_name;
+        }
+    }
+
     inode = lo_inode(req, ino);
     if (!inode) {
         fuse_reply_err(req, EBADF);
+        g_free(mapped_name);
         return;
     }
 
@@ -2378,21 +2455,38 @@ out:
     }
 
     lo_inode_put(lo, &inode);
+    g_free(mapped_name);
     fuse_reply_err(req, saverr);
 }
 
-static void lo_removexattr(fuse_req_t req, fuse_ino_t ino, const char *name)
+static void lo_removexattr(fuse_req_t req, fuse_ino_t ino, const char *in_name)
 {
     char procname[64];
+    const char *name;
+    char *mapped_name;
     struct lo_data *lo = lo_data(req);
     struct lo_inode *inode;
     ssize_t ret;
     int saverr;
     int fd = -1;
 
+    mapped_name = NULL;
+    name = in_name;
+    if (lo->xattrmap) {
+        ret = xattr_map_client(lo, in_name, &mapped_name);
+        if (ret < 0) {
+            fuse_reply_err(req, -ret);
+            return;
+        }
+        if (mapped_name) {
+            name = mapped_name;
+        }
+    }
+
     inode = lo_inode(req, ino);
     if (!inode) {
         fuse_reply_err(req, EBADF);
+        g_free(mapped_name);
         return;
     }
 
@@ -2427,6 +2521,7 @@ out:
     }
 
     lo_inode_put(lo, &inode);
+    g_free(mapped_name);
     fuse_reply_err(req, saverr);
 }
 
Signature · 1 line
2.28.0
#5 lore raw

PATCH v4 3/5 tools/virtiofsd: xattr name mappings: Map server xattr names

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Map xattr names coming from the server, i.e. the host filesystem; currently this is only from listxattr.

---
 tools/virtiofsd/passthrough_ll.c | 90 ++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)
tools/virtiofsd/passthrough_ll.c +90 -0
index ec3ef7b50d..57f584ee49 100644
@@ -2217,6 +2217,44 @@ static int xattr_map_client(const struct lo_data *lo, const char *client_name,
     return -EPERM;
 }
 
+/*
+ * For use with listxattr where the server fs gives us a name and we may need
+ * to sanitize this for the client.
+ * Returns a pointer to the result in *out_name
+ *   This is always the original string or the current string with some prefix
+ *   removed; no reallocation is done.
+ * Returns 0 on success
+ * Can return -ENODATA to indicate the name should be dropped from the list.
+ */
+static int xattr_map_server(const struct lo_data *lo, const char *server_name,
+                            const char **out_name)
+{
+    size_t i;
+    const char *end;
+
+    for (i = 0; i < lo->xattr_map_nentries; i++) {
+        const XattrMapEntry *cur_entry = lo->xattr_map_list + i;
+
+        if ((cur_entry->flags & XATTR_MAP_FLAG_SERVER) &&
+            (strstart(server_name, cur_entry->prepend, &end))) {
+            if (cur_entry->flags & XATTR_MAP_FLAG_BAD) {
+                return -ENODATA;
+            }
+            if (cur_entry->flags & XATTR_MAP_FLAG_OK) {
+                *out_name = server_name;
+                return 0;
+            }
+            if (cur_entry->flags & XATTR_MAP_FLAG_PREFIX) {
+                /* Remove prefix */
+                *out_name = end;
+                return 0;
+            }
+        }
+    }
+
+    return -ENODATA;
+}
+
 static void lo_getxattr(fuse_req_t req, fuse_ino_t ino, const char *in_name,
                         size_t size)
 {
@@ -2371,8 +2409,60 @@ static void lo_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size)
         if (ret == 0) {
             goto out;
         }
+
+        if (lo->xattr_map_list) {
+            /*
+             * Map the names back, some attributes might be dropped,
+             * some shortened, but not increased, so we shouldn't
+             * run out of room.
+             */
+            size_t out_index, in_index;
+            out_index = 0;
+            in_index = 0;
+            while (in_index < ret) {
+                const char *map_out;
+                char *in_ptr = value + in_index;
+                /* Length of current attribute name */
+                size_t in_len = strlen(value + in_index) + 1;
+
+                int mapret = xattr_map_server(lo, in_ptr, &map_out);
+                if (mapret != -ENODATA && mapret != 0) {
+                    /* Shouldn't happen */
+                    saverr = -mapret;
+                    goto out;
+                }
+                if (mapret == 0) {
+                    /* Either unchanged, or truncated */
+                    size_t out_len;
+                    if (map_out != in_ptr) {
+                        /* +1 copies the NIL */
+                        out_len = strlen(map_out) + 1;
+                    } else {
+                        /* No change */
+                        out_len = in_len;
+                    }
+                    /*
+                     * Move result along, may still be needed for an unchanged
+                     * entry if a previous entry was changed.
+                     */
+                    memmove(value + out_index, map_out, out_len);
+
+                    out_index += out_len;
+                }
+                in_index += in_len;
+            }
+            ret = out_index;
+            if (ret == 0) {
+                goto out;
+            }
+        }
         fuse_reply_buf(req, value, ret);
     } else {
+        /*
+         * xattrmap only ever shortens the result,
+         * so we don't need to do anything clever with the
+         * allocation length here.
+         */
         fuse_reply_xattr(req, ret);
     }
 out_free:
Signature · 1 line
2.28.0
#7 lore raw

PATCH v4 4/5 tools/virtiofsd: xattr name mapping examples

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add a few examples of xattrmaps to the documentation.

---
 docs/tools/virtiofsd.rst | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
docs/tools/virtiofsd.rst +50 -0
index 868fa0e97b..4e74690eca 100644
@@ -201,6 +201,56 @@ e.g.:
 
   would hide 'security.' xattr's in listxattr from the server.
 
+xattr-mapping Examples
+----------------------
+
+1) Prefix all attributes with 'user.virtiofs.'
+
+::
+
+-o xattrmap=":prefix:all::user.virtiofs.::bad:all:::"
+
+
+This uses two rules, using : as the field separator;
+the first rule prefixes and strips 'user.virtiofs.',
+the second rule hides any non-prefixed attributes that
+the host set.
+
+2) Prefix 'trusted.' attributes, allow others through
+
+::
+
+   "/prefix/all/trusted./user.virtiofs./
+    /bad/server//trusted./
+    /bad/client/user.virtiofs.//
+    /ok/all///"
+
+
+Here there are four rules, using / as the field
+separator, and also demonstrating that new lines can
+be included between rules.
+The first rule is the prefixing of 'trusted.' and
+stripping of 'user.virtiofs.'.
+The second rule hides unprefixed 'trusted.' attributes
+on the host.
+The third rule stops a guest from explicitly setting
+the 'user.viritofs.' path directly.
+Finally, the fourth rule lets all remaining attributes
+through.
+
+3) Hide 'security.' attributes, and allow everything else
+
+::
+
+    "/bad/all/security./security./
+     /ok/all///'
+
+The first rule combines what could be separate client and server
+rules into a single 'all' rule, matching 'security.' in either
+client arguments or lists returned from the host.  This stops
+the client seeing any 'security.' attributes on the server and
+stops it setting any.
+
 Examples
 --------
 
Signature · 1 line
2.28.0
#10 lore raw

PATCH v4 5/5 tools/virtiofsd: xattr name mappings: Simple 'map'

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The mapping rule system implemented in the last few patches is extremely flexible, but not easy to use. Add a simple 'map' type as a sprinkling of sugar to make it easy.

e.g.

-o xattrmap=":map::user.virtiofs.:"

would be sufficient to prefix all xattr's
or

-o xattrmap=":map:trusted.:user.virtiofs.:"

would just prefix 'trusted.' xattr's and leave
everything else alone.

---
 docs/tools/virtiofsd.rst         |  19 ++++++
 tools/virtiofsd/passthrough_ll.c | 112 ++++++++++++++++++++++++++++++-
 2 files changed, 130 insertions(+), 1 deletion(-)
docs/tools/virtiofsd.rst +19 -0
index 4e74690eca..24268fd67e 100644
@@ -129,6 +129,7 @@ Each rule consists of a number of fields separated with a separator that is the
 first non-white space character in the rule.  This separator must then be used
 for the whole rule.
 White space may be added before and after each rule.
+
 Using ':' as the separator a rule is of the form:
 
 ``:type:scope:key:prepend:``
@@ -201,6 +202,14 @@ e.g.:
 
   would hide 'security.' xattr's in listxattr from the server.
 
+A simpler 'map' type provides a shorter syntax for the common case:
+
+``:map:key:prepend:``
+
+The 'map' type adds a number of separate rules to add **prepend** as a prefix
+to the matched **key** (or all attributes if **key** is empty).
+There may be at most one 'map' rule and it must be the last rule in the set.
+
 xattr-mapping Examples
 ----------------------
 
@@ -216,6 +225,11 @@ the first rule prefixes and strips 'user.virtiofs.',
 the second rule hides any non-prefixed attributes that
 the host set.
 
+This is equivalent to the 'map' rule:
+
+::
+-o xattrmap=":map::user.virtiofs.:"
+
 2) Prefix 'trusted.' attributes, allow others through
 
 ::
@@ -238,6 +252,11 @@ the 'user.viritofs.' path directly.
 Finally, the fourth rule lets all remaining attributes
 through.
 
+This is equivalent to the 'map' rule:
+
+::
+-o xattrmap="/map/trusted./user.virtiofs./"
+
 3) Hide 'security.' attributes, and allow everything else
 
 ::
tools/virtiofsd/passthrough_ll.c +111 -1

127 lines not on this page · raw message

Signature · 1 line
2.28.0
Reviewed-by on v4 1/5
#2 lore raw

Re: [PATCH v4 1/5] tools/virtiofsd: xattr name mappings: Add option

In reply to Dr. David Alan Gilbert (git)
Quoted 15 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add an option to define mappings of xattr names so that the client and server filesystems see different views. This can be used to have different SELinux mappings as seen by the guest, to run the virtiofsd with less privileges (e.g. in a case where it can't set trusted/system/security xattrs but you want the guest to be able to), or to isolate multiple users of the same name; e.g. trusted attributes used by stacking overlayfs.

A mapping engine is used with 3 simple rules; the rules can be combined to allow most useful mapping scenarios. The ruleset is defined by -o xattrmap='rules...'.

Quoted 7 lines

This patch doesn't use the rule maps yet.

---
 docs/tools/virtiofsd.rst         |  92 ++++++++++++++++
 tools/virtiofsd/passthrough_ll.c | 173 +++++++++++++++++++++++++++++++
 2 files changed, 265 insertions(+)
Reviewed-by on v4 2/5
#4 lore raw

Re: [PATCH v4 2/5] tools/virtiofsd: xattr name mappings: Map client xattr names

In reply to Dr. David Alan Gilbert (git)
Quoted 8 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Map xattr names originating at the client; from get/set/remove xattr.

---
 tools/virtiofsd/passthrough_ll.c | 101 ++++++++++++++++++++++++++++++-
 1 file changed, 98 insertions(+), 3 deletions(-)
Reviewed-by on v4 3/5
#6 lore raw

Re: [PATCH v4 3/5] tools/virtiofsd: xattr name mappings: Map server xattr names

In reply to Dr. David Alan Gilbert (git)
Quoted 9 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Map xattr names coming from the server, i.e. the host filesystem; currently this is only from listxattr.

---
 tools/virtiofsd/passthrough_ll.c | 90 ++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)
#8 lore raw

Re: [PATCH v4 4/5] tools/virtiofsd: xattr name mapping examples

In reply to Dr. David Alan Gilbert (git)

docs/tools/virtiofsd.rst e.g.: · line 237

Quoted 2 lines · Dr. David Alan Gilbert (git)
docs/tools/virtiofsd.rst +2 -0
+The third rule stops a guest from explicitly setting
+the 'user.viritofs.' path directly.

s/virito/virtio/

Reviewed-by on v4 5/5
#11 lore raw

Re: [PATCH v4 5/5] tools/virtiofsd: xattr name mappings: Simple 'map'

In reply to Dr. David Alan Gilbert (git)
Quoted 15 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The mapping rule system implemented in the last few patches is extremely flexible, but not easy to use. Add a simple 'map' type as a sprinkling of sugar to make it easy.

e.g.

-o xattrmap=":map::user.virtiofs.:"

would be sufficient to prefix all xattr's
or

-o xattrmap=":map:trusted.:user.virtiofs.:"

Quoted 8 lines

would just prefix 'trusted.' xattr's and leave
everything else alone.

---
 docs/tools/virtiofsd.rst         |  19 ++++++
 tools/virtiofsd/passthrough_ll.c | 112 ++++++++++++++++++++++++++++++-
 2 files changed, 130 insertions(+), 1 deletion(-)
Reviewed-by on the v4 series
#12 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 32 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 4th cut of an xattr name mapping option for virtiofsd. It allows the user of virtiofsd to define a fairly flexible mapping from the view of the xattr names the host fs has and the ones that the guest sees.

The hope is this allows things like:
a) Different selinux attributes on host/guest
b) separation of trusted. attributes that clash on overlayfs
c) support for privileged xattr's in guests running with an unprivileged virtiofsd.

There's no apparent standard for this kind of mapping, so I made it flexible by specifying a mapping rule in the option.

Prefix's can be added (selectively or globally), xattr's can be dropped in either direction or passed through.

v4
cleanups from Stefan and Vivek's reviews

Dave

Dr. David Alan Gilbert (5):
tools/virtiofsd: xattr name mappings: Add option tools/virtiofsd: xattr name mappings: Map client xattr names tools/virtiofsd: xattr name mappings: Map server xattr names tools/virtiofsd: xattr name mapping examples tools/virtiofsd: xattr name mappings: Simple 'map'

Quoted 7 lines
 docs/tools/virtiofsd.rst         | 161 +++++++++++
 tools/virtiofsd/passthrough_ll.c | 474 ++++++++++++++++++++++++++++++-
 2 files changed, 632 insertions(+), 3 deletions(-)
Signature · 1 line
2.28.0
#9 lore raw

Re: [PATCH v4 4/5] tools/virtiofsd: xattr name mapping examples

In reply to Stefan Hajnoczi
Quoted 5 lines · * Stefan Hajnoczi ([email protected]) wrote:

docs/tools/virtiofsd.rst e.g.: · line 237

Quoted 2 lines · Dr. David Alan Gilbert (git)
docs/tools/virtiofsd.rst +2 -0
+The third rule stops a guest from explicitly setting
+the 'user.viritofs.' path directly.

s/virito/virtio/

Thanks!

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#13 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 16 lines · * Dr. David Alan Gilbert (git) ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 4th cut of an xattr name mapping option for virtiofsd. It allows the user of virtiofsd to define a fairly flexible mapping from the view of the xattr names the host fs has and the ones that the guest sees.

The hope is this allows things like:
a) Different selinux attributes on host/guest
b) separation of trusted. attributes that clash on overlayfs
c) support for privileged xattr's in guests running with an unprivileged virtiofsd.

There's no apparent standard for this kind of mapping, so I made it flexible by specifying a mapping rule in the option.

Quoted 7 lines

Prefix's can be added (selectively or globally), xattr's can be dropped in either direction or passed through.

v4
cleanups from Stefan and Vivek's reviews

Dave

Queued

Quoted 17 lines

Dr. David Alan Gilbert (5):
tools/virtiofsd: xattr name mappings: Add option tools/virtiofsd: xattr name mappings: Map client xattr names tools/virtiofsd: xattr name mappings: Map server xattr names tools/virtiofsd: xattr name mapping examples tools/virtiofsd: xattr name mappings: Simple 'map'

 docs/tools/virtiofsd.rst         | 161 +++++++++++
 tools/virtiofsd/passthrough_ll.c | 474 ++++++++++++++++++++++++++++++-
 2 files changed, 632 insertions(+), 3 deletions(-)
Signature · 1 line
2.28.0
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK