[f2fs-dev] [PATCH 2/3] f2fs: support checkpoint error injection

2016-09-22 Thread Chao Yu
This patch adds to support checkpoint error injection in f2fs for testing fatal error tolerance. Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 7 +++ fs/f2fs/super.c | 1 + 2 files changed, 8 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index

[f2fs-dev] [PATCH 3/3] f2fs: fix potential deadlock when hitting checkpoint error

2016-09-22 Thread Chao Yu
tests/generic/013 of fstest suit complains us with below dmesg when we trigger checkpoint error injection in f2fs. F2FS-fs : inject checkpoint error in sync_node_pages+0x69f/0x6f0 [f2fs] F2FS-fs (zram0): Cannot recover all fsync data errno=-5 INFO: task mount:97685 blocked for more than 120

[f2fs-dev] [PATCH 1/3] f2fs: adjust display format of segment bit

2016-09-22 Thread Chao Yu
Just adjust segment bit info printed in procfs. Before: 1008 5|0 |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1009 3|183|0 0 61 20 20 0 0 21 80 c0 2 e4 e 54 0 21 21 17 a 44 d0 28 e4 50 40 30 8 0 2d 32

Re: [f2fs-dev] ext4, f2fs: fscrypt_has_permitted_context() check in file open

2016-09-22 Thread Richard Weinberger
Ted, On 22.09.2016 15:44, Theodore Ts'o wrote: > On Thu, Sep 22, 2016 at 02:24:35PM +0200, Richard Weinberger wrote: >> Why do we need this check? AFAIK this situation can never happen unless due >> to >> a bug in the filesystem code. > > Or in the case of a malicious attacker who is trying to

Re: [f2fs-dev] [PATCH] mkfs.f2fs: do not need strdup for parse_feature

2016-09-22 Thread Chao Yu
On 2016/9/21 18:09, Yunlong Song wrote: > strdup is useless here, with no free op with its return value. > > Signed-off-by: Yunlong Song Acked-by: Chao Yu --

[f2fs-dev] fscrypt: in-place decrypt vs. out-of-place encrypt?

2016-09-22 Thread Richard Weinberger
Hi! While reading the fscrypt code I noticed that some functions use the bounce pages and some not. fscrypt_decrypt_page() and fscrypt_decrypt_bio_pages() work in-place while fscrypt_encrypt_page() and fscrypt_zeroout_range() use a bounce page. So, both ext4 and f2fs encrypt data using an extra

Re: [f2fs-dev] [PATCH 1/4] f2fs: assign return value in f2fs_gc

2016-09-22 Thread Chao Yu
On 2016/9/22 11:54, Jaegeuk Kim wrote: > This patch adds a return value of write_checkpoint for f2fs_gc. > > Signed-off-by: Jaegeuk Kim Please add this in all patches of this serials. Reviewed-by: Chao Yu

Re: [f2fs-dev] [PATCH] f2fs: No need to wait for data page writeback by force

2016-09-22 Thread Chao Yu
Hi Yunlei, On 2016/9/21 18:41, Yunlei He wrote: > No need to wait for data page writeback, wait or not > can be decided by device. > > Signed-off-by: Yunlei He > --- > fs/f2fs/segment.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [f2fs-dev] [PATCH] f2fs: continue to do fg_gc even if beyond max_victim_search

2016-09-22 Thread Chao Yu
On 2016/9/22 11:48, Yunlei He wrote: > For forground gc, if can't find a victim in one max_victim_search, > try it again. > > Signed-off-by: Yunlei He > --- > fs/f2fs/gc.c | 23 --- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git

Re: [f2fs-dev] [PATCH] fsck.f2fs: free node_blk to avoid memory leak

2016-09-22 Thread Chao Yu
On 2016/9/21 21:01, Yunlong Song wrote: > Signed-off-by: Yunlong Song Acked-by: Chao Yu -- ___ Linux-f2fs-devel mailing list

[f2fs-dev] ext4, f2fs: fscrypt_has_permitted_context() check in file open

2016-09-22 Thread Richard Weinberger
Hi! Both ext4 and f2fs check in the file open code the context of the parent directory too: ext4: if (ext4_encrypted_inode(d_inode(dir)) && !fscrypt_has_permitted_context(d_inode(dir), inode)) { ext4_warning(inode->i_sb,

Re: [f2fs-dev] ext4, f2fs: fscrypt_has_permitted_context() check in file open

2016-09-22 Thread Theodore Ts'o
On Thu, Sep 22, 2016 at 04:21:30PM +0200, Richard Weinberger wrote: > > Got it. So, the use case is preventing off-line attacks. > But I fear this is only a drop in the bucket. What we really need is > meta data authentication. True security requires a system-wide design, sure. For example, you

[f2fs-dev] [PATCH] f2fs: do not unnecessarily null-terminate encrypted symlink data

2016-09-22 Thread Eric Biggers
Null-terminating the fscrypt_symlink_data on read is unnecessary because it is not string data --- it contains binary ciphertext. Signed-off-by: Eric Biggers --- fs/f2fs/namei.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index

[f2fs-dev] [PATCH] ext4: do not unnecessarily null-terminate encrypted symlink data

2016-09-22 Thread Eric Biggers
Null-terminating the fscrypt_symlink_data on read is unnecessary because it is not string data --- it contains binary ciphertext. Signed-off-by: Eric Biggers --- fs/ext4/symlink.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c

Re: [f2fs-dev] fscrypt: in-place decrypt vs. out-of-place encrypt?

2016-09-22 Thread Richard Weinberger
Ted, On 22.09.2016 15:14, Theodore Ts'o wrote: > On Thu, Sep 22, 2016 at 10:49:41AM +0200, Richard Weinberger wrote: >> >> While reading the fscrypt code I noticed that some functions use the bounce >> pages >> and some not. >> fscrypt_decrypt_page() and fscrypt_decrypt_bio_pages() work in-place

Re: [f2fs-dev] fscrypt: in-place decrypt vs. out-of-place encrypt?

2016-09-22 Thread Theodore Ts'o
On Thu, Sep 22, 2016 at 10:49:41AM +0200, Richard Weinberger wrote: > > While reading the fscrypt code I noticed that some functions use the bounce > pages > and some not. > fscrypt_decrypt_page() and fscrypt_decrypt_bio_pages() work in-place while > fscrypt_encrypt_page() and

Re: [f2fs-dev] ext4, f2fs: fscrypt_has_permitted_context() check in file open

2016-09-22 Thread Theodore Ts'o
On Thu, Sep 22, 2016 at 02:24:35PM +0200, Richard Weinberger wrote: > Hi! > > Both ext4 and f2fs check in the file open code the context of the parent > directory too: > > ext4: > if (ext4_encrypted_inode(d_inode(dir)) && >