From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Eric Sandeen <sandeen@sandeen.net>
Subject: Re: [PATCH 3/3] ext4: Avoid freeing inodes on dirty list
Date: Thu, 14 May 2020 10:57:44 -0400	[thread overview]
Message-ID: <20200514145744.GW1596452@mit.edu> (raw)
In-Reply-To: <20200421085445.5731-4-jack@suse.cz>
On Tue, Apr 21, 2020 at 10:54:45AM +0200, Jan Kara wrote:
> When we are evicting inode with journalled data, we may race with
> transaction commit in the following way:
> 
> CPU0					CPU1
> jbd2_journal_commit_transaction()	evict(inode)
> 					  inode_io_list_del()
> 					  inode_wait_for_writeback()
>   process BJ_Forget list
>     __jbd2_journal_insert_checkpoint()
>     __jbd2_journal_refile_buffer()
>       __jbd2_journal_unfile_buffer()
>         if (test_clear_buffer_jbddirty(bh))
>           mark_buffer_dirty(bh)
> 	    __mark_inode_dirty(inode)
> 					  ext4_evict_inode(inode)
> 					    frees the inode
> 
> This results in use-after-free issues in the writeback code (or
> the assertion added in the previous commit triggering).
> 
> Fix the problem by removing inode from writeback lists once all the page
> cache is evicted and so inode cannot be added to writeback lists again.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
Applied, thanks.
						- Ted
     prev parent reply	other threads:[~2020-05-14 14:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  8:54 ext4: Fix use after free issues with journalled data Jan Kara
2020-04-21  8:54 ` [PATCH 1/3] fs: Avoid leaving freed inode on dirty list Jan Kara
2020-04-25  6:42   ` Xiaoguang Wang
2020-04-27 10:05     ` Jan Kara
2020-04-21  8:54 ` [PATCH 2/3] writeback: Export inode_io_list_del() Jan Kara
2020-05-14 14:57   ` Theodore Y. Ts'o
2020-04-21  8:54 ` [PATCH 3/3] ext4: Avoid freeing inodes on dirty list Jan Kara
2020-05-14 14:57   ` Theodore Y. Ts'o [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=20200514145744.GW1596452@mit.edu \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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;
as well as URLs for NNTP newsgroup(s).