[f2fs-dev] [PATCH 3/5] f2fs: add comment for conditional compilation statement

2019-04-02 Thread Chao Yu
Commit af033b2aa8a8 ("f2fs: guarantee journalled quota data by checkpoint") added function is_journalled_quota() in f2fs.h, but it located outside of _LINUX_F2FS_H macro coverage, it has been fixed with commit 0af725fcb77a ("f2fs: fix wrong #endif"). But anyway, in order to avoid making same mista

[f2fs-dev] [PATCH 2/5] f2fs: fix potential recursive call when enabling data_flush

2019-04-02 Thread Chao Yu
As Hagbard Celine reported: Hi, this is a long standing bug that I've hit before on older kernels, but I was not able to get the syslog saved because of the nature of the bug. This time I had booted form a pen-drive, and was able to save the log to it's efi-partition. What i did to trigger it was

[f2fs-dev] [PATCH 4/5] f2fs: add tracepoint for f2fs_filemap_fault()

2019-04-02 Thread Chao Yu
This patch adds tracepoint for f2fs_filemap_fault(). Signed-off-by: Chao Yu --- fs/f2fs/file.c | 2 ++ include/trace/events/f2fs.h | 26 ++ 2 files changed, 28 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 30d49467578e..578486e03427 10064

[f2fs-dev] [PATCH 5/5] f2fs: add tracepoint for f2fs_file_write_iter()

2019-04-02 Thread Chao Yu
This patch adds tracepoint for f2fs_file_write_iter(). Signed-off-by: Chao Yu --- fs/f2fs/file.c | 28 +++- include/trace/events/f2fs.h | 31 +++ 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f

[f2fs-dev] [PATCH 1/5] f2fs: clean up codes with op_is_write()

2019-04-02 Thread Chao Yu
This patch uses generic function op_is_write() to instead private defined macro is_read_io() for cleanup. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 25 + fs/f2fs/f2fs.h | 3 +-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/d

Re: [f2fs-dev] BUG: kernel stack overflow when mounting with data_flush

2019-04-02 Thread Hagbard Celine
That seems to have fixed it. No more errors in syslog after extracting my stage3 tarball. Also ran a couple of kernel compiles on a partition mounted with data_flush and system seems stable. 2019-04-01 10:05 GMT+02:00, Chao Yu : > On 2019/3/31 2:54, Hagbard Celine wrote: >> First, yes it is caused

Re: [f2fs-dev] BUG: kernel stack overflow when mounting with data_flush

2019-04-02 Thread Chao Yu
On 2019-4-2 20:41, Hagbard Celine wrote: > That seems to have fixed it. No more errors in syslog after extracting > my stage3 tarball. Also ran a couple of kernel compiles on a partition > mounted with data_flush and system seems stable. Thanks a lot for your quick test. :) Thanks, > > 2019-04-

[f2fs-dev] [PATCH v4 00/17] fscrypt: key management improvements

2019-04-02 Thread Eric Biggers
Hello, This patchset makes major improvements to how keys are added, removed, and derived in fscrypt, aka ext4/f2fs/ubifs encryption. It does this by adding new ioctls that add and remove encryption keys directly to/from the filesystem, and by adding a new encryption policy version ("v2") where t

[f2fs-dev] [PATCH v4 10/17] fscrypt: add an HKDF-SHA512 implementation

2019-04-02 Thread Eric Biggers
From: Eric Biggers Add an implementation of HKDF (RFC 5869) to fscrypt, for the purpose of deriving additional key material from the fscrypt master keys for v2 encryption policies. HKDF is a key derivation function built on top of HMAC. We choose SHA-512 for the underlying unkeyed hash, and use

[f2fs-dev] [PATCH v4 09/17] fscrypt: add FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl

2019-04-02 Thread Eric Biggers
From: Eric Biggers Add a new fscrypt ioctl, FS_IOC_GET_ENCRYPTION_KEY_STATUS. Given a key specified by 'struct fscrypt_key_specifier' (the same way a key is specified for the other fscrypt key management ioctls), it returns status information in a 'struct fscrypt_get_key_status_arg'. The main m

[f2fs-dev] [PATCH v4 03/17] fscrypt: use FSCRYPT_* definitions, not FS_*

2019-04-02 Thread Eric Biggers
From: Eric Biggers Update fs/crypto/ to use the new names for the UAPI constants rather than the old names, then make the old definitions conditional on !__KERNEL__. Signed-off-by: Eric Biggers --- fs/crypto/crypto.c | 2 +- fs/crypto/fname.c| 2 +- fs/crypto/fscrypt_pr

[f2fs-dev] [PATCH v4 17/17] fscrypt: document the new ioctls and policy version

2019-04-02 Thread Eric Biggers
From: Eric Biggers Update the fscrypt documentation file to catch up to all the latest changes, including the new ioctls to manage master encryption keys in the filesystem-level keyring and the support for v2 encryption policies. Signed-off-by: Eric Biggers --- Documentation/filesystems/fscryp

[f2fs-dev] [PATCH v4 01/17] fs, fscrypt: move uapi definitions to new header

2019-04-02 Thread Eric Biggers
From: Eric Biggers More fscrypt definitions are being added, and we shouldn't use a disproportionate amount of space in for fscrypt stuff. So move the fscrypt definitions to a new header . For source compatibility with existing userspace programs, still includes the new header. Signed-off-by:

[f2fs-dev] [PATCH v4 05/17] fscrypt: refactor v1 policy key setup into keysetup_legacy.c

2019-04-02 Thread Eric Biggers
From: Eric Biggers In preparation for introducing v2 encryption policies which will find and derive encryption keys differently from the current v1 encryption policies, refactor the v1 policy-specific key setup code from keyinfo.c into keysetup_legacy.c. Then rename keyinfo.c to keysetup.c. Not

[f2fs-dev] [PATCH v4 08/17] fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl

2019-04-02 Thread Eric Biggers
From: Eric Biggers Add a new fscrypt ioctl, FS_IOC_REMOVE_ENCRYPTION_KEY. This ioctl removes an encryption key that was added by FS_IOC_ADD_ENCRYPTION_KEY. It wipes the secret key itself, then "locks" the encrypted files and directories that had been unlocked using that key -- implemented by evi

[f2fs-dev] [PATCH v4 14/17] ext4: wire up new fscrypt ioctls

2019-04-02 Thread Eric Biggers
From: Eric Biggers Wire up the new ioctls for adding and removing fscrypt keys to/from the filesystem, and the new ioctl for retrieving v2 encryption policies. FS_IOC_REMOVE_ENCRYPTION_KEY also required making ext4_drop_inode() call fscrypt_drop_inode(). For more details see Documentation/files

[f2fs-dev] [PATCH v4 07/17] fs/dcache.c: add shrink_dcache_inode()

2019-04-02 Thread Eric Biggers
From: Eric Biggers When a filesystem encryption key is removed, we need all files which had been "unlocked" (had ->i_crypt_info set up) with it to appear "locked" again. This is most easily done by evicting the inodes. This can currently be done using 'echo 2 > /proc/sys/vm/drop_caches'; howeve

[f2fs-dev] [PATCH v4 06/17] fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl

2019-04-02 Thread Eric Biggers
From: Eric Biggers Add a new fscrypt ioctl, FS_IOC_ADD_ENCRYPTION_KEY. This ioctl adds an encryption key to the filesystem's fscrypt keyring ->s_master_keys, making any files encrypted with that key appear "unlocked". Why we need this The main problem is that the "locked/unloc

[f2fs-dev] [PATCH v4 02/17] fscrypt: use FSCRYPT_ prefix for uapi constants

2019-04-02 Thread Eric Biggers
From: Eric Biggers Prefix all filesystem encryption UAPI constants except the ioctl numbers with "FSCRYPT_" rather than with "FS_". This namespaces the constants more appropriately and makes it clear that they are related specifically to the filesystem encryption feature, and to the 'fscrypt_*'

[f2fs-dev] [PATCH v4 11/17] fscrypt: v2 encryption policy support

2019-04-02 Thread Eric Biggers
From: Eric Biggers Add a new fscrypt policy version, "v2". It has the following changes from the original policy version, which we call "v1" (*): - Master keys (the user-provided encryption keys) are only ever used as input to HKDF-SHA512. This is more flexible and less error-prone, and it

[f2fs-dev] [PATCH v4 12/17] fscrypt: allow unprivileged users to add/remove keys for v2 policies

2019-04-02 Thread Eric Biggers
From: Eric Biggers Allow the FS_IOC_ADD_ENCRYPTION_KEY and FS_IOC_REMOVE_ENCRYPTION_KEY ioctls to be used by non-root users to add and remove encryption keys from the filesystem-level crypto keyrings, subject to limitations. Motivation: while privileged fscrypt key management is sufficient for s

[f2fs-dev] [PATCH v4 15/17] f2fs: wire up new fscrypt ioctls

2019-04-02 Thread Eric Biggers
From: Eric Biggers Wire up the new ioctls for adding and removing fscrypt keys to/from the filesystem, and the new ioctl for retrieving v2 encryption policies. FS_IOC_REMOVE_ENCRYPTION_KEY also required making f2fs_drop_inode() call fscrypt_drop_inode(). For more details see Documentation/files

[f2fs-dev] [PATCH v4 16/17] ubifs: wire up new fscrypt ioctls

2019-04-02 Thread Eric Biggers
From: Eric Biggers Wire up the new ioctls for adding and removing fscrypt keys to/from the filesystem, and the new ioctl for retrieving v2 encryption policies. FS_IOC_REMOVE_ENCRYPTION_KEY also required making UBIFS use fscrypt_drop_inode(). For more details see Documentation/filesystems/fscryp

[f2fs-dev] [PATCH v4 13/17] fscrypt: require that key be added when setting a v2 encryption policy

2019-04-02 Thread Eric Biggers
From: Eric Biggers By looking up the master keys in a filesystem-level keyring rather than in the calling processes' key hierarchy, it becomes possible for a user to set an encryption policy which refers to some key they don't actually know, then encrypt their files using that key. Cryptographic

[f2fs-dev] [PATCH v4 04/17] fscrypt: add ->ci_inode to fscrypt_info

2019-04-02 Thread Eric Biggers
From: Eric Biggers Add an inode back-pointer to 'struct fscrypt_info', such that inode->i_crypt_info->ci_inode == inode. This will be useful for: 1. Evicting the inodes when a fscrypt key is removed, since we'll track the inodes using a given key by linking their fscrypt_infos together, r

[f2fs-dev] Possible issues with fsck of f2fs root

2019-04-02 Thread Hagbard Celine
Hi, I lost the root filesystem on my previous install after a few weeks of several power outages last winter. While trying to recover I discovered that it seem fsck was never run properly during boot in the lifetime of that install. After getting the system installed again a while ago, I have been