Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3928273pxu; Tue, 20 Oct 2020 04:23:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsC3CaR5fkfSiEqld7vx9eKeuoTHQxBGGUugvDnhwkaTvgPqoznGuo0Vs1ylPARL3untQb X-Received: by 2002:aa7:cacd:: with SMTP id l13mr2196398edt.177.1603192991423; Tue, 20 Oct 2020 04:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603192991; cv=none; d=google.com; s=arc-20160816; b=u6snnELq+tp+QQ+MuUZ5ht1ZcYL2ZCAF2G4kGg/EKO+TzEymYfRORmMUB5Ybjf38d9 Bo4OZZUIoyxgxXpmci9YbDb/OU6GZSYDArR/durxLmW4ETGWHuprmTR+5dwONtyKhfzX qT1po4M26jqslrTn4184rZiRrZxlkSRnvYA6jFGrdq0lizew8Jn20qsSixyCiz4raasn iVbXzLGfvhAdPLMZ35uxvDluiiGN8iXvm9Fs9xWFI+V4SWLBFQJshnOYXfdGHr3gu0wI +Apqswr9OnzBjNnHVVY9ip+R5nZCXXT6mrlsu7bYvG3ll57+GamK8lNtRV81yxd0qSdC DhKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=DnylEQH4n9hWhzK7f59LBMUXW92Rw5bQiSSzPC/Izyo=; b=DsZrUjHxTnD4q/nw6zoAiTCOX7NI+AnEs3OV+2W8Zj0zscUikD7JI/BffVbKr2svkt AsPIAMGiwOkC2mm/lzXrPG4qzOpEAbhee4G7Mip5ym9O72vjpNUkCotBB4I0WFzvrKAb MAobnEVAse9Uhix9DodaG7duzhpUqYjAKEnLOxu2BFuwMHExD7PNci1ISRWpE8Zq2yGt qdkoFltn1Z9pzaxaDihYptLtreZKrM1bKIhWnETbaZqIq/27XWTdfgL1O4TBSkEyw405 B3gPJyph0X/YIAU5+Xb2m0iyCzKBjj5vKIluy8DLzWPGxM1qzJ3iQuaLzS0gaHV43zn2 pwcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="QaviqZ/n"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz16si1001858ejc.508.2020.10.20.04.22.49; Tue, 20 Oct 2020 04:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="QaviqZ/n"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405184AbgJTJ1a (ORCPT + 99 others); Tue, 20 Oct 2020 05:27:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54989 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392683AbgJTJ13 (ORCPT ); Tue, 20 Oct 2020 05:27:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603186048; 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=DnylEQH4n9hWhzK7f59LBMUXW92Rw5bQiSSzPC/Izyo=; b=QaviqZ/nfufTurJAV3TUbGO4biRuG1sctCu0f1XQsrDej7g2OYkN4fwBEkMidGAMPxskb3 ZdHJSVwnDIaO1LpGI84lFvD3Y7C3bKfqjzpIG+hJ+7ks57HM/+aHv1fVZhJiZOBIR8ed49 NB/ZZ+/MxcXS8PfbvBVP1bXmMo/gOzc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-585-eu6JSwiTON-nN2dPR_EWBg-1; Tue, 20 Oct 2020 05:27:27 -0400 X-MC-Unique: eu6JSwiTON-nN2dPR_EWBg-1 Received: by mail-wr1-f69.google.com with SMTP id p6so551829wrm.23 for ; Tue, 20 Oct 2020 02:27:26 -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=DnylEQH4n9hWhzK7f59LBMUXW92Rw5bQiSSzPC/Izyo=; b=XFkvSH4P4m6Vi23flaLcSaTMxkZq1Ku745IUhnOGQKq4g0sopaHQFTSerT2BRKgXQr QHhq7I/PjP33tAhfvZh0A/VuV2Apk2sdoluwVlWgwHBSk/Z5SKD+5x0wc3bjlw9QMNac yZwvRQN9odaO86uWX5pG1FMpwE6VsTSlh/9AQsxmtsR7FVLVS42iJj0Zyxqa7nKIUibx wQcC0q/zInovCeR97JqWAh3w1DvPh16VWUmm6zC7O1DWWZ2rV03Q71eh8ks8c4i5InfJ mXucsDndBTsd7aDKVenBpQcyBoNcfAULggBo3E+XplJ1ea0q+9aUVg040rHrLJ0eFE3Z fGPA== X-Gm-Message-State: AOAM533b7WYLywf7OK8Fdaznw/PxLUM9OaQlnzIzsYZmVv9ENxWV/QPp Wjc40qsIS8oivLOuU68NNHp0yBlf8J5MNdJCnIxHD4F5mBLfSS+HFjUuHTXbqci80dXtTGUNuWh yMQovHlpTz8FFVrthPjWYar23 X-Received: by 2002:adf:94e6:: with SMTP id 93mr2347102wrr.190.1603186045434; Tue, 20 Oct 2020 02:27:25 -0700 (PDT) X-Received: by 2002:adf:94e6:: with SMTP id 93mr2347074wrr.190.1603186045198; Tue, 20 Oct 2020 02:27:25 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id t6sm2180005wre.30.2020.10.20.02.27.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Oct 2020 02:27:24 -0700 (PDT) Subject: Re: [PATCH] KVM: VMX: Forbid userspace MSR filters for x2APIC To: "Graf (AWS), Alexander" Cc: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , Aaron Lewis , Peter Xu , Sean Christopherson References: <20201019170519.1855564-1-pbonzini@redhat.com> <618E2129-7AB5-4F0D-A6C9-E782937FE935@amazon.de> From: Paolo Bonzini Message-ID: Date: Tue, 20 Oct 2020 11:27:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <618E2129-7AB5-4F0D-A6C9-E782937FE935@amazon.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/10/20 19:45, Graf (AWS), Alexander wrote: >> + * In principle it would be possible to trap x2apic ranges >> + * if !lapic_in_kernel. This however would be complicated >> + * because KVM_X86_SET_MSR_FILTER can be called before >> + * KVM_CREATE_IRQCHIP or KVM_ENABLE_CAP. >> + */ >> + for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) >> + if (range_overlaps_x2apic(&filter.ranges[i])) >> + return -EINVAL; > > What if the default action of the filter is to "deny"? Then only an > MSR filter to allow access to x2apic MSRs would make the full > filtering logic adhere to the constraints, no? Right; or more precisely, that is handled by Sean's patch that he had posted earlier. This patch only makes it impossible to set up such a filter. (That said, this is a quick patch that I posted yesterday just before dinner. I'll send out the real deal with docs fixes and better commit message). Paolo > Also, this really deserves a comment in the API documentation :). > > In fact, I think a pure comment in documentation is enough. Just make > x2apic && filter on them "undefined behavior".