[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/shadow: fix DO_UNSHADOW()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <luca.fancellu@xxxxxxx>
  • Date: Wed, 19 May 2021 14:12:17 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YvwwWGAEFt90ka/F0LiIrlodcOLwe4zL5M3dJ3EI4gU=; b=Pinw3VJTU6GccX2NbNYmZh9t3MhiVpxMi/Ss+CaYKGommpdhuaWWhIc2Qsy6pIFFdzG1B2MoOydA+giKhQt6Yv0y8r8xqym0iTKxp7PV3vXKkJ7lAOCv9SkqcZniYa3B6RKdtlNKMURi5cgVHIg0uXlShlKCnBpWncKQ+pcce+0t55/UNY26gnvkTA71HKOdaqYlHzVFpBA6dI01wdMvaP8ac8GGds5vagY9rwEuFQnFH1mQz8rKaQ5roikIa34W1JzrWx0pBNKclI4bK4DTmxFA8TF2UwSg1JwBqbQ+7og196e6WMIN6FXgzMC+a8dpbnj72xztGjVfbRfPkLlhHg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j2qqUDKgeq43zGnMCcb0uD84s/+IbcGr5z+AfA3fs+hkiPsUrqYl8gqAmxgMsQC806WlN2y4Lh80CHlXpHjmMnObIUF5+YFJ8L9ap1aUEC7v9TBFD6KZ6TaLhvVKUhlhV1JQ5vWf/vgDSR2d+HqB5+LMd+TS9ciqvrzhyaGOd0Ahu+gC5pGzq+Z8STfCygo15noAIKA7zBVJRCBG16o2uFYUBH4z1p+vRVYueMRJbRbmvwLIs/6hYFmZkK5kOjTvktADlls14VXa4EcbNIL3A8d1SrfU4VjZzLXrOBTJNThCqeedwvT1IwmcdSbKtHenYxGY8+l31o5c05k7+Tcjaw==
  • Authentication-results-original: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 19 May 2021 13:12:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;


> On 19 May 2021, at 13:36, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> When adding the HASH_CALLBACKS_CHECK() I failed to properly recognize
> the (somewhat unusually formatted) if() around the call to
> hash_domain_foreach()). Gcc 11 is absolutely right in pointing out the
> apparently misleading indentation. Besides adding the missing braces,
> also adjust the two oddly formatted if()-s in the macro.
> 
> Fixes: 90629587e16e ("x86/shadow: replace stale literal numbers in 
> hash_{vcpu,domain}_foreach()")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>

Cheers,
Luca

> ---
> I'm puzzled as to why this bug didn't cause any fallout.
> 
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -2220,8 +2220,8 @@ void sh_remove_shadows(struct domain *d,
>      */
> #define DO_UNSHADOW(_type) do {                                         \
>     t = (_type);                                                        \
> -    if( !(pg->count_info & PGC_page_table)                              \
> -        || !(pg->shadow_flags & (1 << t)) )                             \
> +    if ( !(pg->count_info & PGC_page_table) ||                          \
> +         !(pg->shadow_flags & (1 << t)) )                               \
>         break;                                                          \
>     smfn = shadow_hash_lookup(d, mfn_x(gmfn), t);                       \
>     if ( unlikely(!mfn_valid(smfn)) )                                   \
> @@ -2235,11 +2235,13 @@ void sh_remove_shadows(struct domain *d,
>         sh_unpin(d, smfn);                                              \
>     else if ( sh_type_has_up_pointer(d, t) )                            \
>         sh_remove_shadow_via_pointer(d, smfn);                          \
> -    if( !fast                                                           \
> -        && (pg->count_info & PGC_page_table)                            \
> -        && (pg->shadow_flags & (1 << t)) )                              \
> +    if ( !fast &&                                                       \
> +         (pg->count_info & PGC_page_table) &&                           \
> +         (pg->shadow_flags & (1 << t)) )                                \
> +    {                                                                   \
>         HASH_CALLBACKS_CHECK(SHF_page_type_mask);                       \
>         hash_domain_foreach(d, masks[t], callbacks, smfn);              \
> +    }                                                                   \
> } while (0)
> 
>     DO_UNSHADOW(SH_type_l2_32_shadow);
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.