Skip to content

Commit beae836

Browse files
committed
ovl: temporarily disable appending lowedirs
Kernel v6.5 converted overlayfs to new mount api. As an added bonus, it also added a feature to allow appending lowerdirs using lowerdir=:/lower2,lowerdir=::/data3 syntax. This new syntax has raised some concerns regarding escaping of colons. We decided to try and disable this syntax, which hasn't been in the wild for so long and introduce it again in 6.7 using explicit mount options lowerdir+=/lower2,datadir+=/data3. Suggested-by: Miklos Szeredi <[email protected]> Link: https://lore.kernel.org/r/CAJfpegsr3A4YgF2YBevWa6n3=AcP7hNndG6EPMu3ncvV-AM71A@mail.gmail.com/ Fixes: b36a578 ("ovl: modify layer parameter parsing") Signed-off-by: Amir Goldstein <[email protected]>
1 parent 32db510 commit beae836

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

fs/overlayfs/params.c

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,6 @@ static void ovl_parse_param_drop_lowerdir(struct ovl_fs_context *ctx)
350350
* Set "/lower1", "/lower2", and "/lower3" as lower layers and
351351
* "/data1" and "/data2" as data lower layers. Any existing lower
352352
* layers are replaced.
353-
* (2) lowerdir=:/lower4
354-
* Append "/lower4" to current stack of lower layers. This requires
355-
* that there already is at least one lower layer configured.
356-
* (3) lowerdir=::/lower5
357-
* Append data "/lower5" as data lower layer. This requires that
358-
* there's at least one regular lower layer present.
359353
*/
360354
static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
361355
{
@@ -377,49 +371,9 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
377371
return 0;
378372
}
379373

380-
if (strncmp(name, "::", 2) == 0) {
381-
/*
382-
* This is a data layer.
383-
* There must be at least one regular lower layer
384-
* specified.
385-
*/
386-
if (ctx->nr == 0) {
387-
pr_err("data lower layers without regular lower layers not allowed");
388-
return -EINVAL;
389-
}
390-
391-
/* Skip the leading "::". */
392-
name += 2;
393-
data_layer = true;
394-
/*
395-
* A data layer is automatically an append as there
396-
* must've been at least one regular lower layer.
397-
*/
398-
append = true;
399-
} else if (*name == ':') {
400-
/*
401-
* This is a regular lower layer.
402-
* If users want to append a layer enforce that they
403-
* have already specified a first layer before. It's
404-
* better to be strict.
405-
*/
406-
if (ctx->nr == 0) {
407-
pr_err("cannot append layer if no previous layer has been specified");
408-
return -EINVAL;
409-
}
410-
411-
/*
412-
* Once a sequence of data layers has started regular
413-
* lower layers are forbidden.
414-
*/
415-
if (ctx->nr_data > 0) {
416-
pr_err("regular lower layers cannot follow data lower layers");
417-
return -EINVAL;
418-
}
419-
420-
/* Skip the leading ":". */
421-
name++;
422-
append = true;
374+
if (*name == ':') {
375+
pr_err("cannot append lower layer");
376+
return -EINVAL;
423377
}
424378

425379
dup = kstrdup(name, GFP_KERNEL);

0 commit comments

Comments
 (0)