From patchwork Tue Jun 5 15:22:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 137757 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1098861lji; Tue, 5 Jun 2018 08:26:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL83DkDpfJkKK49WwqNsUqmwmU3KMoy94/rItNtHm39Lytz1akqfGaGHLWrVCbDoj+7fYRM X-Received: by 2002:a24:90d:: with SMTP id 13-v6mr10497021itm.69.1528212361491; Tue, 05 Jun 2018 08:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528212361; cv=none; d=google.com; s=arc-20160816; b=mGDs8ZF/L9urnxWryd6n3Uh74yFb65wBztyplfXanplfGa5QaBgxdtZ1geTPJm/L67 IM/F9ds/WCAj2Uon7MG1zrNJGcsf61q/zfb9jDlnpmPT2TP3gVamhsre/uM2qPG9H1HF u7VxjU9nEfR+vsPfyRbVuxmeMqxeNVvivZljPAq1mfMRcZPWpZf54LLbTL3DEFw659HR bf1IDBdREtTILoIkcmSbCBrAlHhCYcLlYPCv0X447F65fgnMEyQ9qmv6q2gYO5OB/3Vv vYIUJmiJu7u5iLtTx3erM6TH5fTNUBMgnvJ3gd4CodX2Hu4fxdBhRPepHhBHcQ9peAR2 dh0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=PzO0feCuxZZfP+U0QbNYW06EU1dL/m4p3TFw+WgR9wc=; b=iB/lQ9gI5YoPNbO7tfULP/05hn70BRaAlwzKY/7XgrFeprvDpN7JN1vG4+uBMIK6dM g7kMk5DWM069msWQuIxR8cpVxwYmgCb6406v3AWBpegcVz3KmJKkKHUEiAOj5gWFkgY/ 2vln0rTzJZ3dx4BhBD60l6cM6p3jYCDpOo26GiSGfEkuTOGnUyN89SwZgtglcGGh3XjB Md7o0d+7W/XFCpZTPaLORfkUKfw2OR98TKtiUQksEbj5ul39A7/bzVI9cxDijvON5aUW atT4ImZ2Dxm33ff53SrzbfeKzTBXwf3R5doCQxV52q30Cseh7pMle+ixVd7r90mbmK2y N/GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m185-v6si429878ioa.26.2018.06.05.08.26.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 08:26:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fQDnu-0005Ak-Da; Tue, 05 Jun 2018 15:23:22 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fQDnt-0005AR-0Y for xen-devel@lists.xenproject.org; Tue, 05 Jun 2018 15:23:21 +0000 X-Inumbo-ID: 103aff71-68d4-11e8-9728-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 103aff71-68d4-11e8-9728-bc764e045a96; Tue, 05 Jun 2018 17:21:05 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43A4E15AD; Tue, 5 Jun 2018 08:23:19 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5925E3F557; Tue, 5 Jun 2018 08:23:18 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 5 Jun 2018 16:22:51 +0100 Message-Id: <20180605152303.14450-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180605152303.14450-1-julien.grall@arm.com> References: <20180605152303.14450-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v1 01/13] xen/arm: domain: Zero the per-vCPU cpu_info X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" A stack is allocated per vCPU to be used by Xen. The allocation is done with alloc_xenheap_pages that does not zero the memory returned. However the top of the stack is containing information that will be used to store the initial state of the vCPU (see struct cpu_info). Some of the fields may not be initialized and will lead to use/leak bits of previous memory in some cases on the first run of vCPU (AFAICT this only happen on vCPU0 for Dom0). This is part of XSA-263. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Zero only cpu_info --- xen/arch/arm/domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index ec0f042bf7..5a2a9a6b83 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -550,6 +550,7 @@ int vcpu_initialise(struct vcpu *v) v->arch.cpu_info = (struct cpu_info *)(v->arch.stack + STACK_SIZE - sizeof(struct cpu_info)); + memset(v->arch.cpu_info, 0, sizeof(*v->arch.cpu_info)); memset(&v->arch.saved_context, 0, sizeof(v->arch.saved_context)); v->arch.saved_context.sp = (register_t)v->arch.cpu_info;