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: <ZZhTJ899Hzv8zuzX@google.com>
Date: Fri, 5 Jan 2024 11:06:15 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: syzbot <syzbot+81227d2bd69e9dedb802@...kaller.appspotmail.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, pbonzini@...hat.com, 
	syzkaller-bugs@...glegroups.com, 
	Muhammad Usama Anjum <usama.anjum@...labora.com>, 
	"Michał Mirosław" <mirq-linux@...e.qmqm.pl>, Arnd Bergmann <arnd@...db.de>, 
	Stephen Rothwell <sfr@...b.auug.org.au>, Andrew Morton <akpm@...ux-foundation.org>, 
	Andrei Vagin <avagin@...il.com>
Subject: Re: [syzbot] [kvm?] WARNING in kvm_mmu_notifier_change_pte

+PAGEMAP_SCAN folks

On Wed, Dec 13, 2023, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    f2e8a57ee903 Merge tag 'scsi-fixes' of git://git.kernel.or..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=14fdc732e80000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=e56083f7dbe162c2
> dashboard link: https://syzkaller.appspot.com/bug?extid=81227d2bd69e9dedb802
> compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=129d09cae80000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10b8afeee80000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/7b75e59fc59d/disk-f2e8a57e.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/f853580d61be/vmlinux-f2e8a57e.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/8c893ce02e2c/bzImage-f2e8a57e.xz
> 
> Bisection is inconclusive: the first bad commit could be any of:
> 
> d61ea1cb0095 userfaultfd: UFFD_FEATURE_WP_ASYNC
> 52526ca7fdb9 fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs

PAGEMAP_SCAN is indeed to blame, do_pagemap_scan() invokes mmu_notifiers without
holding mmap_lock.  This allows KVM to attach its mmu_notifier between start()
and end(), which causes mn_active_invalidate_count to underflow.  Note, the actual
WARN from KVM fires after the underflow; I'll send a patch to further harden KVM.

Ideally this would be fixed before the final v6.7 release, as it would be trivial
for this to cause deadlock in KVM.  The only reason the repro doesn't cause
deadlock is because it's not creating memslots in KVM, i.e. KVM doesn't truly
consume the corrupted mn_active_invalidate_count.

Side topic, it would be wonderful if we could figure out a semi-efficient way to
add lockdep assertions in the mmu_notifier helpers to assert that at least one of
the locks acquired by mm_take_all_locks() is held.  Relying on KVM's paranoia to
detect these types of bugs is not a good strategy.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ