fscrypt: Remove filesystem specific build config option
Subsystems (3)
RFC PATCH 1/2 fscrypt: Remove filesystem specific build config option
As a first step to avoid copy-pasting common code across filesystems which implement fscrypt, this commit removes filesystem specific build config option (e.g. CONFIG_EXT4_FS_ENCRYPTION) and replaces it with a build option (i.e. CONFIG_FS_ENCRYPTION) whose value affects all the filesystems making use of fscrypt.
---
PS: Similar changes are required for F2FS and I will be addressing them in the next version of this patchset.
The patches are based on Eric Biggers' FS verity patchset. The git tree can found at "https://github.com/chandanr/linux.git common-build-config".
fs/crypto/Kconfig | 2 +- fs/ext4/Kconfig | 15 -- fs/ext4/dir.c | 10 +- fs/ext4/ext4.h | 12 +- fs/ext4/ext4_jbd2.h | 2 +- fs/ext4/extents.c | 4 +- fs/ext4/ialloc.c | 2 +- fs/ext4/inode.c | 22 +-- fs/ext4/move_extent.c | 3 +- fs/ext4/namei.c | 18 +- fs/ext4/page-io.c | 8 +- fs/ext4/readpage.c | 8 +- fs/ext4/super.c | 6 +- fs/ext4/sysfs.c | 4 +- include/linux/fscrypt.h | 416 +++++++++++++++++++++++++++++++++++++++- include/linux/fscrypt_notsupp.h | 231 ---------------------- include/linux/fscrypt_supp.h | 204 -------------------- 17 files changed, 454 insertions(+), 513 deletions(-) delete mode 100644 include/linux/fscrypt_notsupp.h delete mode 100644 include/linux/fscrypt_supp.h
fs/crypto/Kconfig +1 -1
@@ -1,5 +1,5 @@ config FS_ENCRYPTION - tristate "FS Encryption (Per-file encryption)" + bool "FS Encryption (Per-file encryption)" select CRYPTO select CRYPTO_AES select CRYPTO_CBC
fs/ext4/Kconfig +0 -15
@@ -96,21 +96,6 @@ config EXT4_FS_SECURITY If you are not using a security module that requires using extended attributes for file security labels, say N. -config EXT4_ENCRYPTION - bool "Ext4 Encryption" - depends on EXT4_FS - select FS_ENCRYPTION - help - Enable encryption of ext4 files and directories. This - feature is similar to ecryptfs, but it is more memory - efficient since it avoids caching the encrypted and - decrypted pages in the page cache. - -config EXT4_FS_ENCRYPTION - bool - default y - depends on EXT4_ENCRYPTION - config EXT4_FS_VERITY bool "Ext4 Verity" depends on EXT4_FS
fs/ext4/dir.c +4 -6
@@ -113,7 +113,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)int dir_has_error =0 ;struct fscrypt_str fstr =FSTR_INIT (NULL ,0 ); -if (ext4_encrypted_inode (inode)) { +if (IS_ENCRYPTED (inode)) { err =fscrypt_get_encryption_info (inode);if (err && err != -ENOKEY )return err;
@@ -140,7 +140,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)return err; } -if (ext4_encrypted_inode (inode)) { +if (IS_ENCRYPTED (inode)) { err =fscrypt_fname_alloc_buffer (inode,EXT4_NAME_LEN , &fstr);if (err <0 )return err;
@@ -247,7 +247,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) offset +=ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize); if (le32_to_cpu(de->inode)) { - if (!ext4_encrypted_inode(inode)) { + if (!IS_ENCRYPTED(inode)) { if (!dir_emit(ctx, de->name, de->name_len, le32_to_cpu(de->inode),
@@ -285,9 +285,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) done: err =0 ; errout: -#ifdef CONFIG_EXT4_FS_ENCRYPTION fscrypt_fname_free_buffer (&fstr); -#endif brelse (bh);return err; }
@@ -615,7 +613,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx)static int ext4_dir_open (struct inode * inode,struct file * filp) { -if (ext4_encrypted_inode (inode)) +if (IS_ENCRYPTED (inode))return fscrypt_get_encryption_info (inode) ? -EACCES :0 ;return 0 ; }
fs/ext4/ext4.h +3 -9
@@ -40,7 +40,6 @@#include <linux/compat.h> #endif -#define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_EXT4_FS_ENCRYPTION)#include <linux/fscrypt.h> #define __FS_HAS_VERITY IS_ENABLED(CONFIG_EXT4_FS_VERITY)
@@ -1320,7 +1319,7 @@ struct ext4_super_block {#define EXT4_MF_FS_ABORTED 0x0002/* Fatal error detected */ #define EXT4_MF_TEST_DUMMY_ENCRYPTION 0x0004 -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION #define DUMMY_ENCRYPTION_ENABLED (sbi) (unlikely((sbi)->s_mount_flags & \ EXT4_MF_TEST_DUMMY_ENCRYPTION))#else
@@ -2047,7 +2046,7 @@ struct ext4_filename {const struct qstr *usr_fname;struct fscrypt_str disk_name;struct dx_hash_info hinfo; -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION struct fscrypt_str crypto_buf;#endif };
@@ -2275,11 +2274,6 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb, struct ext4_group_desc *gdp);ext4_fsblk_t ext4_inode_to_goal_block (struct inode *); -static inline bool ext4_encrypted_inode (struct inode *inode) -{ -return ext4_test_inode_flag (inode,EXT4_INODE_ENCRYPT ); -} -static inline bool ext4_verity_inode (struct inode *inode) {#ifdef CONFIG_EXT4_FS_VERITY
@@ -2289,7 +2283,7 @@ static inline bool ext4_verity_inode(struct inode *inode)#endif } -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION static inline int ext4_fname_setup_filename (struct inode *dir,const struct qstr *iname,int lookup,struct ext4_filename *fname)
fs/ext4/ext4_jbd2.h +1 -1
@@ -411,7 +411,7 @@ static inline int ext4_inode_journal_mode(struct inode *inode) (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) && !test_opt(inode->i_sb, DELALLOC))) {/* We do not support data journalling for encrypted data */ -if (S_ISREG (inode->i_mode) &&ext4_encrypted_inode (inode)) +if (S_ISREG (inode->i_mode) &&IS_ENCRYPTED (inode))return EXT4_INODE_ORDERED_DATA_MODE ;/* ordered */ return EXT4_INODE_JOURNAL_DATA_MODE ;/* journal data */ }
fs/ext4/extents.c +2 -2
@@ -3569,7 +3569,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, max_zeroout = sbi->s_extent_max_zeroout_kb >> (inode->i_sb->s_blocksize_bits -10 ); -if (ext4_encrypted_inode (inode)) +if (IS_ENCRYPTED (inode)) max_zeroout =0 ;/*
@@ -4912,7 +4912,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)* leave it disabled for encrypted inodes for now. This is a * bug we should fix.... */ -if (ext4_encrypted_inode (inode) && +if (IS_ENCRYPTED (inode) && (mode & (FALLOC_FL_COLLAPSE_RANGE |FALLOC_FL_INSERT_RANGE |FALLOC_FL_ZERO_RANGE )))return -EOPNOTSUPP ;
fs/ext4/ialloc.c +1 -1
@@ -771,7 +771,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,if (unlikely (ext4_forced_shutdown (sbi)))return ERR_PTR (-EIO ); -if ((ext4_encrypted_inode (dir) ||DUMMY_ENCRYPTION_ENABLED (sbi)) && +if ((IS_ENCRYPTED (dir) ||DUMMY_ENCRYPTION_ENABLED (sbi)) && (S_ISREG (mode) ||S_ISDIR (mode) ||S_ISLNK (mode)) && !(i_flags &EXT4_EA_INODE_FL )) { err =fscrypt_get_encryption_info (dir);
fs/ext4/inode.c +11 -11
@@ -415,7 +415,7 @@ int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk, {int ret; -if (ext4_encrypted_inode (inode)) +if (IS_ENCRYPTED (inode))return fscrypt_zeroout_range (inode, lblk, pblk, len); ret =sb_issue_zeroout (inode->i_sb, pblk, len,GFP_NOFS );
@@ -1150,7 +1150,7 @@ int do_journal_get_write_access(handle_t *handle,return ret; } -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION static int ext4_block_write_begin (struct page *page,loff_t pos,unsigned len,get_block_t *get_block) {
@@ -1217,7 +1217,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, (block_start < from || block_end > to)) {ll_rw_block (REQ_OP_READ ,0 ,1 , &bh); *wait_bh++ = bh; - decrypt =ext4_encrypted_inode (inode) && + decrypt =IS_ENCRYPTED (inode) &&S_ISREG (inode->i_mode); } }
@@ -1303,7 +1303,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,/* In case writeback began while the page was unlocked */ wait_for_stable_page (page); -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION if (ext4_should_dioread_nolock (inode)) ret =ext4_block_write_begin (page, pos, len, ext4_get_block_unwritten);
@@ -3074,7 +3074,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,/* In case writeback began while the page was unlocked */ wait_for_stable_page (page); -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION ret =ext4_block_write_begin (page, pos, len, ext4_da_get_block_prep);#else
@@ -3843,8 +3843,8 @@ static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter)loff_t offset = iocb->ki_pos;ssize_t ret; -#ifdef CONFIG_EXT4_FS_ENCRYPTION -if (ext4_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) +#ifdef CONFIG_FS_ENCRYPTION +if (IS_ENCRYPTED (inode) &&S_ISREG (inode->i_mode))return 0 ;#endif
@@ -4031,7 +4031,7 @@ static int __ext4_block_zero_page_range(handle_t *handle,if (!buffer_uptodate (bh)) goto unlock;if (S_ISREG (inode->i_mode) && -ext4_encrypted_inode (inode)) { +IS_ENCRYPTED (inode)) {/* We expect the key to be set. */ BUG_ON (!fscrypt_has_encryption_key (inode));BUG_ON (blocksize !=PAGE_SIZE );
@@ -4107,7 +4107,7 @@ static int ext4_block_truncate_page(handle_t *handle,struct inode *inode = mapping->host;/* If we are processing an encrypted inode during orphan list handling */ -if (ext4_encrypted_inode (inode) && !fscrypt_has_encryption_key (inode)) +if (IS_ENCRYPTED (inode) && !fscrypt_has_encryption_key (inode))return 0 ; blocksize = inode->i_sb->s_blocksize;
@@ -4652,7 +4652,7 @@ static bool ext4_should_use_dax(struct inode *inode)return false;if (ext4_has_inline_data (inode))return false; -if (ext4_encrypted_inode (inode)) +if (IS_ENCRYPTED (inode))return false;if (ext4_verity_inode (inode))return false;
@@ -4980,7 +4980,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ret = -EFSCORRUPTED ; goto bad_inode; } -if (ext4_encrypted_inode (inode)) { +if (IS_ENCRYPTED (inode)) { inode->i_op = &ext4_encrypted_symlink_inode_operations;ext4_set_aops (inode); }else if (ext4_inode_is_fast_symlink (inode)) {
fs/ext4/move_extent.c +1 -2
@@ -590,8 +590,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,return -EOPNOTSUPP ; } -if (ext4_encrypted_inode (orig_inode) || -ext4_encrypted_inode (donor_inode)) { +if (IS_ENCRYPTED (orig_inode) ||IS_ENCRYPTED (donor_inode)) {ext4_msg (orig_inode->i_sb,KERN_ERR ,"Online defrag not supported for encrypted files" );return -EOPNOTSUPP ;
fs/ext4/namei.c +9 -9
@@ -611,7 +611,7 @@ static struct stats dx_show_leaf(struct inode *dir, {if (show_names) { -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION int len;char *name; struct fscrypt_str fname_crypto_str =
@@ -620,7 +620,7 @@ static struct stats dx_show_leaf(struct inode *dir, name = de->name; len = de->name_len; -if (ext4_encrypted_inode (dir)) +if (IS_ENCRYPTED (dir)) res =fscrypt_get_encryption_info (dir);if (res) { printk(KERN_WARNING "Error setting up"
@@ -983,9 +983,9 @@ static int htree_dirblock_to_tree(struct file *dir_file, top = (struct ext4_dir_entry_2 *) ((char *) de + dir->i_sb->s_blocksize -EXT4_DIR_REC_LEN (0 )); -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION /* Check if the directory is encrypted */ -if (ext4_encrypted_inode (dir)) { +if (IS_ENCRYPTED (dir)) { err =fscrypt_get_encryption_info (dir);if (err <0 ) {brelse (bh);
@@ -1014,7 +1014,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,continue ;if (de->inode ==0 )continue ; -if (!ext4_encrypted_inode (dir)) { +if (!IS_ENCRYPTED (dir)) { tmp_str.name = de->name; tmp_str.len = de->name_len; err = ext4_htree_store_dirent(dir_file,
@@ -1046,7 +1046,7 @@ static int htree_dirblock_to_tree(struct file *dir_file, } errout:brelse (bh); -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION fscrypt_fname_free_buffer (&fname_crypto_str);#endif return count;
@@ -1266,7 +1266,7 @@ static inline bool ext4_match(const struct ext4_filename *fname, f.usr_fname = fname->usr_fname; f.disk_name = fname->disk_name; -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION f.crypto_buf = fname->crypto_buf;#endif return fscrypt_match_name (&f, de->name, de->name_len);
@@ -1496,7 +1496,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,ext4_lblk_t block;int retval; -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION *res_dir =NULL ;#endif frame =dx_probe (fname, dir,NULL , frames);
@@ -1576,7 +1576,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi ino);return ERR_PTR (-EFSCORRUPTED ); } -if (!IS_ERR (inode) &&ext4_encrypted_inode (dir) && +if (!IS_ERR (inode) &&IS_ENCRYPTED (dir) && (S_ISDIR (inode->i_mode) ||S_ISLNK (inode->i_mode)) && !fscrypt_has_permitted_context (dir, inode)) { ext4_warning(inode->i_sb,
fs/ext4/page-io.c +4 -4
@@ -66,7 +66,7 @@ static void ext4_finish_bio(struct bio *bio)bio_for_each_segment_all (bvec, bio, i) {struct page *page = bvec->bv_page; -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION struct page *data_page =NULL ;#endif struct buffer_head *bh, *head;
@@ -78,7 +78,7 @@ static void ext4_finish_bio(struct bio *bio)if (!page)continue ; -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION if (!page->mapping) {/* The bounce data pages are unmapped. */ data_page = page;
@@ -111,7 +111,7 @@ static void ext4_finish_bio(struct bio *bio)bit_spin_unlock (BH_Uptodate_Lock, &head->b_state);local_irq_restore (flags);if (!under_io) { -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION if (data_page)fscrypt_restore_control_page (data_page);#endif
@@ -477,7 +477,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, bh = head =page_buffers (page); -if (ext4_encrypted_inode (inode) &&S_ISREG (inode->i_mode) && +if (IS_ENCRYPTED (inode) &&S_ISREG (inode->i_mode) && nr_to_submit) {gfp_t gfp_flags =GFP_NOFS ;
fs/ext4/readpage.c +4 -4
@@ -54,7 +54,7 @@ static mempool_t *bio_post_read_ctx_pool;static inline bool ext4_bio_encrypted (struct bio *bio) { -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION return unlikely (bio->bi_private !=NULL );#else return false;
@@ -156,9 +156,9 @@ static struct bio_post_read_ctx *get_bio_post_read_ctx(struct inode *inode,unsigned int post_read_steps =0 ;struct bio_post_read_ctx *ctx =NULL ; -if (ext4_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) +if (IS_ENCRYPTED (inode) &&S_ISREG (inode->i_mode)) post_read_steps |=1 <<STEP_DECRYPT ; -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY if (inode->i_verity_info !=NULL && (index < ((i_size_read (inode) +PAGE_SIZE -1 ) >>PAGE_SHIFT ))) post_read_steps |=1 <<STEP_VERITY ;
@@ -205,7 +205,7 @@ static void mpage_end_io(struct bio *bio)static inline loff_t ext4_readpage_limit (struct inode *inode) { -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY if (ext4_verity_inode (inode)) {if (inode->i_verity_info)/* limit to end of metadata region */
fs/ext4/super.c +3 -3
@@ -1178,7 +1178,7 @@ static int bdev_try_to_free_page(struct super_block *sb, struct page *page,return try_to_free_buffers (page); } -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION static int ext4_get_context (struct inode *inode,void *ctx,size_t len) { return ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION,
@@ -1944,7 +1944,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, *journal_ioprio =IOPRIO_PRIO_VALUE (IOPRIO_CLASS_BE , arg); }else if (token == Opt_test_dummy_encryption) { -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION sbi->s_mount_flags |=EXT4_MF_TEST_DUMMY_ENCRYPTION ;ext4_msg (sb,KERN_WARNING ,"Test dummy encryption mode enabled" );
@@ -4179,7 +4179,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) sb->s_op = &ext4_sops; sb->s_export_op = &ext4_export_ops; sb->s_xattr = ext4_xattr_handlers; -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION sb->s_cop = &ext4_cryptops;#endif #ifdef CONFIG_EXT4_FS_VERITY
fs/ext4/sysfs.c +2 -2
@@ -220,7 +220,7 @@ static struct attribute *ext4_attrs[] = {EXT4_ATTR_FEATURE (lazy_itable_init);EXT4_ATTR_FEATURE (batched_discard);EXT4_ATTR_FEATURE (meta_bg_resize); -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTION EXT4_ATTR_FEATURE (encryption);#endif #ifdef CONFIG_EXT4_FS_VERITY
@@ -232,7 +232,7 @@ static struct attribute *ext4_feat_attrs[] = {ATTR_LIST (lazy_itable_init),ATTR_LIST (batched_discard),ATTR_LIST (meta_bg_resize), -#ifdef CONFIG_EXT4_FS_ENCRYPTION +#ifdef CONFIG_FS_ENCRYPTIONATTR_LIST (encryption), #endif #ifdef CONFIG_EXT4_FS_VERITY
include/linux/fscrypt.h +408 -8
434 lines not on this page · raw message
include/linux/fscrypt_notsupp.h deleted +0 -231
231 lines not on this page · raw message
include/linux/fscrypt_supp.h deleted +0 -204
204 lines not on this page · raw message
Signature · 1 line
2.9.5
RFC PATCH 2/2 fsverity: Remove filesystem specific build config option
As a first step to avoid copy-pasting common code across filesystems which implement fsverity, this commit removes filesystem specific build config option (e.g. CONFIG_EXT4_FS_VERITY) and replaces it with a build option (i.e. CONFIG_FS_VERITY) whose value affects all the filesystems making use of fsverity.
---
fs/ext4/Kconfig | 20 -------------------- fs/ext4/ext4.h | 4 +--- fs/ext4/super.c | 6 +++--- fs/ext4/sysfs.c | 4 ++-- fs/verity/Kconfig | 2 +- include/linux/fsverity.h | 3 +-- 6 files changed, 8 insertions(+), 31 deletions(-)
fs/ext4/Kconfig +0 -20
@@ -96,26 +96,6 @@ config EXT4_FS_SECURITY If you are not using a security module that requires using extended attributes for file security labels, say N. -config EXT4_FS_VERITY - bool "Ext4 Verity" - depends on EXT4_FS - select FS_VERITY - help - This option enables fs-verity for ext4. fs-verity is the - dm-verity mechanism implemented at the file level. Userspace - can append a Merkle tree (hash tree) to a file, then enable - fs-verity on the file. ext4 will then transparently verify - any data read from the file against the Merkle tree. The file - is also made read-only. - - This serves as an integrity check, but the availability of the - Merkle tree root hash also allows efficiently supporting - various use cases where normally the whole file would need to - be hashed at once, such as auditing and authenticity - verification (appraisal). - - If unsure, say N. - config EXT4_DEBUG bool "EXT4 debugging support" depends on EXT4_FS
fs/ext4/ext4.h +1 -3
@@ -41,8 +41,6 @@#endif #include <linux/fscrypt.h> - -#define __FS_HAS_VERITY IS_ENABLED(CONFIG_EXT4_FS_VERITY)#include <linux/fsverity.h> /*
@@ -2276,7 +2274,7 @@ ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);static inline bool ext4_verity_inode (struct inode *inode) { -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY return ext4_test_inode_flag (inode,EXT4_INODE_VERITY );#else return false;
fs/ext4/super.c +3 -3
@@ -1284,7 +1284,7 @@ static const struct fscrypt_operations ext4_cryptops = { };#endif -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY static int ext4_set_verity (struct inode *inode,loff_t data_i_size) {int err;
@@ -1359,7 +1359,7 @@ static const struct fsverity_operations ext4_verityops = { .set_verity = ext4_set_verity, .get_full_i_size = ext4_get_verity_full_size, }; -#endif /* CONFIG_EXT4_FS_VERITY */ +#endif /* CONFIG_FS_VERITY */ #ifdef CONFIG_QUOTA static const char *const quotatypes[] =INITQFNAMES ;
@@ -4182,7 +4182,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)#ifdef CONFIG_FS_ENCRYPTION sb->s_cop = &ext4_cryptops;#endif -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY sb->s_vop = &ext4_verityops;#endif #ifdef CONFIG_QUOTA
fs/ext4/sysfs.c +2 -2
@@ -223,7 +223,7 @@ EXT4_ATTR_FEATURE(meta_bg_resize);#ifdef CONFIG_FS_ENCRYPTION EXT4_ATTR_FEATURE (encryption);#endif -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY EXT4_ATTR_FEATURE (verity);#endif EXT4_ATTR_FEATURE (metadata_csum_seed);
@@ -235,7 +235,7 @@ static struct attribute *ext4_feat_attrs[] = {#ifdef CONFIG_FS_ENCRYPTION ATTR_LIST(encryption),#endif -#ifdef CONFIG_EXT4_FS_VERITY +#ifdef CONFIG_FS_VERITY ATTR_LIST (verity), #endif ATTR_LIST(metadata_csum_seed),
fs/verity/Kconfig +1 -1
@@ -1,5 +1,5 @@ config FS_VERITY - tristate "FS Verity (file-based integrity/authentication)" + bool "FS Verity (file-based integrity/authentication)" depends on BLOCK select CRYPTO # SHA-256 is selected as it's intended to be the default hash algorithm.
include/linux/fsverity.h +1 -2
@@ -19,8 +19,7 @@ struct fsverity_operations {int (*get_full_i_size)(struct inode *inode,loff_t *full_i_size_ret); }; -#if __FS_HAS_VERITY - +#ifdef CONFIG_FS_VERITY /* ioctl.c */ extern int fsverity_ioctl_enable (struct file *filp,const void __user *arg);extern int fsverity_ioctl_measure (struct file *filp,void __user *arg);
Signature · 1 line
2.9.5
Eric Biggers
maintainerHi Chandan, a couple questions:
Quoted 7 lines · Chandan Rajendra
As a first step to avoid copy-pasting common code across filesystems which implement fscrypt, this commit removes filesystem specific build config option (e.g.
CONFIG_EXT4_FS_ENCRYPTION) and replaces it with a build option (i.e.CONFIG_FS_ENCRYPTION) whose value affects all the filesystems making use of fscrypt.Signed-off-by Chandan Rajendra <[email protected]>
Can you be more explicit about the goal here? It's mostly about implementing ->readpages() when the filesystem may support both fscrypt and fs-verity, right?
fs/crypto/Kconfig line 5
Quoted 11 lines
fs/crypto/Kconfig +1
-1@@ -1,5 +1,5 @@ config FS_ENCRYPTION - tristate "FS Encryption (Per-file encryption)" + bool "FS Encryption (Per-file encryption)" select CRYPTO select CRYPTO_AES select CRYPTO_CBC
Is it possible to keep this as a module, rather than requiring that fs/crypto/ always be built-in? Making this a 'bool' will require all the selected crypto algorithms to be built-in too.
fs/crypto/Kconfig
Quoted 2 lines
fs/crypto/Kconfig +1
-1- if (ext4_encrypted_inode(inode)) { + if (IS_ENCRYPTED(inode)) {
I suggest doing the replacements of ext4_encrypted_inode() with IS_ENCRYPTED() as a standalone patch, so it's easier to review.
Also I suggest sending this patch to the ext4 and f2fs mailing lists too.
Thanks!
- Eric
Quoted 9 lines · IST Eric Biggers
Hi Chandan, a couple questions:
Quoted 6 lines · Chandan Rajendra
As a first step to avoid copy-pasting common code across filesystems which implement fscrypt, this commit removes filesystem specific build config option (e.g.
CONFIG_EXT4_FS_ENCRYPTION) and replaces it with a build option (i.e.CONFIG_FS_ENCRYPTION) whose value affects all the filesystems making use of fscrypt.
Quoted 4 lines
Quoted 1 line
Signed-off-by Chandan Rajendra <[email protected]>Can you be more explicit about the goal here? It's mostly about implementing ->readpages() when the filesystem may support both fscrypt and fs-verity, right?
You are right. I will add that to the commit message.
Quoted 16 lines
fs/crypto/Kconfig line 5
Quoted 12 lines
fs/crypto/Kconfig +1
-1@@ -1,5 +1,5 @@ config FS_ENCRYPTION - tristate "FS Encryption (Per-file encryption)" + bool "FS Encryption (Per-file encryption)" select CRYPTO select CRYPTO_AES select CRYPTO_CBCIs it possible to keep this as a module, rather than requiring that
fs/crypto/always be built-in? Making this a 'bool' will require all the selected crypto algorithms to be built-in too.
This could cause a scenario where any of the filesystems using CONFIG_FS_ENCRYPTION might be built into the kernel and CONFIG_FS_ENCRYPTION itself is marked as a module. This will cause the kernel build to end up with linker errors.
To solve this we would need to have dependency for CONFIG_FS_ENCRYPTION mentioned in individual filesystem's Kconfig i.e. We would be going back to the earlier per-filesystem encryption configuration.
Quoted 6 lines
fs/crypto/Kconfig
Quoted 3 lines
fs/crypto/Kconfig +1
-1- if (ext4_encrypted_inode(inode)) { + if (IS_ENCRYPTED(inode)) {I suggest doing the replacements of
ext4_encrypted_inode()withIS_ENCRYPTED()as a standalone patch, so it's easier to review.
Ok. I will do this. I will also have to add something equivalent to ext4_verity_inode().
Quoted 2 lines
Also I suggest sending this patch to the ext4 and f2fs mailing lists too.
Sure. I will send the next version of this patch to the above mentioned mailing lists.
Signature · 1 line
chandan