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=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 94270C433E3 for ; Mon, 27 Jul 2020 11:38:33 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 20E232074F for ; Mon, 27 Jul 2020 11:38:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="zO7gFLOA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20E232074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A99A44B9AF; Mon, 27 Jul 2020 07:38:32 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id czORvG+NzaIu; Mon, 27 Jul 2020 07:38:31 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A3D9A4B8DF; Mon, 27 Jul 2020 07:38:31 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 53A824B8AA for ; Mon, 27 Jul 2020 07:38:30 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0fJ3WmsVAST9 for ; Mon, 27 Jul 2020 07:38:29 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 477C44B863 for ; Mon, 27 Jul 2020 07:38:29 -0400 (EDT) Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6C832072E; Mon, 27 Jul 2020 11:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595849908; bh=uLbTYAh07fv8JZO0YyeUya+9u16JNdr7tPp1pQ4gqYo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zO7gFLOA17LlgroJllXmWm8YcqAdeP4NTG7mB9v4pP075cnGKv9titYleXePQiaVX J07HCyoLe7QeSH+D5suzf/uXPdQ2C3NMCIvMQrAaxR6HJ5ZPDGdBoOMgsRbYRd36lB AEEtX/k8I1IBrkr3UiqDsvAOjov2r23gFZO83WJw= Date: Mon, 27 Jul 2020 12:38:21 +0100 From: Will Deacon To: Jianyong Wu Subject: Re: [PATCH v13 2/9] arm/arm64: KVM: Advertise KVM UID to guests via SMCCC Message-ID: <20200727113821.GB20437@willie-the-truck> References: <20200619130120.40556-1-jianyong.wu@arm.com> <20200619130120.40556-3-jianyong.wu@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Cc: "maz@kernel.org" , Justin He , Wei Chen , "kvm@vger.kernel.org" , "netdev@vger.kernel.org" , "richardcochran@gmail.com" , "linux-kernel@vger.kernel.org" , "sean.j.christopherson@intel.com" , Steven Price , "john.stultz@linaro.org" , "yangbo.lu@nxp.com" , "pbonzini@redhat.com" , "tglx@linutronix.de" , nd , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Mon, Jul 27, 2020 at 03:45:37AM +0000, Jianyong Wu wrote: > > From: Will Deacon > > > > We can advertise ourselves to guests as KVM and provide a basic features > > bitmap for discoverability of future hypervisor services. > > > > Cc: Marc Zyngier > > Signed-off-by: Will Deacon > > Signed-off-by: Jianyong Wu > > --- > > arch/arm64/kvm/hypercalls.c | 29 +++++++++++++++++++---------- > > 1 file changed, 19 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c > > index 550dfa3e53cd..db6dce3d0e23 100644 > > --- a/arch/arm64/kvm/hypercalls.c > > +++ b/arch/arm64/kvm/hypercalls.c > > @@ -12,13 +12,13 @@ > > int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) { > > u32 func_id = smccc_get_function(vcpu); > > - long val = SMCCC_RET_NOT_SUPPORTED; > > + u32 val[4] = {SMCCC_RET_NOT_SUPPORTED}; > > There is a risk as this u32 value will return here and a u64 value will be > obtained in guest. For example, The val[0] is initialized as -1 of > 0xffffffff and the guest get 0xffffffff then it will be compared with -1 > of 0xffffffffffffffff Also this problem exists for the transfer of address > in u64 type. So the following assignment to "val" should be split into two > u32 value and assign to val[0] and val[1] respectively. > WDYT? Yes, I think you're right that this is a bug, but isn't the solution just to make that an array of 'long'? long val [4]; That will sign-extend the negative error codes as required, while leaving the explicitly unsigned UID constants alone. Will _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm