linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Matthew Wilcox <willy@infradead.org>
Cc: syzbot <syzbot+7cd473c2cac13fd2dd72@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [f2fs-dev] [syzbot] BUG: unable to handle kernel NULL pointer dereference in folio_mark_dirty
Date: Sun, 12 Dec 2021 17:15:00 +0800	[thread overview]
Message-ID: <51598d4d-0136-4a41-6b06-fbd7221ffd0e@kernel.org> (raw)
In-Reply-To: <Ya/bviwnMPsSnOcy@google.com>

On 2021/12/8 6:10, Jaegeuk Kim wrote:
> On 12/07, Matthew Wilcox wrote:
>> 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?
> 
> Dunno.
> 
>> 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).
> 
> Hmm, I've never seen this call stack before, so simply started to suspect
> folio.

I'm afraid this is a f2fs bug... :(

folio wasn't merged at the first report time (5.14-rc2).

https://syzkaller.appspot.com/bug?extid=07ff38c9c93ca170de07

I doubt the direct reason of panic may be the same as the one of bug
reported in bugzilla:

https://bugzilla.kernel.org/show_bug.cgi?id=215231

However, I still can't figure out why meta_inode's a_ops will change
to f2fs_meta_aops.

Thanks,

> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


      reply	other threads:[~2021-12-12  9:15 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
2021-12-07 22:10         ` Jaegeuk Kim
2021-12-12  9:15           ` Chao Yu [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=51598d4d-0136-4a41-6b06-fbd7221ffd0e@kernel.org \
    --to=chao@kernel.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 \
    --cc=willy@infradead.org \
    /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