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: <3b06d23d-de9e-471f-ab99-54c96cb077bd@lucifer.local>
Date: Tue, 29 Oct 2024 12:07:00 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>,
        syzbot <syzbot+4b5c704012892c4d22fd@...kaller.appspotmail.com>,
        akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [mm?] kernel BUG in zap_huge_pmd

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@...kaller.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ