From nobody Fri Nov 22 13:01:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1716373078; cv=none; d=zohomail.com; s=zohoarc; b=WW5d7AZLFhpN1jWxaoh/57Rz87Ltl6MKhwNBuVR6/1xhDv6gtYhIzuCyiC4OMTknWWKtlHFqA4qufnM8Ps+zKoD4tOrbjgtCtKV/GAqVpHBGaoDMMArUMTzFTfDwdCz/ZFqyU06DLQ0aYN0xzDZIVOPfP3f6mPJgLhN6Q45skuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716373078; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LsEGTnCgHx262Iq6DzYer+wCgYB5sQXE9o6NLnCsuBo=; b=Hhv7CUKd84lu5Tf+rJiNV+PkX1GAQWolC4B0/L6Br5O9XvC3yQOV8L+VTK0zq//814dR7kh7pnLDkdwAzxjU1pVe5ujKJyQAiC8rHC8t5eFE7hRM4/DN+UpLMbAo04UYgIA5u0yA5i3lyaSr0xCwjKnW2a0KCiPDoTj3SzPPP6Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1716373078700199.08727810650475; Wed, 22 May 2024 03:17:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.727457.1131922 (Exim 4.92) (envelope-from ) id 1s9j2M-00061g-5K; Wed, 22 May 2024 10:17:34 +0000 Received: by outflank-mailman (output) from mailman id 727457.1131922; Wed, 22 May 2024 10:17:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s9j2M-00061Z-2o; Wed, 22 May 2024 10:17:34 +0000 Received: by outflank-mailman (input) for mailman id 727457; Wed, 22 May 2024 10:17:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s9j2K-00061T-Rp for xen-devel@lists.xenproject.org; Wed, 22 May 2024 10:17:32 +0000 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [2a00:1450:4864:20::52e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8002fb06-1824-11ef-90a0-e314d9c70b13; Wed, 22 May 2024 12:17:31 +0200 (CEST) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-56e69888a36so10667124a12.3 for ; Wed, 22 May 2024 03:17:31 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b017a5sm1758048466b.180.2024.05.22.03.17.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 May 2024 03:17:31 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8002fb06-1824-11ef-90a0-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1716373051; x=1716977851; darn=lists.xenproject.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=LsEGTnCgHx262Iq6DzYer+wCgYB5sQXE9o6NLnCsuBo=; b=RDlfUaW8o6s9axQS1/E7R4ThBvm4CyvFuZrjpYyejdlLH0qf2UEeVqjGBj7+MSf6TV oxxSAGKtvIMHrWsO/oS9x1DJyt1wVHT1UP9rVbXWT/ShnhlhAlh4zwXg/7MHgCjlRaZN diPzNACPus2yFflav3XRBjQgJEAaV7yoMseuKQCrIekd6TQqyUDwJ9o9blQpFdzoOntv MW2CWp8Nj2rehQBa8MAl5W8y2hCUKlQ8RKZlB+KG8rSh3wGvTlvyqnHDF7F4HQxL/Jb7 aVz6BAB4NR4+NhB6JZ8N1u1t2j4nyyXeniqqMDSEW3KIszZEQi7c7EtN2HOsRv2WQZ7u VTnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716373051; x=1716977851; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LsEGTnCgHx262Iq6DzYer+wCgYB5sQXE9o6NLnCsuBo=; b=Z4wl0QtjtXi+bDc51NHc0MsqS+sQU1pLL+DSSz2ZR+ZXBvuznYSBxOnrOVNvadbkXw bhDuLV29FmVzPyyu0GtQlae27yvHlU0/YFJtdHlafTB4knePV9tKrfIKFDFY+TYETyan 6bvGIFWRLFEyeQB57zvXfyrlaPQTCfmpDdec51irVVq7MOg4Np9Y10KUL/0+ADqmo8/2 iP9uRh5VZED3kE5PMyRnJ9nHE7wuW2iMv5FopzjMz2x3e6pF6DUMByLgJB+UwLUQRYuj s0qdr08fmiHBwbE99yMFv/ZKuySGKTDuQL+f59qlLKewTL3WbBRqJoZoRhnTAZmCLz5M W9UA== X-Gm-Message-State: AOJu0Yy2jf0cLLFcIPnL2MuuPUlSaxFOw/yAkYQzopvSVuZsVgai2ET5 HXQaOUVQvcQb5IlH20/+6td+TUEOHY8CHbqIL56KaWTg+sv6nk6P3yShP4Zn1d53U6GsafYDvXk = X-Google-Smtp-Source: AGHT+IEerRNk/qnKg7CM/QXot6V5imyKJxpO6/hp2cu+eLXdmcVWzjdtokqAlPIXo++nXmDoIUabzA== X-Received: by 2002:a17:906:16c9:b0:a59:b136:e40f with SMTP id a640c23a62f3a-a62280b6fb3mr97414266b.38.1716373051238; Wed, 22 May 2024 03:17:31 -0700 (PDT) Message-ID: <5133a01d-346d-4779-b319-a156ef944669@suse.com> Date: Wed, 22 May 2024 12:17:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Tim Deegan , George Dunlap , Oleksii Kurochko From: Jan Beulich Subject: [PATCH] x86/shadow: don't leave trace record field uninitialized Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0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nwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1716373081036100001 Content-Type: text/plain; charset="utf-8" The emulation_count field is set only conditionally right now. Convert all field setting to an initializer, thus guaranteeing that field to be set to 0 (default initialized) when GUEST_PAGING_LEVELS !=3D 3. While there also drop the "event" local variable, thus eliminating an instance of the being phased out u32 type. Coverity ID: 1598430 Fixes: 9a86ac1aa3d2 ("xentrace 5/7: Additional tracing for the shadow code") Signed-off-by: Jan Beulich Acked-by: Roger Pau Monn=C3=A9 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -2093,20 +2093,18 @@ static inline void trace_shadow_emulate( guest_l1e_t gl1e, write_val; guest_va_t va; uint32_t flags:29, emulation_count:3; - } d; - u32 event; - - event =3D TRC_SHADOW_EMULATE | ((GUEST_PAGING_LEVELS-2)<<8); - - d.gl1e =3D gl1e; - d.write_val.l1 =3D this_cpu(trace_emulate_write_val); - d.va =3D va; + } d =3D { + .gl1e =3D gl1e, + .write_val.l1 =3D this_cpu(trace_emulate_write_val), + .va =3D va, #if GUEST_PAGING_LEVELS =3D=3D 3 - d.emulation_count =3D this_cpu(trace_extra_emulation_count); + .emulation_count =3D this_cpu(trace_extra_emulation_count), #endif - d.flags =3D this_cpu(trace_shadow_path_flags); + .flags =3D this_cpu(trace_shadow_path_flags), + }; =20 - trace(event, sizeof(d), &d); + trace(TRC_SHADOW_EMULATE | ((GUEST_PAGING_LEVELS - 2) << 8), + sizeof(d), &d); } } #endif /* CONFIG_HVM */