linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	syzbot <syzbot+7cd473c2cac13fd2dd72@syzkaller.appspotmail.com>,
	linux-mm@kvack.org, syzkaller-bugs@googlegroups.com,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [syzbot] BUG: unable to handle kernel NULL pointer dereference in folio_mark_dirty
Date: Tue, 7 Dec 2021 22:00:11 +0000	[thread overview]
Message-ID: <Ya/ZaxznaTmrIvdO@casper.infradead.org> (raw)
In-Reply-To: <Ya/Ueh7MWyvV2zdg@google.com>

On Tue, Dec 07, 2021 at 01:39:06PM -0800, Jaegeuk Kim wrote:
> On 12/07, Matthew Wilcox wrote:
> > > > Call Trace:
> > > >  <TASK>
> > > >  folio_mark_dirty+0x136/0x270 mm/page-writeback.c:2639
> > 
> >         if (likely(mapping)) {
> > ...
> >                 if (folio_test_reclaim(folio))
> >                         folio_clear_reclaim(folio);
> >                 return mapping->a_ops->set_page_dirty(&folio->page);
> > 
> > how do we get to a NULL ->set_page_dirty for a metadata page's
> > mapping->a_ops?  This is definitely an f2fs expert question.
> 
> I can't find anything in f2fs, since that page was got by f2fs_grab_meta_page
> along with grab_cache_page() that we never unlocked it.
> 
>   40 struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
>   41 {
>   42         struct address_space *mapping = META_MAPPING(sbi);
>   43         struct page *page;
>   44 repeat:
>   45         page = f2fs_grab_cache_page(mapping, index, false);
> 
>                     -> grab_cache_page(mapping, index);
> 
>   46         if (!page) {
>   47                 cond_resched();
>   48                 goto repeat;
>   49         }
>   50         f2fs_wait_on_page_writeback(page, META, true, true);
>   51         if (!PageUptodate(page))
>   52                 SetPageUptodate(page);
>   53         return page;
>   54 }
> 
> 
> Suspecting something in folio wrt folio_mapping()?
> 
>  81 bool set_page_dirty(struct page *page)
>  82 {
>  83         return folio_mark_dirty(page_folio(page));
>  84 }

... huh?  How could folio_mapping() be getting this wrong?
page_folio() does the same thing as compound_head() -- as far as I know
you don't use compound pages for f2fs metadata, so this basically just
casts the page to a struct folio.

folio_mapping() is just like the old page_mapping() (see commit
2f52578f9c64).  Unless you've done something like set the swapcache
bit on your metadata page, it's just going to return folio->mapping
(ie the same as page->mapping).



  reply	other threads:[~2021-12-07 22:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04  9:55 syzbot
2021-12-07  1:56 ` Andrew Morton
2021-12-07  4:19   ` Matthew Wilcox
2021-12-07  4:30   ` Matthew Wilcox
2021-12-07 21:39     ` [f2fs-dev] " Jaegeuk Kim
2021-12-07 22:00       ` Matthew Wilcox [this message]
2021-12-07 22:10         ` Jaegeuk Kim
2021-12-12  9:15           ` Chao Yu

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=Ya/ZaxznaTmrIvdO@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+7cd473c2cac13fd2dd72@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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