2022-11-28 11:57:59

by Alexander Larsson

[permalink] [raw]
Subject: [PATCH 6/6] composefs: Add kconfig and build support

This commit adds Makefile and Kconfig for composefs, and
updates Makefile and Kconfig files in the fs directory

Signed-off-by: Alexander Larsson <[email protected]>
---
fs/Kconfig | 1 +
fs/Makefile | 1 +
fs/composefs/Kconfig | 18 ++++++++++++++++++
fs/composefs/Makefile | 5 +++++
4 files changed, 25 insertions(+)
create mode 100644 fs/composefs/Kconfig
create mode 100644 fs/composefs/Makefile

diff --git a/fs/Kconfig b/fs/Kconfig
index 2685a4d0d353..de8493fc2b1e 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -127,6 +127,7 @@ source "fs/quota/Kconfig"
source "fs/autofs/Kconfig"
source "fs/fuse/Kconfig"
source "fs/overlayfs/Kconfig"
+source "fs/composefs/Kconfig"

menu "Caches"

diff --git a/fs/Makefile b/fs/Makefile
index 4dea17840761..d16974e02468 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -137,3 +137,4 @@ obj-$(CONFIG_EFIVAR_FS) += efivarfs/
obj-$(CONFIG_EROFS_FS) += erofs/
obj-$(CONFIG_VBOXSF_FS) += vboxsf/
obj-$(CONFIG_ZONEFS_FS) += zonefs/
+obj-$(CONFIG_COMPOSEFS_FS) += composefs/
diff --git a/fs/composefs/Kconfig b/fs/composefs/Kconfig
new file mode 100644
index 000000000000..88c5b55380e6
--- /dev/null
+++ b/fs/composefs/Kconfig
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config COMPOSEFS_FS
+ tristate "Composefs filesystem support"
+ select EXPORTFS
+ help
+ Composefs is a filesystem that allows combining file content from
+ existing regular files with a metadata directory structure from
+ a separate binary file. This is useful to share file content between
+ many different directory trees, such as in a local container image store.
+
+ Composefs also allows using fs-verity to validate the content of the
+ content-files as well as the metadata file which allows dm-verity
+ like validation with the flexibility of regular files.
+
+ For more information see Documentation/filesystems/composefs.rst
+
+ If unsure, say N.
diff --git a/fs/composefs/Makefile b/fs/composefs/Makefile
new file mode 100644
index 000000000000..eac8445e7d25
--- /dev/null
+++ b/fs/composefs/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_COMPOSEFS_FS) += composefs.o
+
+composefs-objs += cfs-reader.o cfs.o
--
2.38.1


2022-11-28 14:42:27

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 6/6] composefs: Add kconfig and build support

Hi Alexander,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fscrypt/fsverity]
[also build test WARNING on linus/master v6.1-rc7 next-20221128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Larsson/Composefs-an-opportunistically-sharing-verified-image-filesystem/20221128-192140
base: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git fsverity
patch link: https://lore.kernel.org/r/a0524f492d2ac64b99f3de6ea2b27249a4bcadad.1669631086.git.alexl%40redhat.com
patch subject: [PATCH 6/6] composefs: Add kconfig and build support
config: sparc-allyesconfig
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/b1d98075a6a519fa9405dd2cd273ed2e00f12266
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Alexander-Larsson/Composefs-an-opportunistically-sharing-verified-image-filesystem/20221128-192140
git checkout b1d98075a6a519fa9405dd2cd273ed2e00f12266
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

fs/composefs/cfs-reader.c: In function 'cfs_list_xattrs':
>> fs/composefs/cfs-reader.c:605:40: warning: variable 'this_value' set but not used [-Wunused-but-set-variable]
605 | const char *this_key, *this_value;
| ^~~~~~~~~~


vim +/this_value +605 fs/composefs/cfs-reader.c

c286cdbef4137f Alexander Larsson 2022-11-28 569
c286cdbef4137f Alexander Larsson 2022-11-28 570 ssize_t cfs_list_xattrs(struct cfs_context_s *ctx,
c286cdbef4137f Alexander Larsson 2022-11-28 571 struct cfs_inode_data_s *inode_data, char *names,
c286cdbef4137f Alexander Larsson 2022-11-28 572 size_t size)
c286cdbef4137f Alexander Larsson 2022-11-28 573 {
c286cdbef4137f Alexander Larsson 2022-11-28 574 u8 *data, *data_end;
c286cdbef4137f Alexander Larsson 2022-11-28 575 size_t n_xattrs = 0, i;
c286cdbef4137f Alexander Larsson 2022-11-28 576 ssize_t copied = 0;
c286cdbef4137f Alexander Larsson 2022-11-28 577 const struct cfs_xattr_header_s *xattrs;
c286cdbef4137f Alexander Larsson 2022-11-28 578 struct cfs_buf vdata_buf = CFS_VDATA_BUF_INIT;
c286cdbef4137f Alexander Larsson 2022-11-28 579
c286cdbef4137f Alexander Larsson 2022-11-28 580 if (inode_data->xattrs_len == 0)
c286cdbef4137f Alexander Larsson 2022-11-28 581 return 0;
c286cdbef4137f Alexander Larsson 2022-11-28 582
c286cdbef4137f Alexander Larsson 2022-11-28 583 /* xattrs_len basic size req was verified in cfs_init_inode_data */
c286cdbef4137f Alexander Larsson 2022-11-28 584
c286cdbef4137f Alexander Larsson 2022-11-28 585 xattrs = cfs_get_vdata_buf(ctx, inode_data->xattrs_offset,
c286cdbef4137f Alexander Larsson 2022-11-28 586 inode_data->xattrs_len, &vdata_buf);
c286cdbef4137f Alexander Larsson 2022-11-28 587 if (IS_ERR(xattrs))
c286cdbef4137f Alexander Larsson 2022-11-28 588 return PTR_ERR(xattrs);
c286cdbef4137f Alexander Larsson 2022-11-28 589
c286cdbef4137f Alexander Larsson 2022-11-28 590 n_xattrs = cfs_u16_from_file(xattrs->n_attr);
c286cdbef4137f Alexander Larsson 2022-11-28 591
c286cdbef4137f Alexander Larsson 2022-11-28 592 /* Verify that array fits */
c286cdbef4137f Alexander Larsson 2022-11-28 593 if (inode_data->xattrs_len < cfs_xattr_header_size(n_xattrs)) {
c286cdbef4137f Alexander Larsson 2022-11-28 594 copied = -EFSCORRUPTED;
c286cdbef4137f Alexander Larsson 2022-11-28 595 goto exit;
c286cdbef4137f Alexander Larsson 2022-11-28 596 }
c286cdbef4137f Alexander Larsson 2022-11-28 597
c286cdbef4137f Alexander Larsson 2022-11-28 598 data = ((u8 *)xattrs) + cfs_xattr_header_size(n_xattrs);
c286cdbef4137f Alexander Larsson 2022-11-28 599 data_end = ((u8 *)xattrs) + inode_data->xattrs_len;
c286cdbef4137f Alexander Larsson 2022-11-28 600
c286cdbef4137f Alexander Larsson 2022-11-28 601 for (i = 0; i < n_xattrs; i++) {
c286cdbef4137f Alexander Larsson 2022-11-28 602 const struct cfs_xattr_element_s *e = &xattrs->attr[i];
c286cdbef4137f Alexander Larsson 2022-11-28 603 u16 this_key_len = cfs_u16_from_file(e->key_length);
c286cdbef4137f Alexander Larsson 2022-11-28 604 u16 this_value_len = cfs_u16_from_file(e->value_length);
c286cdbef4137f Alexander Larsson 2022-11-28 @605 const char *this_key, *this_value;
c286cdbef4137f Alexander Larsson 2022-11-28 606
c286cdbef4137f Alexander Larsson 2022-11-28 607 if (this_key_len > XATTR_NAME_MAX ||
c286cdbef4137f Alexander Larsson 2022-11-28 608 /* key and data needs to fit in data */
c286cdbef4137f Alexander Larsson 2022-11-28 609 data_end - data < this_key_len + this_value_len) {
c286cdbef4137f Alexander Larsson 2022-11-28 610 copied = -EFSCORRUPTED;
c286cdbef4137f Alexander Larsson 2022-11-28 611 goto exit;
c286cdbef4137f Alexander Larsson 2022-11-28 612 }
c286cdbef4137f Alexander Larsson 2022-11-28 613
c286cdbef4137f Alexander Larsson 2022-11-28 614 this_key = data;
c286cdbef4137f Alexander Larsson 2022-11-28 615 this_value = data + this_key_len;
c286cdbef4137f Alexander Larsson 2022-11-28 616 data += this_key_len + this_value_len;
c286cdbef4137f Alexander Larsson 2022-11-28 617
c286cdbef4137f Alexander Larsson 2022-11-28 618 if (size) {
c286cdbef4137f Alexander Larsson 2022-11-28 619 if (size - copied < this_key_len + 1) {
c286cdbef4137f Alexander Larsson 2022-11-28 620 copied = -E2BIG;
c286cdbef4137f Alexander Larsson 2022-11-28 621 goto exit;
c286cdbef4137f Alexander Larsson 2022-11-28 622 }
c286cdbef4137f Alexander Larsson 2022-11-28 623
c286cdbef4137f Alexander Larsson 2022-11-28 624 memcpy(names + copied, this_key, this_key_len);
c286cdbef4137f Alexander Larsson 2022-11-28 625 names[copied + this_key_len] = '\0';
c286cdbef4137f Alexander Larsson 2022-11-28 626 }
c286cdbef4137f Alexander Larsson 2022-11-28 627
c286cdbef4137f Alexander Larsson 2022-11-28 628 copied += this_key_len + 1;
c286cdbef4137f Alexander Larsson 2022-11-28 629 }
c286cdbef4137f Alexander Larsson 2022-11-28 630
c286cdbef4137f Alexander Larsson 2022-11-28 631 exit:
c286cdbef4137f Alexander Larsson 2022-11-28 632 cfs_buf_put(&vdata_buf);
c286cdbef4137f Alexander Larsson 2022-11-28 633
c286cdbef4137f Alexander Larsson 2022-11-28 634 return copied;
c286cdbef4137f Alexander Larsson 2022-11-28 635 }
c286cdbef4137f Alexander Larsson 2022-11-28 636

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (7.18 kB)
config (328.48 kB)
Download all attachments

2022-11-28 18:20:02

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 6/6] composefs: Add kconfig and build support

Hi Alexander,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on fscrypt/fsverity]
[also build test ERROR on linus/master v6.1-rc7 next-20221128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Larsson/Composefs-an-opportunistically-sharing-verified-image-filesystem/20221128-192140
base: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git fsverity
patch link: https://lore.kernel.org/r/a0524f492d2ac64b99f3de6ea2b27249a4bcadad.1669631086.git.alexl%40redhat.com
patch subject: [PATCH 6/6] composefs: Add kconfig and build support
config: sh-allmodconfig
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/b1d98075a6a519fa9405dd2cd273ed2e00f12266
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Alexander-Larsson/Composefs-an-opportunistically-sharing-verified-image-filesystem/20221128-192140
git checkout b1d98075a6a519fa9405dd2cd273ed2e00f12266
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

fs/composefs/cfs.c: In function 'cfs_mmu_get_unmapped_area':
>> fs/composefs/cfs.c:686:27: error: 'struct mm_struct' has no member named 'get_unmapped_area'
686 | return current->mm->get_unmapped_area(file, addr, len, pgoff, flags);
| ^~
fs/composefs/cfs.c:687:1: error: control reaches end of non-void function [-Werror=return-type]
687 | }
| ^
fs/composefs/cfs.c: At top level:
fs/composefs/cfs.c:58:42: warning: 'generic_file_vm_ops' defined but not used [-Wunused-const-variable=]
58 | static const struct vm_operations_struct generic_file_vm_ops;
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +686 fs/composefs/cfs.c

0f354cef5ce30b Alexander Larsson 2022-11-28 674
0f354cef5ce30b Alexander Larsson 2022-11-28 675 static unsigned long cfs_mmu_get_unmapped_area(struct file *file,
0f354cef5ce30b Alexander Larsson 2022-11-28 676 unsigned long addr,
0f354cef5ce30b Alexander Larsson 2022-11-28 677 unsigned long len,
0f354cef5ce30b Alexander Larsson 2022-11-28 678 unsigned long pgoff,
0f354cef5ce30b Alexander Larsson 2022-11-28 679 unsigned long flags)
0f354cef5ce30b Alexander Larsson 2022-11-28 680 {
0f354cef5ce30b Alexander Larsson 2022-11-28 681 struct file *realfile = file->private_data;
0f354cef5ce30b Alexander Larsson 2022-11-28 682
0f354cef5ce30b Alexander Larsson 2022-11-28 683 if (realfile == &empty_file)
0f354cef5ce30b Alexander Larsson 2022-11-28 684 return 0;
0f354cef5ce30b Alexander Larsson 2022-11-28 685
0f354cef5ce30b Alexander Larsson 2022-11-28 @686 return current->mm->get_unmapped_area(file, addr, len, pgoff, flags);
0f354cef5ce30b Alexander Larsson 2022-11-28 687 }
0f354cef5ce30b Alexander Larsson 2022-11-28 688

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (3.68 kB)
config (249.02 kB)
Download all attachments

2022-11-29 07:29:35

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 6/6] composefs: Add kconfig and build support

Hi Alexander,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fscrypt/fsverity]
[also build test WARNING on linus/master v6.1-rc7 next-20221129]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Larsson/Composefs-an-opportunistically-sharing-verified-image-filesystem/20221128-192140
base: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git fsverity
patch link: https://lore.kernel.org/r/a0524f492d2ac64b99f3de6ea2b27249a4bcadad.1669631086.git.alexl%40redhat.com
patch subject: [PATCH 6/6] composefs: Add kconfig and build support
config: x86_64-allyesconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/b1d98075a6a519fa9405dd2cd273ed2e00f12266
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Alexander-Larsson/Composefs-an-opportunistically-sharing-verified-image-filesystem/20221128-192140
git checkout b1d98075a6a519fa9405dd2cd273ed2e00f12266
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/composefs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> fs/composefs/cfs.c:58:42: warning: 'generic_file_vm_ops' defined but not used [-Wunused-const-variable=]
58 | static const struct vm_operations_struct generic_file_vm_ops;
| ^~~~~~~~~~~~~~~~~~~


vim +/generic_file_vm_ops +58 fs/composefs/cfs.c

0f354cef5ce30b9 Alexander Larsson 2022-11-28 56
0f354cef5ce30b9 Alexander Larsson 2022-11-28 57 static const struct file_operations cfs_file_operations;
0f354cef5ce30b9 Alexander Larsson 2022-11-28 @58 static const struct vm_operations_struct generic_file_vm_ops;
0f354cef5ce30b9 Alexander Larsson 2022-11-28 59

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (2.26 kB)
config (297.62 kB)
Download all attachments