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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 3 Dec 2021 11:58:18 +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=lyHpDq+f1Yn1Y+Nw40SlcTxVr78qVUTB+hT/e8DkD7A=; b=WqG6OZAd/jLKfirDmd/v21p9vssEy+5msy/81qCn7XJuxPVThdlTViMWs3SVwEiSuFrKqQnMlpeEoazB1H7RlkwqSJqlVJX8MS9QDIVPUVnCuR8CtawpVerbmsQ+itRkPc4U9O0ZhjIwOSLF6yMeIvXxxSZoR9ub+8YMl3m9CYqDoWeDIXMTl/TTqn8gncwLxlrJJ//xzJEhM3xwtsp5rLsJ4OBzThTNnuc7BbWo4Y7aAup18xnoEgZxlTwTpEf8NOCrJwCKsWm2mUPsrfn/kaksj+oH7v83COXP8eK/xaWYzXhgAdynIVyKjK2lm2rI7NOcVT7+i7s7/9HXU6R44Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z4cMBeRZRMNoZ/Nip+eSIwLTXwb/K69kihURpo+cxoh/+tpeOdcOPSouardHbSIvYbOuTkkiCmwRUGNwpP+K1XgUPghP8175/RPXnjlDkI8PQnTurYFw3NG/QNPgOLJHcGdBbCy8fJsS5fSQpYLmJjpmh0b8dcfQWIF4gHOPfrPJGCT0SKZHSyes4/Wq+AcQGm5sH/Ls/JmznqtXXfza1+rvbl33ndVluGTOK8fCZXRRTseUdTbaEFOfAzJpNMg+iqR0DpZuKOB77q5cMnx84hqIeMVT6KlyRaNkowCZB8GuuowZgjkhBEz84rAEEuU2P6KzHDflD1IEEfXeufRpyQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: 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 10:58:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

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®.