From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
syzbot <syzbot+4b5c704012892c4d22fd@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [mm?] kernel BUG in zap_huge_pmd
Date: Tue, 29 Oct 2024 12:07:00 +0000 [thread overview]
Message-ID: <3b06d23d-de9e-471f-ab99-54c96cb077bd@lucifer.local> (raw)
In-Reply-To: <ri2667onovzkphvyxqnxe724ymxqs52pkzpdesina35v55ccnr@4kghwz6eevom>
On Tue, Oct 29, 2024 at 01:44:47PM +0200, Kirill A. Shutemov wrote:
> On Mon, Oct 28, 2024 at 08:31:20PM -0700, syzbot wrote:
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 4e46774408d9 Merge tag 'for-6.12-rc4-tag' of git://git.ker..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=10fb2ebb980000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=fc6f8ce8c5369043
> > dashboard link: https://syzkaller.appspot.com/bug?extid=4b5c704012892c4d22fd
> > compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11f730e7980000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=177eae40580000
> >
> > Downloadable assets:
> > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-4e467744.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/058a92aaf61a/vmlinux-4e467744.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/0b79757fbe5e/bzImage-4e467744.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+4b5c704012892c4d22fd@syzkaller.appspotmail.com
> >
> > R10: 000000000401d031 R11: 0000000000000246 R12: 0000000000000004
> > R13: 00007f33ed7673fc R14: 00007f33ed737334 R15: 00007f33ed7673e4
> > </TASK>
> > ------------[ cut here ]------------
> > kernel BUG at mm/huge_memory.c:2085!
> > Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
> > CPU: 0 UID: 0 PID: 5095 Comm: syz-executor380 Not tainted 6.12.0-rc4-syzkaller-00085-g4e46774408d9 #0
> > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
> > RIP: 0010:zap_huge_pmd+0x953/0xc40 mm/huge_memory.c:2085
>
> I believe it is bug in mmap_region() around handling
> vms_gather_munmap_vmas() and vms_complete_munmap_vmas().
>
> What reproduces does is:
>
> 1. Creating hugetlb mapping
> 2. Setting up UFFD on it
> 3. Creating a new that partially overlaps with mapping created on step 1
>
> On step 3 an error is injected which makes vma_iter_prealloc() fail and
> unmap_region() is called in error path.
>
> The unmap_region() is called with the newly created as an argument, but
> page tables still contain entries from hugetlb mapping that was never
> fully unmapped because vms_complete_munmap_vmas() has not called yet.
>
> Since the new VMA is not hugetlb, unmapping code takes THP codepath and
> calls zap_huge_pmd(). zap_huge_pmd() sees PTE marker swap entry installed
> by hugetlb_mfill_atomic_pte() and gets confused.
>
> I don't understand vms_gather/complete_munmap_vmas() code well enough.
> I am not sure what the right fix would be.
> Maybe call vms_complete_munmap_vmas() earlier?
We just changed around how this stuff aborts in a hotfix series that should
avoid this, actually.
Unfortunately I don't have the netlink setup syzbot has locally so not sure
how reliably i can repro.
I guess I'll try to tell the bot to try a commit that should work (one that
I'm about to respin, unfortunate timing here...)
>
> --
> Kiryl Shutsemau / Kirill A. Shutemov
next prev parent reply other threads:[~2024-10-29 12:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 3:31 syzbot
2024-10-29 11:44 ` Kirill A. Shutemov
2024-10-29 12:07 ` Lorenzo Stoakes [this message]
2024-10-29 12:58 ` Kirill A. Shutemov
2024-10-29 13:08 ` Lorenzo Stoakes
2024-10-29 12:09 ` Lorenzo Stoakes
2024-10-29 12:31 ` syzbot
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=3b06d23d-de9e-471f-ab99-54c96cb077bd@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=syzbot+4b5c704012892c4d22fd@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vbabka@suse.cz \
/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