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

Re: [PATCH for-4.16 v3] efi: fix alignment of function parameters in compat mode


  • To: Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 Nov 2021 09:00:08 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=uZ+8gqBAh4gz//9s10pBd6JlnLvZPx68jyw3ESdi6hE=; b=kLSrdf/G+84bqgB5fPZuztJHTeUz6ACDE1wR38jVpI8708it5gy82voRDNW2+sUf7FbhG6l07O67JCicVXUmJreg7+2KkZafTL0VDyDFFMYF6hanGjNAS9PJfy/AWv9lfoYpsxzYQd3vEt4NGBOMOLagrP57LlAJPKf5uxp3C/omXETsPqL1nqICwhmJ/+N8cyMvDKaol1xvnau1DfmDLZec1Dslppu9qiGMlKmlEpcqkTk7Nh39/R/ElQh+Z7hWWY1Lhi10iHvUCHeOQHH8P+AwsKwSoXC93JLv3z+xhDUpU9wDBPZimy/b9F0XE3mAL/qV6nP+l+GTFVrVwEJ3mA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PB1x7K0ANVv5O1lqwS2Jb7H4QFTfhk+FzUY+reWsHLNE1MVDy8BE+I5vLOETF4yH/gyiD9XTHFT7R4m3782kkf5ezY3TnF1u1eWATMtYOVnMQqC/5Xqt03XBBpBDFBMoI4cIMmlsuYD5DHCFQ6Pi1653NamDR+O41cYBz+h7SjCKRj63mDjXNr69BXuDshnixmWlqIrUgSt/Eg73s4wdPQAL5kMS4KbJlWAq3Dca7DY6jJ6zVoQMKHDLJqtK3RYdmZxBfgl16T1jlzR7Ih2HnlGg6s5HHWCpsw41C1AXceBN3yn4M4k3YEH50FJXnPgSBrN+ELJbdPolkoiCqoDB7Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Andrew Cooper <amc96@xxxxxxxx>
  • Delivery-date: Mon, 22 Nov 2021 08:00:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.11.2021 18:09, Ian Jackson wrote:
> Andrew Cooper writes ("Re: [PATCH for-4.16 v3] efi: fix alignment of function 
> parameters in compat mode"):
>> Some hardtabs appear to have slipped in.
> 
> Thanks.  Fixed.
> 
>> Jan gave a conditional R-by which permitted a change along these lines,
>> but he's left the office now too, so you'll have to take him up on that
>> offer if you want this committing before Monday.
> 
> Right.
> 
> FTAOD I think I have done what Jan approved, and Andy double checked
> that.  So I am about to push this.  For the record, final version
> below.

Right, thanks. Nevertheless I think for 4.17 we will want to ...

> --- a/xen/common/efi/runtime.c
> +++ b/xen/common/efi/runtime.c
> @@ -607,6 +607,9 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
>      break;
>  
>      case XEN_EFI_query_variable_info:
> +    {
> +        uint64_t max_store_size, remain_store_size, max_size;
> +
>          if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT )
>              return -EINVAL;
>  
> @@ -638,16 +641,36 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
>  
>          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;

... eliminate these.

Jan




 


Rackspace

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