From: Jordi Pujol Palomer <jordipujolp@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-security-module@vger.kernel.org,
David Howells <dhowells@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>, "A. Wan" <jm@mokwan.com>,
Patrick Frisch <patrick@frischux.de>,
Aaron Campbell <aaron@arbor.net>
Subject: Re: [RFC PATCH] overlayfs: support more than one read-only layer
Date: Sat, 8 Nov 2014 19:27:23 +0100 [thread overview]
Message-ID: <20141108192723.444cecd2@gmail.com> (raw)
In-Reply-To: <20141107170242.GA333@tucsk>
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
EL Fri, 7 Nov 2014 18:02:42 +0100
Miklos Szeredi <miklos@szeredi.hu> escrigué:
> This is the first iteration of the patch, and quite possibly buggy.
> Testing and review is welcome.
>
Hello,
I did light tests on this patch applied to kernel 3.18-rc3, it works.
Observations:
- option lowerdirs is an extended case of lowerdir,
then we can use only a name for that option and discard the other,
for compatibility with older versions may be lowerdir.
- overlayfs changes fast the mount options that we should specify,
an overlayfs version number will help the implementer to control it.
- limit filesystem depth by a kernel config parameter, allowing nomax.
- print more detailed error message
Following patches are included to better explain some points,
you can use the idea and make your best,
Regards,
Jordi Pujol
[-- Attachment #2: 54-overlayfs-version.patch --]
[-- Type: text/x-patch, Size: 594 bytes --]
modinfo --field=version overlayfs
busybox modinfo -F version /lib/modules/$(uname -r)/kernel/fs/overlayfs.ko | awk '{print $NF}'
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -23,6 +23,7 @@
MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
MODULE_DESCRIPTION("Overlay filesystem");
MODULE_LICENSE("GPL");
+MODULE_VERSION(OVERLAYFS_VERSION);
#define OVERLAYFS_SUPER_MAGIC 0x794c764f
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -9,6 +9,8 @@
#include <linux/kernel.h>
+#define OVERLAYFS_VERSION "25"
+
struct ovl_entry;
enum ovl_path_type {
[-- Attachment #3: 55-param-print-err-msg.patch --]
[-- Type: text/x-patch, Size: 495 bytes --]
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -728,7 +728,10 @@ static int ovl_fill_super(struct super_b
}
if (!ufs->config.upperdir &&
!ufs->config.lowerdir && !ufs->config.lowerdirs) {
- pr_err("overlayfs: no 'upperdir', 'lowerdir' or 'lowerdirs' specified\n");
+ pr_err("overlayfs: missing%s%s%s\n",
+ ufs->config.upperdir ? "" : " upperdir",
+ ufs->config.lowerdir ? "" : " lowerdir",
+ ufs->config.lowerdirs ? "" : " lowerdirs");
goto out_free_config;
}
[-- Attachment #4: 53-fs__limit_filesystem_stacking_depth-kconfig.patch --]
[-- Type: text/x-patch, Size: 1721 bytes --]
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -246,12 +246,6 @@ struct iattr {
*/
#include <linux/quota.h>
-/*
- * Maximum number of layers of fs stack. Needs to be limited to
- * prevent kernel stack overflow
- */
-#define FILESYSTEM_MAX_STACK_DEPTH 2
-
/**
* enum positive_aop_returns - aop return codes with specific semantics
*
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -44,6 +44,12 @@ config INIT_ENV_ARG_LIMIT
Maximum of each of the number of arguments and environment
variables passed to init from the kernel command line.
+config FILESYSTEM_MAX_STACK_DEPTH
+ int "Maximum number of layers of fs stack"
+ default 2
+ help
+ Maximum number of layers of fs stack. Needs to be limited to
+ prevent kernel stack overflow. Set to 0 for no limit.
config CROSS_COMPILE
string "Cross-compiler tool prefix"
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -568,8 +568,9 @@ static struct dentry *ecryptfs_mount(str
s->s_magic = ECRYPTFS_SUPER_MAGIC;
s->s_stack_depth = path.dentry->d_sb->s_stack_depth + 1;
- rc = -EINVAL;
- if (s->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) {
+ if (CONFIG_FILESYSTEM_MAX_STACK_DEPTH > 0 &&
+ s->s_stack_depth > CONFIG_FILESYSTEM_MAX_STACK_DEPTH) {
+ rc = -EINVAL;
pr_err("eCryptfs: maximum fs stacking depth exceeded\n");
goto out_free;
}
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -818,7 +818,8 @@ static int ovl_fill_super(struct super_b
}
err = -EINVAL;
- if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) {
+ if (CONFIG_FILESYSTEM_MAX_STACK_DEPTH > 0 &&
+ sb->s_stack_depth > CONFIG_FILESYSTEM_MAX_STACK_DEPTH) {
pr_err("overlayfs: maximum fs stacking depth exceeded\n");
goto out_put_lowerpath;
}
next prev parent reply other threads:[~2014-11-08 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 17:02 [RFC PATCH] overlayfs: support more than one read-only layer Miklos Szeredi
2014-11-08 18:27 ` Jordi Pujol Palomer [this message]
2014-11-10 9:09 ` Miklos Szeredi
2014-11-10 17:08 ` Erez Zadok
2014-11-14 8:55 ` Jordi Pujol Palomer
2014-11-17 10:32 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141108192723.444cecd2@gmail.com \
--to=jordipujolp@gmail.com \
--cc=aaron@arbor.net \
--cc=dhowells@redhat.com \
--cc=jm@mokwan.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=patrick@frischux.de \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).