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]
Date:   Thu, 14 Apr 2022 18:05:29 -0700
From:   Oliver Upton <oupton@...gle.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Marc Zyngier <maz@...nel.org>,
        syzbot+df6fbbd2ee39f21289ef@...kaller.appspotmail.com
Subject: Re: [PATCH] KVM: Initialize debugfs_dentry when a VM is created to
 avoid NULL deref

Hi Sean,

On Thu, Apr 14, 2022 at 5:46 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> Initialize debugfs_entry to its semi-magical -ENOENT value when the VM
> is created.  KVM's teardown when VM creation fails is kludgy and calls
> kvm_uevent_notify_change() and kvm_destroy_vm_debugfs() even if KVM never
> attempted kvm_create_vm_debugfs().  Because debugfs_entry is zero

Boo! I've got a few patches to bring kvm_create_vm_debugfs() in line
with the rest of the VM initialization. Kinda gross it is done in the
ioctl body.

> initialized, the IS_ERR() checks pass and KVM derefs a NULL pointer.
>
>   BUG: kernel NULL pointer dereference, address: 0000000000000018
>   #PF: supervisor read access in kernel mode
>   #PF: error_code(0x0000) - not-present page
>   PGD 1068b1067 P4D 1068b1067 PUD 1068b0067 PMD 0
>   Oops: 0000 [#1] SMP
>   CPU: 0 PID: 871 Comm: repro Not tainted 5.18.0-rc1+ #825
>   Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
>   RIP: 0010:__dentry_path+0x7b/0x130
>   Call Trace:
>    <TASK>
>    dentry_path_raw+0x42/0x70
>    kvm_uevent_notify_change.part.0+0x10c/0x200 [kvm]
>    kvm_put_kvm+0x63/0x2b0 [kvm]
>    kvm_dev_ioctl+0x43a/0x920 [kvm]
>    __x64_sys_ioctl+0x83/0xb0
>    do_syscall_64+0x31/0x50
>    entry_SYSCALL_64_after_hwframe+0x44/0xae
>    </TASK>
>   Modules linked in: kvm_intel kvm irqbypass
>
> Fixes: a44a4cc1c969 ("KVM: Don't create VM debugfs files outside of the VM directory")
> Cc: stable@...r.kernel.org
> Cc: Marc Zyngier <maz@...nel.org>
> Cc: Oliver Upton <oupton@...gle.com>
> Reported-by: syzbot+df6fbbd2ee39f21289ef@...kaller.appspotmail.com
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>

Looks good, grats to the bots for finding my dirty laundry.

Reviewed-by: Oliver Upton <oupton@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ