Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3526716pxb; Mon, 16 Nov 2020 17:53:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXXfNMuVxlWwdES3pWk5SeLeSIhD4EHiaZV4ZaVLCaZQgqkdhnAVCSVT9b+628hSDwmUcl X-Received: by 2002:a17:906:ad8c:: with SMTP id la12mr16873330ejb.521.1605578005316; Mon, 16 Nov 2020 17:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605578005; cv=none; d=google.com; s=arc-20160816; b=Uy2wC7ZJBU/vv+75APC8b8NavibGglFAWNHRxGo3vH3E02IIDMwMjTzpHEwR3eDOL9 EtsckG8tjBe0R/iLM6SJUsbwAWPTi+5NRlwuU216diZi6FWJMBOSGSBhFz0krR0QDpoP CBMVC1iHaXyAENCRB2ZeaenrBhHttA+N5VgwjbebYVjwC7u89tXcSq4N0AT7OkzVLPAh BUzRLj8bOZHdA0s8KGkfEd1SBR54IQGsWS5pwBtUYx8uhLFDEaOqSP9oL9ZYvgsqSHMU L0VzBeNuRARfTOafxqFesLr69fnw+jkn4BxMjrV0TYPVyaboC5Zt69iADbKYSFEllq2l nCcA== 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; bh=gECMGrWjIf+c/kzbEvC7iUhjT6Sk+d4Qo7UZ/rQ5/do=; b=QZ4oHQFzZM1v3otv5mRgrrfAuYe7CTano+GcNvbTIgy3AGRZ73ofoe4kHTFs3eMMkV /b0fA/Fnh51O/ThnEE2nIQpD5TJiGoBvlJGZGsZuxyJ+IhWDpkRCW29MIOmZ6xOdCwrD X0EvuH8eVSPDp/HD/9vjkmWMjG6CM2tbW5Cf9hSXcUjqGit5U5e4JWNpOg7cuYiRjwPO B8YPBNsg66Sm263Z6Yf7cgmi54jdk9cZTNQzi0HjqJkYXKFEO8GAhIgPXsbY82267Rvh B19otZGV53Fu/9IzTOBSJ0P0Nv4GvYJea43JPnSjXVcmpPgqLOcKx+Y2eywVQa5D3oX0 kvtg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z41si3925317ede.250.2020.11.16.17.53.03; Mon, 16 Nov 2020 17:53:25 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730371AbgKPO5f (ORCPT + 99 others); Mon, 16 Nov 2020 09:57:35 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8094 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729725AbgKPO5e (ORCPT ); Mon, 16 Nov 2020 09:57:34 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CZXGy5byCzLlrL; Mon, 16 Nov 2020 22:57:14 +0800 (CST) Received: from [10.174.185.179] (10.174.185.179) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 16 Nov 2020 22:57:26 +0800 Subject: Re: [PATCH 1/2] KVM: arm64: vgic: Forbid invalid userspace Redistributor accesses To: Marc Zyngier CC: , , , , , , , , Keqian Zhu References: <20201113142801.1659-1-yuzenghui@huawei.com> <20201113142801.1659-2-yuzenghui@huawei.com> <724c43702b52aac0d3c9beb9604d1bfb@kernel.org> <584b7ff1-ecf2-b0ec-cea3-ccc29902f43a@huawei.com> From: Zenghui Yu Message-ID: <7e58200c-814e-3598-155a-9a7e6cc24374@huawei.com> Date: Mon, 16 Nov 2020 22:57:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.185.179] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 2020/11/16 22:10, Marc Zyngier wrote: >> My take is that only if the "[Re]Distributor base address" is specified >> in the system memory map, will the user-provided kvm_device_attr.offset >> make sense. And we can then handle the access to the register which is >> defined by "base address + offset". > > I'd tend to agree, but it is just that this is a large change at -rc4. > I'd rather have a quick fix for 5.10, and a more invasive change for 5.11, > spanning all the possible vgic devices. So you prefer fixing it by "return a value that doesn't have the Last bit set" for v5.10? I'm ok with it and can send v2 for it. Btw, looking again at the way we handle the user-reading of GICR_TYPER vgic_mmio_read_v3r_typer(vcpu, addr, len) it seems that @addr is actually the *offset* of GICR_TYPER (0x0008) and @addr is unlikely to be equal to last_rdist_typer, which is the *GPA* of the last RD. Looks like the user-reading of GICR_TYPER.Last is always broken? Thanks, Zenghui