All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Oleksii K." <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Tim Deegan" <tim@xen.org>,
	"George Dunlap" <george.dunlap@cloud.com>
Subject: Re: [PATCH] x86/shadow: don't leave trace record field uninitialized
Date: Thu, 23 May 2024 10:05:54 +0200	[thread overview]
Message-ID: <58c63d645b27dbacdb6264b30ff78a74dc0acaa0.camel@gmail.com> (raw)
In-Reply-To: <5133a01d-346d-4779-b319-a156ef944669@suse.com>

On Wed, 2024-05-22 at 12:17 +0200, Jan Beulich wrote:
> 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 != 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 <jbeulich@suse.com>
Release-acked-by: Oleksii Kurochko <oleksii.kurochko.com>

~ Oleksii
> 
> --- 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 = TRC_SHADOW_EMULATE | ((GUEST_PAGING_LEVELS-2)<<8);
> -
> -        d.gl1e = gl1e;
> -        d.write_val.l1 = this_cpu(trace_emulate_write_val);
> -        d.va = va;
> +        } d = {
> +            .gl1e = gl1e,
> +            .write_val.l1 = this_cpu(trace_emulate_write_val),
> +            .va = va,
>  #if GUEST_PAGING_LEVELS == 3
> -        d.emulation_count = this_cpu(trace_extra_emulation_count);
> +            .emulation_count =
> this_cpu(trace_extra_emulation_count),
>  #endif
> -        d.flags = this_cpu(trace_shadow_path_flags);
> +            .flags = this_cpu(trace_shadow_path_flags),
> +        };
>  
> -        trace(event, sizeof(d), &d);
> +        trace(TRC_SHADOW_EMULATE | ((GUEST_PAGING_LEVELS - 2) << 8),
> +              sizeof(d), &d);
>      }
>  }
>  #endif /* CONFIG_HVM */


      parent reply	other threads:[~2024-05-23  8:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 10:17 [PATCH] x86/shadow: don't leave trace record field uninitialized Jan Beulich
2024-05-22 11:11 ` Roger Pau Monné
2024-05-22 11:13 ` Andrew Cooper
2024-05-23  8:05 ` Oleksii K. [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58c63d645b27dbacdb6264b30ff78a74dc0acaa0.camel@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@cloud.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.