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

Re: [PATCH 3/3] EFI: drop copy-in from QueryVariableInfo()'s OUT-only variable bouncing


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <luca.fancellu@xxxxxxx>
  • Date: Fri, 3 Dec 2021 16:11:44 +0000
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zCRiyhMnjTaYecQ/DEDtokAnrGVsW8nWixQd2afqiQ0=; b=CpDCh6dZS54IHno4NQwUTX5dDaRiSBY9aCr4+gc2bv4mS3VRA624NLsN8wij8r27owrLL9cQ0BoDg1GknH2Avp5WlOL8Wez2FVTAnYPVx1c91RDfRFK4SY9HvZ3JePIPUsZAbtgBl+bXIcFCk4DFFe+dsScHgISe0SFA96vlLlcp0Y4Rrnja9MyrYynEWvb+PrtWDDwK+f4ht8krkgcBFeNyT5Kd3Qfv73X7hzEnlORtOdZq4BvkQOCHLJ53HdF4xZ2fywV3HVSi5K8BkUUK8YWGFQJW753qGm4a8S0P9UAS4x+re/T3S50GuMIQtvs6KyJkFnELEdhl3suiViQFQw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DjFhRPYCBs3HW//WGPCjgLhg5GpSA+dxT0npvJ7PkwxlS9v/1xHU2qbQJqD9Mco8eTSkLL4gJXSeWdgEiUbGbctxTzOe7KC1mWvKKYwSVUPZUrMf6Fc8//TKV88csRlEhUoUdBFf0vJvY6mPlzF2e2+fFtl444tTmSOu/WeR/RczmtqBB31EuUoatfXW3MalFWNeh/XYvqasAAC/jtyxbxgoin+mMkCjkn+COt4nHlkfRU5C1gvmXaR+AZZU/SzZf6YIfYnEDzJYuV5Z5HxxzpvLGlbdNyenk1jN6znFZXmPm+aHVwf5kepqsnst+frzoOOBIgbwfwu4HrVl9Iyyow==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 03 Dec 2021 16:12:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;


> On 3 Dec 2021, at 10:58, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> While be12fcca8b78 ("efi: fix alignment of function parameters in compat
> mode") intentionally bounced them both ways to avoid any functional
> change so close to the release of 4.16, the bouncing-in shouldn't really
> be needed. In exchange the local variables need to gain initializers to
> avoid copying back prior stack contents.
> 

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

> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/common/efi/runtime.c
> +++ b/xen/common/efi/runtime.c
> @@ -608,7 +608,15 @@ int efi_runtime_call(struct xenpf_efi_ru
> 
>     case XEN_EFI_query_variable_info:
>     {
> -        uint64_t max_store_size, remain_store_size, max_size;
> +        /*
> +         * Put OUT variables on the stack to make them 8 byte aligned when
> +         * called from the compat handler, as their placement in
> +         * compat_pf_efi_runtime_call will make them 4 byte aligned instead
> +         * and compilers may validly complain.  This is done regardless of
> +         * whether called from the compat handler or not, as it's not worth
> +         * the extra logic to differentiate.
> +         */
> +        uint64_t max_store_size = 0, remain_store_size = 0, max_size = 0;
> 
>         if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT )
>             return -EINVAL;
> @@ -642,21 +650,6 @@ int efi_runtime_call(struct xenpf_efi_ru
>         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
>             return -EOPNOTSUPP;
> 
> -        /*
> -         * Bounce the variables onto the stack to make them 8 byte aligned 
> when
> -         * called from the compat handler, as their placement in
> -         * compat_pf_efi_runtime_call will make them 4 byte aligned instead 
> and
> -         * and compilers may validly complain.
> -         *
> -         * Note that while the function parameters are OUT only, copy the
> -         * values here anyway just in case. This is done regardless of 
> whether
> -         * called from the compat handler or not, as it's not worth the extra
> -         * logic to differentiate.
> -         */
> -        max_store_size = op->u.query_variable_info.max_store_size;
> -        remain_store_size = op->u.query_variable_info.remain_store_size;
> -        max_size = op->u.query_variable_info.max_size;
> -
>         state = efi_rs_enter();
>         if ( !state.cr3 )
>             return -EOPNOTSUPP;
> 
> 




 


Rackspace

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