From: Paolo Bonzini Date: Fri, 25 Sep 2020 21:06:10 +0000 Subject: Re: [RFC PATCH 3/3] KVM: x86: Use KVM_BUG/KVM_BUG_ON to handle bugs that are fatal to the VM Message-Id: <731dd323-8c66-77ff-cf15-4bbdea34bcf9@redhat.com> List-Id: References: <20200923224530.17735-1-sean.j.christopherson@intel.com> <20200923224530.17735-4-sean.j.christopherson@intel.com> <878scze4l5.fsf@vitty.brq.redhat.com> <20200924181134.GB9649@linux.intel.com> <87k0wichht.fsf@vitty.brq.redhat.com> <20200925171233.GC31528@linux.intel.com> In-Reply-To: <20200925171233.GC31528@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sean Christopherson , Vitaly Kuznetsov Cc: Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Huacai Chen , Aleksandar Markovic , linux-mips@vger.kernel.org, Paul Mackerras , kvm-ppc@vger.kernel.org, Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Claudio Imbrenda On 25/09/20 19:12, Sean Christopherson wrote: >> Do we actually want to prevent *all* ioctls? E.g. when 'vm bugged' >> condition is triggered userspace may want to extract some information to >> assist debugging but even things like KVM_GET_[S]REGS will just return >> -EIO. I'm not sure it is generally safe to enable *everything* (except >> for KVM_RUN which should definitely be forbidden) so maybe your approach >> is preferable. > > The answer to this probably depends on the answer to the first question of > when it's appropriate to use KVM_BUG(). E.g. if we limit usage to fatal or > dangrous cases, then blocking all ioctls() is probably the right thing do do. I think usage should be limited to dangerous cases, basically WARN_ON level. However I agree with Vitaly that KVM_GET_* should be allowed. The other question is whether to return -EIO or KVM_EXIT_INTERNAL_ERROR. The latter is more likely to be handled already by userspace. Paolo