From: Jan Kara <jack@suse.cz>
To: Edward Adam Davis <eadavis@qq.com>
Cc: syzbot+cdee56dbcdf0096ef605@syzkaller.appspotmail.com,
adilger.kernel@dilger.ca, chandan.babu@oracle.com, jack@suse.com,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
syzkaller-bugs@googlegroups.com, tytso@mit.edu
Subject: Re: [PATCH] jbd2: user-memory-access in jbd2__journal_start
Date: Wed, 31 Jan 2024 16:41:53 +0100 [thread overview]
Message-ID: <20240131154153.domdzkkbqgpkplp2@quack3> (raw)
In-Reply-To: <tencent_7F29369E974036964A3E742F778567CC3C09@qq.com>
On Wed 31-01-24 20:04:27, Edward Adam Davis wrote:
> Before reusing the handle, it is necessary to confirm that the transaction is
> ready.
>
> Reported-and-tested-by: syzbot+cdee56dbcdf0096ef605@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Sorry but no. Dave found a way to fix this particular problem in XFS and
your patch would not really improve anything because we'd just crash
when dereferencing handle->saved_alloc_context.
Honza
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index cb0b8d6fc0c6..702312cd5392 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -493,6 +493,9 @@ handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int rsv_blocks,
> return ERR_PTR(-EROFS);
>
> if (handle) {
> + if (handle->saved_alloc_context & ~PF_MEMALLOC_NOFS)
> + return ERR_PTR(-EBUSY);
> +
> J_ASSERT(handle->h_transaction->t_journal == journal);
> handle->h_ref++;
> return handle;
> --
> 2.43.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
prev parent reply other threads:[~2024-01-31 15:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 9:05 [syzbot] [ext4?] general protection fault in jbd2__journal_start syzbot
2024-01-30 14:52 ` [syzbot] [xfs?] " syzbot
2024-01-30 23:37 ` current->journal_info got nested! (was Re: [syzbot] [xfs?] [ext4?] general protection fault in jbd2__journal_start) Dave Chinner
2024-01-31 3:46 ` Darrick J. Wong
2024-01-31 4:58 ` Theodore Ts'o
2024-01-31 5:20 ` Matthew Wilcox
2024-01-31 5:47 ` Christoph Hellwig
2024-01-31 6:02 ` Dave Chinner
2024-01-31 6:17 ` Christoph Hellwig
2024-01-31 12:02 ` Jan Kara
2024-01-31 12:04 ` [PATCH] jbd2: user-memory-access in jbd2__journal_start Edward Adam Davis
2024-01-31 15:41 ` Jan Kara [this message]
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=20240131154153.domdzkkbqgpkplp2@quack3 \
--to=jack@suse.cz \
--cc=adilger.kernel@dilger.ca \
--cc=chandan.babu@oracle.com \
--cc=eadavis@qq.com \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=syzbot+cdee56dbcdf0096ef605@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tytso@mit.edu \
/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