lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ya/ZaxznaTmrIvdO@casper.infradead.org>
Date:   Tue, 7 Dec 2021 22:00:11 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     Jaegeuk Kim <jaegeuk@...nel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        syzbot <syzbot+7cd473c2cac13fd2dd72@...kaller.appspotmail.com>,
        linux-mm@...ck.org, syzkaller-bugs@...glegroups.com,
        linux-kernel@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [syzbot] BUG: unable to handle kernel NULL pointer
 dereference in folio_mark_dirty

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).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ