Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp247297pxb; Mon, 13 Sep 2021 18:16:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Z+Woxqp64Ovl0WbPCaU5uzTb6psLY6l2ofnn/PnFCEVzTlHDUy29mkOdIJS+jvfFtXj9 X-Received: by 2002:a17:906:5855:: with SMTP id h21mr15780503ejs.230.1631582195419; Mon, 13 Sep 2021 18:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631582195; cv=none; d=google.com; s=arc-20160816; b=tkbly3yUFySEAm0/LSZjEC53cpL1gvoW961++wJDlIYtddf975Tsb7blWZYDWjjBjW qmGjaX0/qkp/0XSSI2Vvrb6s76X7lk04CwnUw97S+/w4v/b5Qbfu27eCT7xO9V5wzIxG qYY2/Tnq1Ga/ukSS5OzsSq/TzustTWuaeC5pkQOCpD5Ch4PxCy6Yxc3Ij6e0g0Un4UlL bQ1gZeIz507Xqfvds1YLauW3SkAWH4bIhKPKGhYejndc8RVllh4+HIo8004xBieE3zFD g2rxcZYlQ+400I4L2kuTnAlmH6/bzAeVHW/q09GiZJXsVX1TBD3ve/IKzJIjkgOdJrmj q+MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=R1Gt1t46cZyolnAF2U9fuqPB0Ne6SIX1s2ezNwbfHgs=; b=tpKbBRTwTJng2v/YZcqacqj0G+r0em+e9rFd+cq3cVagp6T1IbEnJNc179mYC8NKf1 LUg+JZq+lVPQZ4nOKwUmPXawe4Htsx+Jfjpm1fnoIFD/lhLTsBgGRh14vbuoVWvJuQM9 mbk3Mm9kvQ/WD7A2TSGKFmj+cXv17R/JCgD+OjDWVC4Fq82Haxq1OxgHPQJqvUST9nXs NDSSRLrvYpA7j5itV/4b8HTyd5DpjpNuM/mMLiLIdgtrMGEXNVWK56JieQxGfkRoqW2g 9Zikpyez+VhfU/FXySIgSSbXqP2yyTkSDdpYLXNqh6udgCyYpz2E9OzLltJfoseSUIhR DPdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wKie1t1e; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=0obimbJa; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si10062021edx.466.2021.09.13.18.16.12; Mon, 13 Sep 2021 18:16:35 -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=@linutronix.de header.s=2020 header.b=wKie1t1e; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=0obimbJa; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243948AbhIMWcz (ORCPT + 99 others); Mon, 13 Sep 2021 18:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240592AbhIMWcz (ORCPT ); Mon, 13 Sep 2021 18:32:55 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6862C061574 for ; Mon, 13 Sep 2021 15:31:38 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1631572296; 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: in-reply-to:in-reply-to:references:references; bh=R1Gt1t46cZyolnAF2U9fuqPB0Ne6SIX1s2ezNwbfHgs=; b=wKie1t1eD3ila7O0i8AUxj36N5RSBI6WglFMsuzNN/1rBn4kT9BjLIPCHa4cnYCZzyDTzc bA/xegx7oDxXBbpM+k/p9a/760NfwhdlaPq14FM3R5AJ4/7dq8D4E3qpg5NOGt0YRBMDZD eC8P1sdNbYnIC1QISKdrsHl0SLFyVo5eFDYQCVz3NsZEGlmyPMjZeh+0k+1MwW7JZij+uN hcutTWWVbfQvVwyNgYMtJ8tMfCAlKIYgcgWA2o6gLtHRyhX2lbepjXu5VJKQqjH+NPVdKI kzFKr1KCKk51+sEwczRUgJxI1AGltx8F1JWlYU46VHZqk/HQcACHgB96RfD9gA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1631572296; 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: in-reply-to:in-reply-to:references:references; bh=R1Gt1t46cZyolnAF2U9fuqPB0Ne6SIX1s2ezNwbfHgs=; b=0obimbJa7vbavMCTYbEOPY1I/1sUAJ075567RRz5J7y2xj3pNhae/5S//pPfzjdbcjapom qQcUvAbVK0VSdJDA== To: "Michael S. Tsirkin" Cc: Jason Wang , virtualization , linux-kernel , "Hetzelt, Felicitas" , "kaplan, david" , Konrad Rzeszutek Wilk , pbonzini , Andi Kleen , Dan Williams , "Kuppuswamy, Sathyanarayanan" , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Bjorn Helgaas , Richard Henderson , Thomas Bogendoerfer , James E J Bottomley , Helge Deller , "David S . Miller" , Arnd Bergmann , Jonathan Corbet , Peter H Anvin , Dave Hansen , Tony Luck , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , X86 ML Subject: Re: [PATCH 6/9] virtio_pci: harden MSI-X interrupts In-Reply-To: <20210913164934-mutt-send-email-mst@kernel.org> References: <20210913055353.35219-1-jasowang@redhat.com> <20210913055353.35219-7-jasowang@redhat.com> <20210913015711-mutt-send-email-mst@kernel.org> <20210913022257-mutt-send-email-mst@kernel.org> <20210913023626-mutt-send-email-mst@kernel.org> <20210913024153-mutt-send-email-mst@kernel.org> <87bl4wfeq1.ffs@tglx> <20210913164934-mutt-send-email-mst@kernel.org> Date: Tue, 14 Sep 2021 00:31:36 +0200 Message-ID: <87sfy8ds53.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13 2021 at 16:54, Michael S. Tsirkin wrote: > On Mon, Sep 13, 2021 at 09:38:30PM +0200, Thomas Gleixner wrote: >> On Mon, Sep 13 2021 at 15:07, Jason Wang wrote: >> > On Mon, Sep 13, 2021 at 2:50 PM Michael S. Tsirkin wrote: >> >> > But doen't "irq is disabled" basically mean "we told the hypervisor >> >> > to disable the irq"? What extractly prevents hypervisor from >> >> > sending the irq even if guest thinks it disabled it? >> >> >> >> More generally, can't we for example blow away the >> >> indir_desc array that we use to keep the ctx pointers? >> >> Won't that be enough? >> > >> > I'm not sure how it is related to the indirect descriptor but an >> > example is that all the current driver will assume: >> > >> > 1) the interrupt won't be raised before virtio_device_ready() >> > 2) the interrupt won't be raised after reset() >> >> If that assumption exists, then you better keep the interrupt line >> disabled until virtio_device_ready() has completed > > started not completed. device is allowed to send > config interrupts right after DRIVER_OK status is set by > virtio_device_ready. Whatever: * Define the exact point from which on the driver is able to handle the interrupt and put the enable after that point * Define the exact point from which on the driver is unable to handle the interrupt and put the disable before that point The above is blury. >> and disable it again >> before reset() is invoked. That's a question of general robustness and >> not really a question of trusted hypervisors and encrypted guests. > > We can do this for some MSIX interrupts, sure. Not for shared interrupts though. See my reply to the next patch. The problem is the same: * Define the exact point from which on the driver is able to handle the interrupt and allow the handler to proceed after that point * Define the exact point from which on the driver is unable to handle the interrupt and ensure that the handler denies to proceed before that point Same story just a different mechanism. Thanks, tglx