From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85A78C4727E for ; Fri, 25 Sep 2020 21:06:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2644323888 for ; Fri, 25 Sep 2020 21:06:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eode0v0J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbgIYVGQ (ORCPT ); Fri, 25 Sep 2020 17:06:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44875 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727519AbgIYVGQ (ORCPT ); Fri, 25 Sep 2020 17:06:16 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601067975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nph2D9IVfI+xvuD8zFp+f/GwIX9O4qj0XvwXCm0EYyg=; b=eode0v0JDaBStoNf9D8IQ0OnSNCRb8Uc/Foqr3IlCZ9i4OIG0+GVAHcVJ88vWX0aajY1ol 8G1SzWVlgs+DtrUdtF5Fxqe0U3WTieIaR7GqG+igy83VI/zNGsx9JHEOdTTT/q5Z9wh8lb vk2UGfGiigeU7ZTvOddvj4FeOE9UlpY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-436-t68KlsJBO5eT299OTBgnDg-1; Fri, 25 Sep 2020 17:06:13 -0400 X-MC-Unique: t68KlsJBO5eT299OTBgnDg-1 Received: by mail-wm1-f72.google.com with SMTP id s24so137629wmh.1 for ; Fri, 25 Sep 2020 14:06:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Nph2D9IVfI+xvuD8zFp+f/GwIX9O4qj0XvwXCm0EYyg=; b=TkScxKJ4s2/pDYNpB4sTDHj015MtodxCIAZl2/qQFKgjuVgGEEu0LyHD3+lrq81N2a MNVpbVB0iONxzUpzCk0ZZV+CejFLoMnAZovVZiWEDM7U8HahDmeIX4Gu4ByJUF2Ox1VL 8TRuHqsoxZ8B4Gqvjp1fJbBaLr7v9QPA+2gteiFZ431q7o5qYhNhuXj5lcSMtEDE/Jct WiFkdqC1e89CktK1tY/7sDdQF+wwMEa5QVf1GnqqtPf4vyj3rsBvK/ddiG2VoeOyiXEU XJILG8DeILMjEeHM7d/vfQQo9o4lYWG/ijpJlzeyP+47meAFFekvZI/quq0gTjJ2uKnQ ujiQ== X-Gm-Message-State: AOAM531QHeSOmPdfnG06bA0fQ6+1C1h3RjGeHiixmwJHUj+QkQviAnyo 5o/RYjZ0zOeHG4U20+uKKObpxt0xO5OuHP6DTJt3rWIZEXH3BOPUuUVyanh4l2SvZxSnbdknEBc rU2O59s5klEPwB7XKA/cwVA== X-Received: by 2002:adf:f207:: with SMTP id p7mr6889817wro.152.1601067972440; Fri, 25 Sep 2020 14:06:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+svzQTyn/sr+1A0KnMYOANfhe1Lyv2OpG+lPc9M4qsZez3YRF08veAZn1ubvdVOTuIczmeg== X-Received: by 2002:adf:f207:: with SMTP id p7mr6889795wro.152.1601067972235; Fri, 25 Sep 2020 14:06:12 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:ec9b:111a:97e3:4baf? ([2001:b07:6468:f312:ec9b:111a:97e3:4baf]) by smtp.gmail.com with ESMTPSA id t203sm255701wmg.43.2020.09.25.14.06.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Sep 2020 14:06:11 -0700 (PDT) Subject: Re: [RFC PATCH 3/3] KVM: x86: Use KVM_BUG/KVM_BUG_ON to handle bugs that are fatal to the VM 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 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> From: Paolo Bonzini Message-ID: <731dd323-8c66-77ff-cf15-4bbdea34bcf9@redhat.com> Date: Fri, 25 Sep 2020 23:06:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200925171233.GC31528@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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