ovl: metacopy/verity fixes and improvements
Subsystems (4)
v2 cover ovl: metacopy/verity fixes and improvements
The main purpose of this patchset is allowing metadata/data-only layers to be usable in user namespaces (without super user privs).
v2:
- drop broken hunk in param.c (Amir)
- patch header improvements (Amir)
---
Giuseppe Scrivano (1):
ovl: remove unused forward declaration
Miklos Szeredi (4):
ovl: don't allow datadir only
ovl: make redirect/metacopy rejection consistent
ovl: relax redirect/metacopy requirements for lower -> data redirect
ovl: don't require "metacopy=on" for "verity"
Documentation/filesystems/overlayfs.rst | 7 +++ fs/overlayfs/namei.c | 77 ++++++++++++++++--------- fs/overlayfs/overlayfs.h | 2 - fs/overlayfs/params.c | 16 +---- fs/overlayfs/super.c | 5 ++ 5 files changed, 66 insertions(+), 41 deletions(-)
Signature · 1 line
2.49.0
PATCH v2 1/5 ovl: don't allow datadir only
In theory overlayfs could support upper layer directly referring to a data layer, but there's no current use case for this.
Originally, when data-only layers were introduced, this wasn't allowed, only introduced by the "datadir+" feature, but without actually handling this case, resulting in an Oops.
Fix by disallowing datadir without lowerdir.
--- fs/overlayfs/super.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/overlayfs/super.c +5 -0
@@ -1137,6 +1137,11 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,return ERR_PTR (-EINVAL ); } +if (ctx->nr == ctx->nr_data) { +pr_err ("at least one non-data lowerdir is required\n" ); +return ERR_PTR (-EINVAL ); + } + err = -EINVAL ;for (i =0 ; i < ctx->nr; i++) { l = &ctx->lower[i];
Signature · 1 line
2.49.0
Re: [PATCH v2 1/5] ovl: don't allow datadir only
Quoted 10 lines · Miklos Szeredi
In theory overlayfs could support upper layer directly referring to a data
layer, but there's no current use case for this.Originally, when data-only layers were introduced, this wasn't allowed,
only introduced by the "datadir+" feature, but without actually handling
this case, resulting in an Oops.
Quoted 8 lines
Fix by disallowing datadir without lowerdir.
Reported-by Giuseppe Scrivano <[email protected]>Fixes 24e16e385f22 ("ovl: add support for appending lowerdirs one byone")
Cc <[email protected]> # v6.7Reviewed-by Amir Goldstein <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>
Quoted 12 lines
return
ERR_PTR(-EINVAL);
}(quoted diff) +2
-0+ if (ctx->nr == ctx->nr_data) { + pr_err("at least one non-data lowerdir isrequired\n");
fs/overlayfs/super.c +3
-0+return ERR_PTR (-EINVAL ); + } +err =
-EINVAL;
for (i = 0; i <ctx->nr; i++) {
l = &ctx->lower[i];
Signature · 9 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's an obese crooked filmmaker trapped in a world he never made. She's
a
provocative red-headed stripper from a different time and place. They
fight crime! Re: [PATCH v2 1/5] ovl: don't allow datadir only
In reply to Miklos SzerediQuoted 7 lines · Miklos Szeredi
In theory overlayfs could support upper layer directly referring to a data layer, but there's no current use case for this.
Originally, when data-only layers were introduced, this wasn't allowed, only introduced by the "datadir+" feature, but without actually handling this case, resulting in an Oops.
Quoted 8 lines
Fix by disallowing datadir without lowerdir.
Reported-by Giuseppe Scrivano <[email protected]>Fixes 24e16e385f22 ("ovl: add support for appending lowerdirs one by one")Cc <[email protected]> # v6.7Reviewed-by Amir Goldstein <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>---
PATCH v2 2/5 ovl: remove unused forward declaration
In reply to Miklos SzerediFrom: Giuseppe Scrivano <[email protected]>
The ovl_get_verity_xattr() function was never added, only its declaration.
--- fs/overlayfs/overlayfs.h | 2 -- 1 file changed, 2 deletions(-)
fs/overlayfs/overlayfs.h +0 -2
@@ -540,8 +540,6 @@ int ovl_set_metacopy_xattr(struct ovl_fs *ofs, struct dentry *d,bool ovl_is_metacopy_dentry (struct dentry *dentry);char *ovl_get_redirect_xattr (struct ovl_fs *ofs,const struct path *path,int padding);int ovl_ensure_verity_loaded (struct path *path); -int ovl_get_verity_xattr (struct ovl_fs *ofs,const struct path *path, -u8 *digest_buf,int *buf_length);int ovl_validate_verity (struct ovl_fs *ofs,struct path *metapath,struct path *datapath);
Signature · 1 line
2.49.0
Re: [PATCH v2 2/5] ovl: remove unused forward declaration
Quoted 10 lines · Miklos Szeredi
From: Giuseppe Scrivano <[email protected]>
The
ovl_get_verity_xattr()function was never added, only its declaration.Signed-off-by Giuseppe Scrivano <[email protected]>Fixes 184996e92e86 ("ovl: Validate verity xattr when resolvinglowerdata")
Reviewed-by Amir Goldstein <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>
Quoted 18 lines
1 file changed, 2 deletions(-)fs/overlayfs/overlayfs.h +0
-0@@ -540,8 +540,6 @@ int ovl_set_metacopy_xattr(struct ovl_fs *ofs,struct dentry *d, bool ovl_is_metacopy_dentry(struct dentry *dentry);char *ovl_get_redirect_xattr(struct
ovl_fs*ofs, const struct path *path, int padding);
intovl_ensure_verity_loaded(struct path *path);
-int ovl_get_verity_xattr(structovl_fs*ofs, const struct path *path,fs/overlayfs/overlayfs.h +0
-1- u8 *digest_buf, int *buf_length);int ovl_validate_verity(struct
ovl_fs*ofs,
struct path *metapath,
struct path *datapath);
Signature · 9 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's a deeply religious vegetarian gentleman spy in drag. She's a
pregnant renegade politician on the trail of a serial killer. They
fight
crime! Re: [PATCH v2 2/5] ovl: remove unused forward declaration
In reply to Miklos SzerediQuoted 9 lines · Miklos Szeredi
From: Giuseppe Scrivano <[email protected]>
The
ovl_get_verity_xattr()function was never added, only its declaration.Signed-off-by Giuseppe Scrivano <[email protected]>Fixes 184996e92e86 ("ovl: Validate verity xattr when resolving lowerdata")Reviewed-by Amir Goldstein <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>---
PATCH v2 3/5 ovl: make redirect/metacopy rejection consistent
In reply to Miklos SzerediWhen overlayfs finds a file with metacopy and/or redirect attributes and the metacopy and/or redirect features are not enabled, then it refuses to act on those attributes while also issuing a warning.
There was a slight inconsistency of only warning on an upper metacopy if it found the next file on the lower layer, while always warning for metacopy found on a lower layer.
Fix this inconsistency and make the logic more straightforward, paving the way for following patches to change when dataredirects are allowed.
--- fs/overlayfs/namei.c | 67 +++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 23 deletions(-)
fs/overlayfs/namei.c +44 -23
@@ -1040,6 +1040,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,struct inode *inode =NULL ;bool upperopaque = false;char *upperredirect =NULL ; +bool nextredirect = false; +bool nextmetacopy = false;struct dentry *this;unsigned int i;int err;
@@ -1087,8 +1089,10 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,if (err) goto out_put_upper; -if (d.metacopy) +if (d.metacopy) { uppermetacopy = true; + nextmetacopy = true; + } metacopy_size = d.metacopy; }
@@ -1099,6 +1103,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, goto out_put_upper;if (d.redirect[0 ] =='/' ) poe = roe; + nextredirect = true; } upperopaque = d.opaque; }
@@ -1113,6 +1118,29 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,for (i =0 ; !d.stop && i <ovl_numlower (poe); i++) {struct ovl_path lower =ovl_lowerstack (poe)[i]; +/* +* Following redirects/metacopy can have security consequences: +* it's like a symlink into the lower layer without the +* permission checks. +* +* This is only a problem if the upper layer is untrusted (e.g +* comes from an USB drive). This can allow a non-readable file +* or directory to become readable. +* +* Only following redirects when redirects are enabled disables +* this attack vector when not necessary. +*/ +if (nextmetacopy && !ofs->config.metacopy) { +pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { +pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (!ovl_redirect_follow (ofs)) d.last = i ==ovl_numlower (poe) -1 ;else if (d.is_dir || !ofs->numdatalayer)
@@ -1126,12 +1154,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,if (!this)continue ; -if ((uppermetacopy || d.metacopy) && !ofs->config.metacopy) { -dput (this); - err = -EPERM ; -pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); - goto out_put; - } +if (d.metacopy) + nextmetacopy = true;/* * If no origin fh is stored in upper of a merge dir, store fh
@@ -1185,22 +1209,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, ctr++; } -/* -* Following redirects can have security consequences: it's like -* a symlink into the lower layer without the permission checks. -* This is only a problem if the upper layer is untrusted (e.g -* comes from an USB drive). This can allow a non-readable file -* or directory to become readable. -* -* Only following redirects when redirects are enabled disables -* this attack vector when not necessary. -*/ - err = -EPERM ; -if (d.redirect && !ovl_redirect_follow (ofs)) { -pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , - dentry); - goto out_put; - } +if (d.redirect) + nextredirect = true;if (d.stop)break ;
@@ -1218,6 +1228,17 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, ctr++; } +if (nextmetacopy && !ofs->config.metacopy) { +pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { +pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +/* * For regular non-metacopy upper dentries, there is no lower * path based lookup, hence ctr will be zero. If a dentry is found
Signature · 1 line
2.49.0
Re: [PATCH v2 3/5] ovl: make redirect/metacopy rejection consistent
Quoted 5 lines · Miklos Szeredi
When overlayfs finds a file with metacopy and/or redirect attributes and the metacopy and/or redirect features are not enabled, then it refuses to act on those attributes while also issuing a warning.
Quoted 8 lines
There was a slight inconsistency of only warning on an upper metacopy if it found the next file on the lower layer, while always warning for metacopy found on a lower layer.
Fix this inconsistency and make the logic more straightforward, paving the way for following patches to change when dataredirects are allowed.
Signed-off-by Miklos Szeredi <[email protected]>
Quoted 128 lines
--- fs/overlayfs/namei.c | 67 +++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 23 deletions(-)fs/overlayfs/namei.c +44
-24@@ -1040,6 +1040,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,struct inode *inode =NULL ;bool upperopaque = false;char *upperredirect =NULL ; +bool nextredirect = false; +bool nextmetacopy = false;struct dentry *this;unsigned int i;int err;@@ -1087,8 +1089,10 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,if (err) goto out_put_upper; -if (d.metacopy) +if (d.metacopy) { uppermetacopy = true; + nextmetacopy = true; + } metacopy_size = d.metacopy; }@@ -1099,6 +1103,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, goto out_put_upper;if (d.redirect[0 ] =='/' ) poe = roe; + nextredirect = true; } upperopaque = d.opaque; }@@ -1113,6 +1118,29 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,for (i =0 ; !d.stop && i <ovl_numlower (poe); i++) {struct ovl_path lower =ovl_lowerstack (poe)[i]; +/* +* Following redirects/metacopy can have security consequences: +* it's like a symlink into the lower layer without the +* permission checks. +* +* This is only a problem if the upper layer is untrusted (e.g +* comes from an USB drive). This can allow a non-readable file +* or directory to become readable. +* +* Only following redirects when redirects are enabled disables +* this attack vector when not necessary. +*/ +if (nextmetacopy && !ofs->config.metacopy) { +pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { +pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (!ovl_redirect_follow (ofs)) d.last = i ==ovl_numlower (poe) -1 ;else if (d.is_dir || !ofs->numdatalayer)@@ -1126,12 +1154,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,if (!this)continue ; -if ((uppermetacopy || d.metacopy) && !ofs->config.metacopy) { -dput (this); - err = -EPERM ; -pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); - goto out_put; - } +if (d.metacopy) + nextmetacopy = true;/* * If no origin fh is stored in upper of a merge dir, store fh @@ -1185,22 +1209,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, ctr++; } -/* -* Following redirects can have security consequences: it's like -* a symlink into the lower layer without the permission checks. -* This is only a problem if the upper layer is untrusted (e.g -* comes from an USB drive). This can allow a non-readable file -* or directory to become readable. -* -* Only following redirects when redirects are enabled disables -* this attack vector when not necessary. -*/ - err = -EPERM ; -if (d.redirect && !ovl_redirect_follow (ofs)) { -pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , - dentry); - goto out_put; - } +if (d.redirect) + nextredirect = true;if (d.stop)break ;@@ -1218,6 +1228,17 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, ctr++; } +if (nextmetacopy && !ofs->config.metacopy) { +pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { +pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +/* * For regular non-metacopy upper dentries, there is no lower * path based lookup, hence ctr will be zero. If a dentry is found -- 2.49.0
Re: [PATCH v2 3/5] ovl: make redirect/metacopy rejection consistent
In reply to Miklos SzerediQuoted 12 lines · Miklos Szeredi
When overlayfs finds a file with metacopy and/or redirect attributes and
the metacopy and/or redirect features are not enabled, then it refuses to
act on those attributes while also issuing a warning.There was a slight inconsistency of only warning on an upper metacopy if it
found the next file on the lower layer, while always warning for metacopy
found on a lower layer.
Quoted 5 lines
Fix this inconsistency and make the logic more straightforward, paving the
way for following patches to change when dataredirects are allowed.Signed-off-by Miklos Szeredi <[email protected]>
Quoted 153 lines
---
fs/overlayfs/namei.c | 67 +++++++++++++++++++++++++++++------------- --1 file changed, 44 insertions(+), 23 deletions(-)fs/overlayfs/namei.c +2
-0@@ -1040,6 +1040,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, struct inode *inode = NULL; bool upperopaque = false; char *upperredirect = NULL; +bool nextredirect = false; +bool nextmetacopy = false; struct dentry *this; unsigned int i;int err;
fs/overlayfs/namei.c +0
-0@@ -1087,8 +1089,10 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, if (err) goto out_put_upper;fs/overlayfs/namei.c +1
-1-if (d.metacopy) +if (d.metacopy) {uppermetacopy = true;
fs/overlayfs/namei.c +2
-0+ nextmetacopy = true; + }
metacopy_size= d.metacopy; }fs/overlayfs/namei.c +1
-0@@ -1099,6 +1103,7 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, goto out_put_upper; if (d.redirect[0] == '/') poe = roe; + nextredirect = true; } upperopaque = d.opaque;}
fs/overlayfs/namei.c +0
-0@@ -1113,6 +1118,29 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, for (i = 0; !d.stop && i < ovl_numlower(poe); i++) { struct ovl_path lower = ovl_lowerstack(poe)[i];fs/overlayfs/namei.c +2
-0+/* +* Following redirects/metacopy can have security consequences:
fs/overlayfs/namei.c +1
-0+* it's like a symlink into the lower layer without the
fs/overlayfs/namei.c +3
-0+* permission checks. +* +* This is only a problem if the upper layer is untrusted (e.g
fs/overlayfs/namei.c +1
-0+* comes from an USB drive). This can allow a non- readable file
fs/overlayfs/namei.c +3
-0+* or directory to become readable. +* +* Only following redirects when redirects are enabled disables
fs/overlayfs/namei.c +4
-0+* this attack vector when not necessary. +*/ +if (nextmetacopy && !ofs->config.metacopy) { + pr_warn_ratelimited("refusing to followmetacopy origin for (%pd2)\n", dentry);
fs/overlayfs/namei.c +5
-0+ err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { + pr_warn_ratelimited("refusing to followredirect for (%pd2)\n", dentry);
fs/overlayfs/namei.c +4
-0+ err = -EPERM ; + goto out_put; + } +if (!ovl_redirect_follow(ofs)) d.last = i ==
ovl_numlower(poe)- 1; else if (d.is_dir || !ofs->numdatalayer)fs/overlayfs/namei.c +0
-0@@ -1126,12 +1154,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, if (!this) continue;fs/overlayfs/namei.c +0
-1- if ((uppermetacopy || d.metacopy) && !ofs-Quoted 1 line
config.metacopy) {
fs/overlayfs/namei.c +0
-3-dput (this); - err = -EPERM ; - pr_warn_ratelimited("refusing to followmetacopy origin for (%pd2)\n", dentry);
fs/overlayfs/namei.c +2
-2- goto out_put; - } +if (d.metacopy) + nextmetacopy = true;
/*
* If no origin fh is stored in upper of a merge dir, store fhfs/overlayfs/namei.c +0
-0@@ -1185,22 +1209,8 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, ctr++; }fs/overlayfs/namei.c +0
-2-/* -* Following redirects can have security consequences: it's like
fs/overlayfs/namei.c +0
-1-* a symlink into the lower layer without the permission checks.
fs/overlayfs/namei.c +0
-1-* This is only a problem if the upper layer is untrusted (e.g
fs/overlayfs/namei.c +0
-1-* comes from an USB drive). This can allow a non- readable file
fs/overlayfs/namei.c +0
-3-* or directory to become readable. -* -* Only following redirects when redirects are enabled disables
fs/overlayfs/namei.c +0
-5-* this attack vector when not necessary. -*/ - err = -EPERM ; -if (d.redirect && !ovl_redirect_follow (ofs)) { - pr_warn_ratelimited("refusing to followredirect for (%pd2)\n",
fs/overlayfs/namei.c +2
-3- dentry); - goto out_put; - } +if (d.redirect) + nextredirect = true;
if (d.stop)
break;fs/overlayfs/namei.c +0
-0@@ -1218,6 +1228,17 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, ctr++; }fs/overlayfs/namei.c +2
-0+if (nextmetacopy && !ofs->config.metacopy) { + pr_warn_ratelimited("refusing to follow metacopyorigin for (%pd2)\n", dentry);
fs/overlayfs/namei.c +5
-0+ err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { + pr_warn_ratelimited("refusing to follow redirect for(%pd2)\n", dentry);
fs/overlayfs/namei.c +4
-0+ err = -EPERM ; + goto out_put; + } +/*
* For regular non-metacopy upper dentries, there is no lower
* path based lookup, hence ctr will be zero. If a dentry is found
Signature · 8 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's a witless guerilla astronaut with a mysterious suitcase handcuffed
to his arm. She's a mistrustful communist journalist with an incredible
destiny. They fight crime! PATCH v2 4/5 ovl: relax redirect/metacopy requirements for lower -> data redirect
In reply to Miklos SzerediAllow the special case of a redirect from a lower layer to a data layer without having to turn on metacopy. This makes the feature work with userxattr, which in turn allows data layers to be usable in user namespaces.
Minimize the risk by only enabling redirect from a single lower layer to a data layer iff a data layer is specified. The only way to access a data layer is to enable this, so there's really no reason no to enable this.
This can be used safely if the lower layer is read-only and the user.overlay.redirect xattr cannot be modified.
--- Documentation/filesystems/overlayfs.rst | 7 ++++++ fs/overlayfs/namei.c | 32 ++++++++++++++----------- fs/overlayfs/params.c | 5 ---- 3 files changed, 25 insertions(+), 19 deletions(-)
Documentation/filesystems/overlayfs.rst +7 -0
@@ -429,6 +429,13 @@ Only the data of the files in the "data-only" lower layers may be visible when a "metacopy" file in one of the lower layers above it, has a "redirect" to the absolute path of the "lower data" file in the "data-only" lower layer. +Instead of explicitly enabling "metacopy=on" it is sufficient to specify at +least one data-only layer to enable redirection of data to a data-only layer. +In this case other forms of metacopy are rejected. Note: this way data-only +layers may be used toghether with "userxattr", in which case careful attention +must be given to privileges needed to change the "user.overlay.redirect" xattr +to prevent misuse. + Since kernel version v6.8, "data-only" lower layers can also be added using the "datadir+" mount options and the fsconfig syscall from new mount api. For example::
fs/overlayfs/namei.c +18 -14
@@ -1042,6 +1042,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,char *upperredirect =NULL ;bool nextredirect = false;bool nextmetacopy = false; +bool check_redirect = (ovl_redirect_follow (ofs) || ofs->numdatalayer);struct dentry *this;unsigned int i;int err;
@@ -1053,7 +1054,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, .is_dir = false, .opaque = false, .stop = false, - .last = ovl_redirect_follow(ofs) ? false : !ovl_numlower(poe), + .last = check_redirect ? false : !ovl_numlower(poe), .redirect = NULL, .metacopy = 0, };
@@ -1141,7 +1142,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, goto out_put; } -if (!ovl_redirect_follow (ofs)) +if (!check_redirect) d.last = i ==ovl_numlower (poe) -1 ;else if (d.is_dir || !ofs->numdatalayer) d.last = lower.layer->idx ==ovl_numlower (roe);
@@ -1222,21 +1223,24 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, } } -/* Defer lookup of lowerdata in data-only layers to first access */ +/* +* Defer lookup of lowerdata in data-only layers to first access. +* Don't require redirect=follow and metacopy=on in this case. +*/ if (d.metacopy && ctr && ofs->numdatalayer && d.absolute_redirect) { d.metacopy =0 ; ctr++; - } - -if (nextmetacopy && !ofs->config.metacopy) { -pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); - err = -EPERM ; - goto out_put; - } -if (nextredirect && !ovl_redirect_follow (ofs)) { -pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); - err = -EPERM ; - goto out_put; + }else { +if (nextmetacopy && !ofs->config.metacopy) { +pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { +pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } }/*
fs/overlayfs/params.c +0 -5
@@ -1000,11 +1000,6 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,*/ } -if (ctx->nr_data >0 && !config->metacopy) { -pr_err ("lower data-only dirs require metacopy support.\n" ); -return -EINVAL ; - } -return 0 ; }
Signature · 1 line
2.49.0
Re: [PATCH v2 4/5] ovl: relax redirect/metacopy requirements for lower -> data redirect
Quoted 6 lines · Miklos Szeredi
Allow the special case of a redirect from a lower layer to a data layer without having to turn on metacopy. This makes the feature work with userxattr, which in turn allows data layers to be usable in user namespaces.
Quoted 8 lines
Minimize the risk by only enabling redirect from a single lower layer to a data layer iff a data layer is specified. The only way to access a data layer is to enable this, so there's really no reason no to enable this.
This can be used safely if the lower layer is read-only and the user.overlay.redirect xattr cannot be modified.
Signed-off-by Miklos Szeredi <[email protected]>
Quoted 110 lines
--- Documentation/filesystems/overlayfs.rst | 7 ++++++ fs/overlayfs/namei.c | 32 ++++++++++++++----------- fs/overlayfs/params.c | 5 ---- 3 files changed, 25 insertions(+), 19 deletions(-)Documentation/filesystems/overlayfs.rst +7
-0@@ -429,6 +429,13 @@ Only the data of the files in the "data-only" lower layers may be visible when a "metacopy" file in one of the lower layers above it, has a "redirect" to the absolute path of the "lower data" file in the "data-only" lower layer. +Instead of explicitly enabling "metacopy=on" it is sufficient to specify at +least one data-only layer to enable redirection of data to a data-only layer. +In this case other forms of metacopy are rejected. Note: this way data-only +layers may be used toghether with "userxattr", in which case careful attention +must be given to privileges needed to change the "user.overlay.redirect" xattr +to prevent misuse. + Since kernel version v6.8, "data-only" lower layers can also be added using the "datadir+" mount options and the fsconfig syscall from new mount api. For example::fs/overlayfs/namei.c +18
-14@@ -1042,6 +1042,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,char *upperredirect =NULL ;bool nextredirect = false;bool nextmetacopy = false; +bool check_redirect = (ovl_redirect_follow (ofs) || ofs->numdatalayer);struct dentry *this;unsigned int i;int err;@@ -1053,7 +1054,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, .is_dir = false, .opaque = false, .stop = false, - .last = ovl_redirect_follow(ofs) ? false : !ovl_numlower(poe), + .last = check_redirect ? false : !ovl_numlower(poe), .redirect = NULL, .metacopy = 0, };@@ -1141,7 +1142,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, goto out_put; } -if (!ovl_redirect_follow (ofs)) +if (!check_redirect) d.last = i ==ovl_numlower (poe) -1 ;else if (d.is_dir || !ofs->numdatalayer) d.last = lower.layer->idx ==ovl_numlower (roe);@@ -1222,21 +1223,24 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, } } -/* Defer lookup of lowerdata in data-only layers to first access */ +/* +* Defer lookup of lowerdata in data-only layers to first access. +* Don't require redirect=follow and metacopy=on in this case. +*/ if (d.metacopy && ctr && ofs->numdatalayer && d.absolute_redirect) { d.metacopy =0 ; ctr++; - } - -if (nextmetacopy && !ofs->config.metacopy) { -pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); - err = -EPERM ; - goto out_put; - } -if (nextredirect && !ovl_redirect_follow (ofs)) { -pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); - err = -EPERM ; - goto out_put; + }else { +if (nextmetacopy && !ofs->config.metacopy) { +pr_warn_ratelimited ("refusing to follow metacopy origin for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { +pr_warn_ratelimited ("refusing to follow redirect for (%pd2)\n" , dentry); + err = -EPERM ; + goto out_put; + } }/* fs/overlayfs/params.c +0
-6@@ -1000,11 +1000,6 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,*/ } -if (ctx->nr_data >0 && !config->metacopy) { -pr_err ("lower data-only dirs require metacopy support.\n" ); -return -EINVAL ; - } -return 0 ; } --2.49.0
Re: [PATCH v2 4/5] ovl: relax redirect/metacopy requirements for lower -> data redirect
In reply to Miklos SzerediQuoted 13 lines · Miklos Szeredi
Allow the special case of a redirect from a lower layer to a data layer
without having to turn on metacopy. This makes the feature work with userxattr, which in turn allows data layers to be usable in user namespaces.Minimize the risk by only enabling redirect from a single lower layer to a
data layer iff a data layer is specified. The only way to access a data
layer is to enable this, so there's really no reason no to enable this.
Quoted 4 lines
This can be used safely if the lower layer is read-only and the user.overlay.redirect xattr cannot be modified.
Signed-off-by Miklos Szeredi <[email protected]>
Quoted 136 lines
---
Documentation/filesystems/overlayfs.rst | 7 ++++++ fs/overlayfs/namei.c | 32 ++++++++++++++--------- --
fs/overlayfs/params.c | 5 ----3 files changed, 25 insertions(+), 19 deletions(-)Documentation/filesystems/overlayfs.rst +0
-0@@ -429,6 +429,13 @@ Only the data of the files in the "data-only"lower layers may be visible
when a "metacopy" file in one of the lower layers above it, has a "redirect"
to the absolute path of the "lower data" file in the "data-only" lower layer.
+Instead of explicitly enabling "metacopy=on" it is sufficient to specify at
+least one data-only layer to enable redirection of data to a data- only layer.
+In this case other forms of metacopy are rejected. Note: this way data-only
+layers may be used toghether with "userxattr", in which case careful attention
+must be given to privileges needed to change the "user.overlay.redirect" xattrDocumentation/filesystems/overlayfs.rst +2
-0+to prevent misuse. +Since kernel version v6.8, "data-only" lower layers can also be added using
the "datadir+" mount options and the fsconfig syscall from new mount api.
For example::fs/overlayfs/namei.c +1
-0@@ -1042,6 +1042,7 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, char *upperredirect = NULL; bool nextredirect = false; bool nextmetacopy = false; +bool check_redirect = (ovl_redirect_follow (ofs) || ofs- >numdatalayer); struct dentry *this;unsigned int i;
int err;fs/overlayfs/namei.c +1
-1@@ -1053,7 +1054,7 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, .is_dir = false, .opaque = false, .stop = false, - .last = ovl_redirect_follow(ofs) ? false : !ovl_numlower(poe), + .last = check_redirect ? false : !ovl_numlower(poe), .redirect = NULL,.metacopy = 0,
};fs/overlayfs/namei.c +0
-0@@ -1141,7 +1142,7 @@ struct dentry *ovl_lookup(struct inode *dir,struct dentry *dentry, goto out_put; }fs/overlayfs/namei.c +1
-1-if (!ovl_redirect_follow (ofs)) +if (!check_redirect)d.last = i ==
ovl_numlower(poe)- 1; else if (d.is_dir || !ofs->numdatalayer) d.last =lower.layer->idx==ovl_numlower(roe);fs/overlayfs/namei.c +0
-0@@ -1222,21 +1223,24 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, } }fs/overlayfs/namei.c +0
-1-/* Defer lookup of lowerdata in data-only layers to first access */
fs/overlayfs/namei.c +2
-0+/* +* Defer lookup of lowerdata in data-only layers to first access.
fs/overlayfs/namei.c +1
-0+* Don't require redirect=follow and metacopy=on in this case.
fs/overlayfs/namei.c +1
-0+*/ if (d.metacopy && ctr &&
ofs->numdatalayer&& d.absolute_redirect) {
d.metacopy = 0;
ctr++;fs/overlayfs/namei.c +0
-4- } - -if (nextmetacopy && !ofs->config.metacopy) { - pr_warn_ratelimited("refusing to follow metacopyorigin for (%pd2)\n", dentry);
fs/overlayfs/namei.c +0
-5- err = -EPERM ; - goto out_put; - } -if (nextredirect && !ovl_redirect_follow (ofs)) { - pr_warn_ratelimited("refusing to follow redirect for(%pd2)\n", dentry);
fs/overlayfs/namei.c +3
-2- err = -EPERM ; - goto out_put; + }else { +if (nextmetacopy && !ofs->config.metacopy) { + pr_warn_ratelimited("refusing to followmetacopy origin for (%pd2)\n", dentry);
fs/overlayfs/namei.c +5
-0+ err = -EPERM ; + goto out_put; + } +if (nextredirect && !ovl_redirect_follow (ofs)) { + pr_warn_ratelimited("refusing to followredirect for (%pd2)\n", dentry);
fs/overlayfs/namei.c +3
-0+ err = -EPERM ; + goto out_put; + }}
/*fs/overlayfs/params.c +0
-0@@ -1000,11 +1000,6 @@ int ovl_fs_params_verify(const structovl_fs_context *ctx, */ }fs/overlayfs/params.c +0
-2-if (ctx->nr_data >0 && !config->metacopy) { - pr_err("lower data-only dirs require metacopysupport.\n");
fs/overlayfs/params.c +0
-3-return -EINVAL ; - } -return 0;
}
Signature · 10 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's a one-legged overambitious farmboy who hides his scarred face
behind
a mask. She's a psychotic communist mercenary who don't take no shit
from
nobody. They fight crime! PATCH v2 5/5 ovl: don't require "metacopy=on" for "verity"
In reply to Miklos SzerediAllow the "verity" mount option to be used with "userxattr" data-only layer(s).
Previous patches made sure that with "userxattr" metacopy only works in the lower -> data scenario.
In this scenario the lower (metadata) layer must be secured against tampering, in which case the verity checksums contained in this layer can ensure integrity of data even in the case of an untrusted data layer.
--- fs/overlayfs/params.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
fs/overlayfs/params.c +3 -8
@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx, config->uuid =OVL_UUID_NULL ; } -/* Resolve verity -> metacopy dependency */ -if (config->verity_mode && !config->metacopy) { +/* Resolve verity -> metacopy dependency (unless used with userxattr) */ +if (config->verity_mode && !config->metacopy && !config->userxattr) {/* Don't allow explicit specified conflicting combinations */ if (set.metacopy) { pr_err("conflicting options: metacopy=off,verity=%s\n",
@@ -945,7 +945,7 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx, } -/* Resolve userxattr -> !redirect && !metacopy && !verity dependency */ +/* Resolve userxattr -> !redirect && !metacopy dependency */ if (config->userxattr) {if (set.redirect && config->redirect_mode !=OVL_REDIRECT_NOFOLLOW ) {
@@ -957,11 +957,6 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,pr_err ("conflicting options: userxattr,metacopy=on\n" );return -EINVAL ; } -if (config->verity_mode) { -pr_err ("conflicting options: userxattr,verity=%s\n" , -ovl_verity_mode (config)); -return -EINVAL ; - }/* * Silently disable default setting of redirect and metacopy. * This shall be the default in the future as well: these
Signature · 1 line
2.49.0
Amir Goldstein
maintainerRe: [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity"
Quoted 21 lines · Miklos Szeredi
Allow the "verity" mount option to be used with "userxattr" data-only layer(s).
Previous patches made sure that with "userxattr" metacopy only works in the lower -> data scenario.
In this scenario the lower (metadata) layer must be secured against tampering, in which case the verity checksums contained in this layer can ensure integrity of data even in the case of an untrusted data layer.
Signed-off-by Miklos Szeredi <[email protected]>--- fs/overlayfs/params.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)fs/overlayfs/params.c +0
-0
fs/overlayfs/params.c int ovl_fs_params_verify(const struct ovl_fs_context *ctx, · line 850
Quoted 7 lines
fs/overlayfs/params.c +2
-2@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx, config->uuid =OVL_UUID_NULL ; } -/* Resolve verity -> metacopy dependency */ -if (config->verity_mode && !config->metacopy) { +/* Resolve verity -> metacopy dependency (unless used with userxattr) */ +if (config->verity_mode && !config->metacopy && !config->userxattr) {
This is very un-intuitive to me.
Why do we need to keep the dependency verity -> metacopy with trusted xattrs?
Anyway, I'd like an ACK from composefs guys on this change.
Thanks,
Amir.
Amir Goldstein
maintainerRe: [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity"
Quoted 33 lines · Amir Goldstein
Quoted 21 lines · Miklos Szeredi
Allow the "verity" mount option to be used with "userxattr" data-only layer(s).
Previous patches made sure that with "userxattr" metacopy only works in the lower -> data scenario.
In this scenario the lower (metadata) layer must be secured against tampering, in which case the verity checksums contained in this layer can ensure integrity of data even in the case of an untrusted data layer.
Signed-off-by Miklos Szeredi <[email protected]>--- fs/overlayfs/params.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)fs/overlayfs/params.c +0
-0fs/overlayfs/params.c int ovl_fs_params_verify(const struct ovl_fs_context *ctx, · line 850
Quoted 7 lines
fs/overlayfs/params.c +2
-2@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx, config->uuid =OVL_UUID_NULL ; } -/* Resolve verity -> metacopy dependency */ -if (config->verity_mode && !config->metacopy) { +/* Resolve verity -> metacopy dependency (unless used with userxattr) */ +if (config->verity_mode && !config->metacopy && !config->userxattr) {This is very un-intuitive to me.
Quoted 3 lines
Why do we need to keep the dependency verity -> metacopy with trusted xattrs?
Anyway, I'd like an ACK from composefs guys on this change.
What do you guys think about disallowing the relaxed OVL_VERITY_ON mode in case of !metacopy or in case of userxattr?
I am not sure if it makes any sense wrt security, but if user is putting their trust on the lower layer's immutable content, it feels like this content should include the verity digests???
Thanks,
Amir.
Re: [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity"
Quoted 49 lines · Amir Goldstein
Quoted 38 lines · Amir Goldstein
Quoted 35 lines · Miklos Szeredi
Allow the "verity" mount option to be used with "userxattr" data- only
layer(s).Previous patches made sure that with "userxattr" metacopy only works in the
lower -> data scenario.In this scenario the lower (metadata) layer must be secured against
tampering, in which case the verity checksums contained in this layer can
ensure integrity of data even in the case of an untrusted data layer.Signed-off-by Miklos Szeredi <[email protected]>---
fs/overlayfs/params.c | 11 +++--------1 file changed, 3 insertions(+), 8 deletions(-)fs/overlayfs/params.c +1
-2@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const structovl_fs_context *ctx, config->uuid = OVL_UUID_NULL; } - /* Resolve verity -> metacopy dependency */ - if (config->verity_mode && !config->metacopy) { + /* Resolve verity -> metacopy dependency (unless usedwith userxattr) */
+ if (config->verity_mode&& !config->metacopy && !config-Quoted 8 lines
Quoted 1 line
Quoted 1 line
userxattr) {
This is very un-intuitive to me.
Why do we need to keep the dependency verity -> metacopy with trusted xattrs?
Anyway, I'd like an ACK from composefs guys on this change.
Quoted 8 lines
What do you guys think about disallowing the relaxed
OVL_VERITY_ONmode in case of !metacopy or in case of userxattr?I am not sure if it makes any sense wrt security, but if user is putting their
trust on the lower layer's immutable content, it feels like this content
should include the verity digests???
In the case of composefs, we will always either pass metacopy or userxattrs, so this is moot and the patches as-is look good for composefs.
However, I agree that it is a bit weird. The new behavior is that as soon as numdatalayer > 0 we following redirects into a data-layer even if metacopy=0. This is a change from the old behavior which would previously have thrown an error here. I think this change is safe, but once we have decided to allow it I don't see any increased risk in also allowing verity=on in this case.
So, the case you're talking about is: data-only used, verity=on, metacopy & userxattrs not set.
In this case with the new patch it would (due to numdatalayer check) allow following redirects into a data layer. This sounds ok to me, but it does change behavior in other ways than just the verity check (i.e. it used to error on a redirect). Once we allow this behavior change I don't see any reason to not also allow verifying the destination digest (verity=on). This can only result in possible errors on read, and never grant more rights.
The verity=require case is less clear.
Signature · 8 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's a benighted devious farmboy possessed of the uncanny powers of an
insect. She's a strong-willed blonde stripper fleeing from a Satanic
cult. They fight crime! Miklos Szeredi
maintainerRe: [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity"
In reply to Amir GoldsteinQuoted 6 lines · Amir Goldstein
Quoted 6 lines
fs/overlayfs/params.c +0
-0@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx, config->uuid =OVL_UUID_NULL ; }
Quoted 8 lines
fs/overlayfs/params.c int ovl_fs_params_verify(const struct ovl_fs_context *ctx, · line 850
Quoted 4 lines
fs/overlayfs/params.c +2
-2-/* Resolve verity -> metacopy dependency */ -if (config->verity_mode && !config->metacopy) { +/* Resolve verity -> metacopy dependency (unless used with userxattr) */ +if (config->verity_mode && !config->metacopy && !config->userxattr) {This is very un-intuitive to me.
Why do we need to keep the dependency verity -> metacopy with trusted xattrs?
Yeah, now it's clear that metacopy has little to do with the data redirect feature that verity was added for.
I don't really understand the copy-up logic around verity=require, though. Why does that not return EIO like open?
Thanks,
Miklos
Re: [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity"
Quoted 19 lines · Miklos Szeredi
Quoted 16 lines · Amir Goldstein
Quoted 10 lines
fs/overlayfs/params.c +1
-2@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const structovl_fs_context *ctx, config->uuid = OVL_UUID_NULL; } - /* Resolve verity -> metacopy dependency */ - if (config->verity_mode && !config->metacopy) { + /* Resolve verity -> metacopy dependency (unless usedQuoted 3 lines
with userxattr) */
+ if (config->verity_mode&& !config->metacopy && !config-Quoted 1 line
userxattr) {
This is very un-intuitive to me.
Quoted 8 lines
Quoted 2 lines
Why do we need to keep the dependency verity -> metacopy with trusted xattrs?
Yeah, now it's clear that metacopy has little to do with the data redirect feature that verity was added for.
I don't really understand the copy-up logic around verity=require, though. Why does that not return EIO like open?
If a lowerdir file doesn't have fsverity enabled, there is no struct fsverity_info, so no digest available to use. This means we cannot make a verity-enforced redirect to it.
This is not an VERITY_REQUIRE failure, those are when we find a redirect with a missing digest xattr, but in this case the lower file is a real data file, not a redirect.
Note: This actually happens in composefs. We don't use redirect for tiny files (smaller than the redirect xattrs would be), instead we embed them directly in the EROFS image.
Signature · 8 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's a lonely Jewish vampire hunter on a search for his missing sister.
She's a man-hating Buddhist socialite trying to make a difference in a
man's world. They fight crime! Re: [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity"
In reply to Miklos SzerediQuoted 7 lines · Miklos Szeredi
Allow the "verity" mount option to be used with "userxattr" data-only layer(s).
Previous patches made sure that with "userxattr" metacopy only works in the
lower -> data scenario.
Quoted 6 lines
In this scenario the lower (metadata) layer must be secured against tampering, in which case the verity checksums contained in this layer can
ensure integrity of data even in the case of an untrusted data layer.Signed-off-by Miklos Szeredi <[email protected]>
This works well enough for composefs, but I agree with Amir that once we start allowing redirects into data-only lowers, even with metacopy=0, then we could at least allow verity=on.
Quoted 53 lines
---
fs/overlayfs/params.c | 11 +++--------1 file changed, 3 insertions(+), 8 deletions(-)fs/overlayfs/params.c +0
-0@@ -846,8 +846,8 @@ int ovl_fs_params_verify(const structovl_fs_context *ctx, config->uuid = OVL_UUID_NULL; }fs/overlayfs/params.c +1
-2-/* Resolve verity -> metacopy dependency */ -if (config->verity_mode && !config->metacopy) { +/* Resolve verity -> metacopy dependency (unless used with userxattr) */
fs/overlayfs/params.c +1
-0+ if (config->verity_mode && !config->metacopy && !config-Quoted 1 line
userxattr) {
/* Don't allow explicit specified conflicting combinations */
if (set.metacopy) { pr_err("conflicting options:
metacopy=off,verity=%s\n",fs/overlayfs/params.c +0
-0@@ -945,7 +945,7 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx, }
fs/overlayfs/params.c +0
-1-/* Resolve userxattr -> !redirect && !metacopy && !verity dependency */
fs/overlayfs/params.c +1
-0+/* Resolve userxattr -> !redirect && !metacopy dependency */ if (
config->userxattr) {
if (set.redirect &&config->redirect_mode!=OVL_REDIRECT_NOFOLLOW) {fs/overlayfs/params.c +0
-0@@ -957,11 +957,6 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,pr_err("conflicting options:
userxattr,metacopy=on\n");
return-EINVAL;
}fs/overlayfs/params.c +0
-2-if (config->verity_mode) { - pr_err("conflicting options:userxattr,verity=%s\n",
fs/overlayfs/params.c +0
-3- ovl_verity_mode(config)); -return -EINVAL ; - }/*
* Silently disable default setting of redirect and metacopy.
* This shall be the default in the future as well:
these
Signature · 9 lines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
[email protected] [email protected]
He's an oversexed soccer-playing filmmaker possessed of the uncanny
powers of an insect. She's a foxy nymphomaniac mercenary on the trail
of
a serial killer. They fight crime! Amir Goldstein
maintainerQuoted 3 lines · Miklos Szeredi
The main purpose of this patchset is allowing metadata/data-only layers to be usable in user namespaces (without super user privs).
Please add test coverage to this use case.
I think a userxattr variant of test overlay/080 should be easy.
Thanks,
Amir.