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] [day] [month] [year] [list]
Date:   Thu, 28 Apr 2022 18:33:27 +0200
From:   "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
To:     Sean Christopherson <seanjc@...gle.com>,
        Maxim Levitsky <mlevitsk@...hat.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v2 02/11] KVM: SVM: Don't BUG if userspace injects a soft
 interrupt with GIF=0

On 28.04.2022 17:04, Sean Christopherson wrote:
> On Thu, Apr 28, 2022, Maxim Levitsky wrote:
>> On Thu, 2022-04-28 at 15:27 +0200, Maciej S. Szmigiero wrote:
>>> On 28.04.2022 09:35, Maxim Levitsky wrote:
>>>> On Sat, 2022-04-23 at 02:14 +0000, Sean Christopherson wrote:
>>>>> From: Maciej S. Szmigiero <maciej.szmigiero@...cle.com>
>>>>>
>>>>> Don't BUG/WARN on interrupt injection due to GIF being cleared if the
>>>>> injected event is a soft interrupt, which are not actually IRQs and thus
>>>>
>>>> Are any injected events subject to GIF set? I think that EVENTINJ just injects
>>>> unconditionaly whatever hypervisor puts in it.
>>>
>>> That's right, EVENTINJ will pretty much always inject, even when the CPU
>>> is in a 'wrong' state (like for example, injecting a hardware interrupt
>>> or a NMI with GIF masked).
>>>
>>> But KVM as a L0 is not supposed to inject a hardware interrupt into guest
>>> with GIF unset since the guest is obviously not expecting it then.
>>> Hence this WARN_ON().
>>
>> If you mean L0->L1 injection, that sure, but if L1 injects interrupt to L2,
>> then it should always be allowed to do so.
> 
> Yes, L1 can inject whatever it wants, whenever it wants.
> 
> I kept the WARN_ON() under the assumption that KVM would refuse to inject IRQs
> stuffed by userspace if GIF is disabled, but looking at the code again, I have
> no idea why I thought that.  KVM_SET_VCPU_EVENTS blindly takes whatever userspace
> provides, I don't see anything that would prevent userspace from shoving in a
> hardware IRQ.

You both are right, while KVM itself would not inject IRQ with GIF masked and
a nested VMRUN would enable GIF unconditionally, userspace via KVM_SET_VCPU_EVENTS
does not have this restriction.

Will remove this WARN_ON() then.

Thanks,
Maciej

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ