Re: [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super

2024-01-12 Thread syzbot
syzbot has bisected this issue to: commit 275dca4630c165edea9abe27113766bc1173f878 Author: Eric Biggers Date: Wed Dec 27 17:14:28 2023 + f2fs: move release of block devices to after kill_block_super() bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16071613e8 start

[f2fs-dev] [PATCH v5 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2024-01-12 Thread Chao Yu
If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint. Fixes: 4c8ff7095bef ("f2fs: support data compression") Reviewed-by: Daeho Jeong Signed-off-by: Chao Yu ---

[f2fs-dev] [PATCH v5 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2024-01-12 Thread Chao Yu
When we overwrite compressed cluster w/ normal cluster, we should not unlock cp_rwsem during f2fs_write_raw_pages(), otherwise data will be corrupted if partial blocks were persisted before CP & SPOR, due to cluster metadata wasn't updated atomically. Fixes: 4c8ff7095bef ("f2fs: support data

[f2fs-dev] [PATCH v5 3/6] f2fs: compress: fix to check unreleased compressed cluster

2024-01-12 Thread Chao Yu
From: Sheng Yong Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks(). Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Sheng Yong Signed-off-by: Chao Yu

[f2fs-dev] [PATCH v5 5/6] f2fs: fix to remove unnecessary f2fs_bug_on() to avoid panic

2024-01-12 Thread Chao Yu
verify_blkaddr() will trigger panic once we inject fault into f2fs_is_valid_blkaddr(), fix to remove this unnecessary f2fs_bug_on(). Fixes: 18792e64c86d ("f2fs: support fault injection for f2fs_is_valid_blkaddr()") Reviewed-by: Daeho Jeong Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 4 +--- 1

[f2fs-dev] [PATCH v5 6/6] f2fs: introduce FAULT_BLKADDR_CONSISTENCE

2024-01-12 Thread Chao Yu
We will encounter below inconsistent status when FAULT_BLKADDR type fault injection is on. Info: checkpoint state = d6 : nat_bits crc fsck compacted_summary orphan_inodes sudden-power-off [ASSERT] (fsck_chk_inode_blk:1254) --> ino: 0x1c100 has i_blocks: 00c0, but has 191 blocks [FIX]

[f2fs-dev] [PATCH v5 4/6] f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode

2024-01-12 Thread Chao Yu
In reserve_compress_blocks(), we update blkaddrs of dnode in prior to inc_valid_block_count(), it may cause inconsistent status bewteen i_blocks and blkaddrs once inc_valid_block_count() fails. To fix this issue, it needs to reverse their invoking order. Fixes: c75488fb4d82 ("f2fs: introduce

Re: [f2fs-dev] [PATCH v4 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2024-01-12 Thread Chao Yu
Thanks, let me resend v5 w/ blow cleanups. On 2024/1/13 9:39, Jaegeuk Kim wrote: Cleaned up a bit: --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1443,13 +1443,14 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page) } static int f2fs_write_raw_pages(struct

Re: [f2fs-dev] [PATCH] f2fs: remove unnecessary f2fs_put_page in f2fs_rename

2024-01-12 Thread Chao Yu
On 2024/1/13 1:16, Jaegeuk Kim wrote: [1] changed the below condition, which made f2fs_put_page() voided. This patch reapplies the AL's resolution in -next from [2]. - if (S_ISDIR(old_inode->i_mode)) { + if (old_is_dir && old_dir != new_dir) { old_dir_entry =

Re: [PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Jaegeuk Kim
On 01/12, Eric Biggers wrote: > On Fri, Jan 12, 2024 at 05:28:31PM -0800, Jaegeuk Kim wrote: > > On 01/12, Eric Biggers wrote: > > > On Fri, Jan 12, 2024 at 04:57:47PM -0800, Eric Biggers wrote: > > > > From: Eric Biggers > > > > > > > > kill_f2fs_super() is called even if f2fs_fill_super()

Re: [f2fs-dev] [PATCH v4 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2024-01-12 Thread Jaegeuk Kim
Cleaned up a bit: --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1443,13 +1443,14 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page) } static int f2fs_write_raw_pages(struct compress_ctx *cc, - int *submitted, +

Re: [PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Eric Biggers
On Fri, Jan 12, 2024 at 05:28:31PM -0800, Jaegeuk Kim wrote: > On 01/12, Eric Biggers wrote: > > On Fri, Jan 12, 2024 at 04:57:47PM -0800, Eric Biggers wrote: > > > From: Eric Biggers > > > > > > kill_f2fs_super() is called even if f2fs_fill_super() fails. > > > f2fs_fill_super() frees the

Re: [PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Jaegeuk Kim
On 01/12, Eric Biggers wrote: > On Fri, Jan 12, 2024 at 04:57:47PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > kill_f2fs_super() is called even if f2fs_fill_super() fails. > > f2fs_fill_super() frees the struct f2fs_sb_info, so it must set > > sb->s_fs_info to NULL to prevent it

Re: [f2fs-dev] [PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Chao Yu
On 2024/1/13 8:57, Eric Biggers wrote: From: Eric Biggers kill_f2fs_super() is called even if f2fs_fill_super() fails. f2fs_fill_super() frees the struct f2fs_sb_info, so it must set sb->s_fs_info to NULL to prevent it from being freed again. Oh, I missed that case as well during reviewing,

Re: [PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Eric Biggers
On Fri, Jan 12, 2024 at 04:57:47PM -0800, Eric Biggers wrote: > From: Eric Biggers > > kill_f2fs_super() is called even if f2fs_fill_super() fails. > f2fs_fill_super() frees the struct f2fs_sb_info, so it must set > sb->s_fs_info to NULL to prevent it from being freed again. > > Fixes:

[PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Eric Biggers
From: Eric Biggers kill_f2fs_super() is called even if f2fs_fill_super() fails. f2fs_fill_super() frees the struct f2fs_sb_info, so it must set sb->s_fs_info to NULL to prevent it from being freed again. Fixes: 275dca4630c1 ("f2fs: move release of block devices to after kill_block_super()")

Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super

2024-01-12 Thread Eric Biggers
On Fri, Jan 12, 2024 at 04:32:21PM -0800, syzbot wrote: > loop0: detected capacity change from 0 to 63271 > F2FS-fs (loop0): Mismatch start address, segment0(512) cp_blkaddr(605) > F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock > F2FS-fs (loop0): invalid crc value > F2FS-fs

Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super

2024-01-12 Thread syzbot
syzbot has found a reproducer for the following issue on: HEAD commit:70d201a40823 Merge tag 'f2fs-for-6.8-rc1' of git://git.ker.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=176d9debe8 kernel config:

Re: [f2fs-dev] [PATCH v4 6/6] f2fs: introduce FAULT_BLKADDR_CONSISTENCE

2024-01-12 Thread Daeho Jeong
Reviewed-by: Daeho Jeong On Wed, Jan 10, 2024 at 10:43 PM Chao Yu wrote: > > We will encounter below inconsistent status when FAULT_BLKADDR type > fault injection is on. > > Info: checkpoint state = d6 : nat_bits crc fsck compacted_summary > orphan_inodes sudden-power-off > [ASSERT]

Re: [f2fs-dev] [PATCH v4 5/6] f2fs: fix to remove unnecessary f2fs_bug_on() to avoid panic

2024-01-12 Thread Daeho Jeong
Reviewed-by: Daeho Jeong On Wed, Jan 10, 2024 at 10:43 PM Chao Yu wrote: > > verify_blkaddr() will trigger panic once we inject fault into > f2fs_is_valid_blkaddr(), fix to remove this unnecessary f2fs_bug_on(). > > Fixes: 18792e64c86d ("f2fs: support fault injection for >

Re: [f2fs-dev] [PATCH v4 4/6] f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode

2024-01-12 Thread Daeho Jeong
Reviewed-by: Daeho Jeong On Wed, Jan 10, 2024 at 10:43 PM Chao Yu wrote: > > In reserve_compress_blocks(), we update blkaddrs of dnode in prior to > inc_valid_block_count(), it may cause inconsistent status bewteen > i_blocks and blkaddrs once inc_valid_block_count() fails. > > To fix this

Re: [f2fs-dev] [PATCH v3 3/6] f2fs: compress: fix to check unreleased compressed cluster

2024-01-12 Thread Daeho Jeong
On Thu, Jan 11, 2024 at 5:06 PM Chao Yu wrote: > > On 2024/1/12 1:15, Daeho Jeong wrote: > > On Wed, Jan 10, 2024 at 5:33 PM Chao Yu wrote: > >> > >> On 2024/1/11 9:18, Daeho Jeong wrote: > >>> On Thu, Dec 28, 2023 at 6:33 AM Chao Yu wrote: > > From: Sheng Yong > >

Re: [f2fs-dev] [PATCH v3 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2024-01-12 Thread Daeho Jeong
Reviewed-by: Daeho Jeong On Thu, Jan 11, 2024 at 9:17 AM Daeho Jeong wrote: > > On Wed, Jan 10, 2024 at 5:26 PM Chao Yu wrote: > > > > On 2024/1/11 8:55, Daeho Jeong wrote: > > > On Thu, Dec 28, 2023 at 6:33 AM Chao Yu wrote: > > >> > > >> If data block in compressed cluster is not persisted

Re: [f2fs-dev] [PATCH v4 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2024-01-12 Thread Daeho Jeong
Reviewed-by: Daeho Jeong On Wed, Jan 10, 2024 at 10:43 PM Chao Yu wrote: > > When we overwrite compressed cluster w/ normal cluster, we should > not unlock cp_rwsem during f2fs_write_raw_pages(), otherwise data > will be corrupted if partial blocks were persisted before CP & SPOR, > due to

Re: [f2fs-dev] [GIT PULL] f2fs update for 6.8-rc1

2024-01-12 Thread Linus Torvalds
On Thu, 11 Jan 2024 at 23:12, Al Viro wrote: > > Where would you end up with old_dir_page != NULL and old_dir_entry == NULL? D'oh. You are of course right, and I missed that connection. Happily my merge still works, just isn't as minimal as yours. I see that Jaegeuk already posted the patch

Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super

2024-01-12 Thread syzbot
syzbot has found a reproducer for the following issue on: HEAD commit:70d201a40823 Merge tag 'f2fs-for-6.8-rc1' of git://git.ker.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=13973ca5e8 kernel config:

[f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super

2024-01-12 Thread syzbot
Hello, syzbot found the following issue on: HEAD commit:70d201a40823 Merge tag 'f2fs-for-6.8-rc1' of git://git.ker.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=17e19adbe8 kernel config: https://syzkaller.appspot.com/x/.config?x=4607bc15d1c4bb90

Re: [f2fs-dev] [GIT PULL] f2fs update for 6.8-rc1

2024-01-12 Thread Jaegeuk Kim
Posted this. https://lore.kernel.org/lkml/20240112171645.3929428-1-jaeg...@kernel.org/T/#u On 01/12, Jaegeuk Kim wrote: > On 01/12, Al Viro wrote: > > On Thu, Jan 11, 2024 at 09:05:51PM -0800, Linus Torvalds wrote: > > > On Thu, 11 Jan 2024 at 10:28, Jaegeuk Kim wrote: > > > > > > > >

[f2fs-dev] [PATCH] f2fs: remove unnecessary f2fs_put_page in f2fs_rename

2024-01-12 Thread Jaegeuk Kim
[1] changed the below condition, which made f2fs_put_page() voided. This patch reapplies the AL's resolution in -next from [2]. - if (S_ISDIR(old_inode->i_mode)) { + if (old_is_dir && old_dir != new_dir) { old_dir_entry = f2fs_parent_dir(old_inode, _dir_page);

Re: [f2fs-dev] [GIT PULL] f2fs update for 6.8-rc1

2024-01-12 Thread Jaegeuk Kim
On 01/12, Al Viro wrote: > On Thu, Jan 11, 2024 at 09:05:51PM -0800, Linus Torvalds wrote: > > On Thu, 11 Jan 2024 at 10:28, Jaegeuk Kim wrote: > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git > > > tags/f2fs-for-6.8-rc1 > > > > Hmm. I got a somewhat confusing

Re: [PATCH v2 0/4] xfstests: test custom crypto data unit size

2024-01-12 Thread Zorro Lang
On Wed, Jan 10, 2024 at 07:54:44PM -0800, Eric Biggers wrote: > On Tue, Nov 21, 2023 at 02:39:05PM -0800, Eric Biggers wrote: > > This series adds a test that verifies the on-disk format of encrypted > > files that use a crypto data unit size that differs from the filesystem > > block size. This