Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Heming Zhao <heming.zhao@suse.com>
To: Jan Kara <jack@suse.cz>, Liebes Wang <wanghaichi0403@gmail.com>
Cc: tytso@mit.edu, jack@suse.com, linux-ext4@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	ocfs2-devel@lists.linux.dev
Subject: Re: WARNING in jbd2_journal_update_sb_log_tail
Date: Tue, 14 Jan 2025 14:25:21 +0800	[thread overview]
Message-ID: <24f378c8-7a27-47b8-bd79-dba4a2e92f6d@suse.com> (raw)
In-Reply-To: <mzypseklhk6colsb5fh42ya74x43z5mmkzdjdyluesx6hb744a@hycbebanf7mv>

Hi Jan,

On 1/6/25 23:14, Jan Kara wrote:
> On Tue 31-12-24 13:53:23, Liebes Wang wrote:
>> Dear Linux maintainers and reviewers:
>>
>> We are reporting a Linux kernel bug titled **WARNING in
>> jbd2_journal_update_sb_log_tail**, discovered using a modified version of
>> Syzkaller.
> 
> Very likely this is actually some issue with ocfs2 since the only thing the
> reproducer seems to be doing is that it is mounting ocfs2 image. Joseph,
> can you have a look please?
> 
> 								Honza

The root cause appears to be that the jbd2 bypass recovery logic
is incorrect.

 From the console log [1]:
  [   70.568684][ T5316] JBD2: Ignoring recovery information on journal

The above output indicates that ocfs2 is calling jbd2_journal_wipe()
to clean up jbd2. (IIUC), Therefore, the subsequent jbd2 initialization
flow should not perform any recovery tasks.

However, in this crash issue, after calling jbd2_journal_wipe(),
jbd2_journal_load() still attempts to perform a recovery, which triggers
a WARN_ON().

On the other hand, the jbd2 code logic is correct, ocfs2 should call
ocfs2_journal_wipe() with the parameter 'write=1' to address this issue.

code flow:
ocfs2_mount_volume
  ocfs2_check_volume
  + ocfs2_journal_init => jbd2_journal_init_inode
  + ocfs2_journal_wipe => jbd2_journal_wipe (input write is 0)
  + ocfs2_journal_load => jbd2_journal_load => do recovery job => WARN_ON()

[1]: 2024/01/12 06:56 log
https://syzkaller.appspot.com/text?tag=CrashLog&x=106f2bc4580000

Thanks,
Heming

> 
>> Linux version: v6.12-rc6:59b723cd2adbac2a34fc8e12c74ae26ae45bf230 (crash is
>> also reproduced in the latest kernel version)
>> The test case and kernel config is in attach.
>>
>> The warning report is (The full report is attached):
>>
>> WARNING: CPU: 0 PID: 6139 at fs/jbd2/journal.c:1887
>> jbd2_journal_update_sb_log_tail+0x32d/0x3b0 fs/jbd2/journal.c:1887
>> Modules linked in:
>> CPU: 0 UID: 0 PID: 6139 Comm: syz.7.135 Not tainted 6.12.0-rc6 #1
>> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
>> 1.13.0-1ubuntu1.1 04/01/2014
>> RIP: 0010:jbd2_journal_update_sb_log_tail+0x32d/0x3b0 fs/jbd2/journal.c:1887
>> Code: fe ff ff e8 05 0e a7 ff e9 f4 fd ff ff e8 eb 0e a7 ff e9 16 ff ff ff
>> 4c 89 ef e8 de 0e a7 ff e9 d5 fe ff ff e8 94 ec 54 ff 90 <0f> 0b 90 eb 88
>> 41 bc fb ff ff ff e9 13 ff ff ff e8 7e ec 54 ff be
>> RSP: 0018:ff1100013b6ff818 EFLAGS: 00010246
>> RAX: 0000000000040000 RBX: 0000000000000000 RCX: ffa00000034b3000
>> RDX: 0000000000040000 RSI: ffffffff81fd15ec RDI: 0000000000000005
>> RBP: ff110001405ce000 R08: 0000000000000001 R09: ffe21c00276dfef5
>> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
>> R13: ff11000107e3a018 R14: ff11000107e3a000 R15: ff110001405ce0b0
>> FS:  00007ff345cd5700(0000) GS:ff110004ca800000(0000) knlGS:0000000000000000
>> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00007ff3470375c0 CR3: 0000000117544001 CR4: 0000000000771ef0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> PKRU: 80000000
>> Call Trace:
>>   <TASK>
>>   journal_reset fs/jbd2/journal.c:1779 [inline]
>>   jbd2_journal_load fs/jbd2/journal.c:2109 [inline]
>>   jbd2_journal_load+0x93e/0xcf0 fs/jbd2/journal.c:2074
>>   ocfs2_journal_load+0xbe/0x5e0 fs/ocfs2/journal.c:1143
>>   ocfs2_check_volume fs/ocfs2/super.c:2421 [inline]
>>   ocfs2_mount_volume fs/ocfs2/super.c:1817 [inline]
>>   ocfs2_fill_super+0x19f1/0x4170 fs/ocfs2/super.c:1084
>>   mount_bdev+0x1e6/0x2d0 fs/super.c:1693
>>   legacy_get_tree+0x107/0x220 fs/fs_context.c:662
>>   vfs_get_tree+0x94/0x380 fs/super.c:1814
>>   do_new_mount fs/namespace.c:3507 [inline]
>>   path_mount+0x6b2/0x1eb0 fs/namespace.c:3834
>>   do_mount fs/namespace.c:3847 [inline]
>>   __do_sys_mount fs/namespace.c:4057 [inline]
>>   __se_sys_mount fs/namespace.c:4034 [inline]
>>   __x64_sys_mount+0x283/0x300 fs/namespace.c:4034
>>   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>>   do_syscall_64+0xc1/0x1d0 arch/x86/entry/common.c:83
>>   entry_SYSCALL_64_after_hwframe+0x77/0x7f


  reply	other threads:[~2025-01-14  6:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-31  5:53 WARNING in jbd2_journal_update_sb_log_tail Liebes Wang
2025-01-06 15:14 ` Jan Kara
2025-01-14  6:25   ` Heming Zhao [this message]
2025-01-14 12:29     ` Jan Kara
2025-01-14 13:38     ` Theodore Ts'o
2025-01-14 14:51       ` Heming Zhao
2025-01-15  1:32         ` Liebes Wang
2025-01-15  5:00           ` Heming Zhao
2025-01-15 17:53             ` Jan Kara
2025-01-21 16:55               ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24f378c8-7a27-47b8-bd79-dba4a2e92f6d@suse.com \
    --to=heming.zhao@suse.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=syzkaller@googlegroups.com \
    --cc=tytso@mit.edu \
    --cc=wanghaichi0403@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox