From patchwork Thu Nov 18 08:28:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12626277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC5A0C433EF for ; Thu, 18 Nov 2021 08:28:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 611DB611C5 for ; Thu, 18 Nov 2021 08:28:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 611DB611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.227175.392825 (Exim 4.92) (envelope-from ) id 1mncmM-0000vn-V8; Thu, 18 Nov 2021 08:28:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 227175.392825; Thu, 18 Nov 2021 08:28:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mncmM-0000vg-Rr; Thu, 18 Nov 2021 08:28:22 +0000 Received: by outflank-mailman (input) for mailman id 227175; Thu, 18 Nov 2021 08:28:21 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mncmL-0000va-83 for xen-devel@lists.xenproject.org; Thu, 18 Nov 2021 08:28:21 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7ae09631-4849-11ec-9787-a32c541c8605; Thu, 18 Nov 2021 09:28:19 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7ae09631-4849-11ec-9787-a32c541c8605 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1637224099; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=AqjN0EaMxlB4fMwGU+2y80IO2OZOEXGU0gV7jqUmP5M=; b=gQ1R2+1eFiJfY9CrzkbX5Qq38ny+PITa7F3SiVLEkG3xa3Dh7rIF3K3X NVimfgt7nh3YLdg4gY6eq6OPH+xxLq7NtXy6P/XrhM+20HpPqd+P+Sb4j 3LlZBp5itP+c2najrDVWGd/9F8HtQvrOD0hiaH1sVu23HBZ/VTE+BZwDT E=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: KwRLzz7fyEzqornLgetH9Q+NvIYLi0hbFwU1G41ue/BcYgi7Xtd9cGDvyGPvjYGFos4VtaXkKc 8z0aYINN8Ch2+4qhdUd++OgdJf3EcXEcEnEsuvQWnTGc7nI7chT/7myMNxm+NPyygEk2fdmu+f MO0CSVFwOjR7xHidfaTJzS5NT4ufHJLmuBdPPQJfy7HopmKZWL9G0GhC9SmtsIfMtXJRJ2LkNs VJZAq6xJsHQX23jbIjrU09AdmeAQRS9XUKSUsrh+GQBe0FjllSpB/0bMx58ymIcTCR1vTiHGnu OBRiVT6OTmeKY2ZEh08KhaFc X-SBRS: 5.1 X-MesageID: 60089337 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83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SNrCd2B4PGmnqLEwx/1MfjeBEZ05DUCtvGSM5y46oOzs/pgEM86JX/r1bop46zuNMd3Bz3Z WwDk1ZrsA+ciYoV9MPOA54e7rONoXse2O7DIvAGyWvKEk4U0i92aIfpo9FoN2XRA== X-IronPort-AV: E=Sophos;i="5.87,243,1631592000"; d="scan'208";a="60089337" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mJ9DEGfjAiUMnAUwZP1pcwKCggI+3d0WuFYKNN5QcEow5Tck3RKWZwCk2C9PVIAIqh7/wL/jEn0QZgjPo6JQdxD3ZMz426LBYD6eZ+353MH9cJGgp2YI5rdJhWd+VWc66G0oev/9fNUuWSA8dZLsQfcRnpCNzse2DkQfw06Qa0KpKl83iLoWcaqGjFN/IAKjdSuwUDuKKyi1a1VQyK70CrtwfVKqxAsHB4OY2ovNb9Vxo6aBeCZRQ0bEP73Z3O/Y99MC4VX8CrS2cgChVdNgoFFyuJfkPwx6eNTnvf2mGqanVB30A4zqLHAC1cGp/BUFo7GPSrqelxFuMdm6hz29/w== 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=7iI4sG5ccFDAseKHYLIAbbrV1FZm8Jj/ahp9xsvOjKA=; b=FfaHf26vRCWOGaE/p20/C4Dyazje2sUbh0e7+U4psu2rqx/Q8d9ZncLSWL30eis5QjjmpBarpRMvrPLAJTFy6HAICUKFOLXrmiS8bo9OLPKgSDimBa12u9Uf1aUglh/xHXm3HD7A3t7EHVzOb1RpG0ZQ4oMTYhXalfJvohq0FJQzYbqpDoI+EtZZUZ/gmEQDprY7+yo/Q9sl4B9mzVZCYBuGWUjNx+rlKd1gW/ftGxk5belM4hLUYgqOPMI1kLcqioYJADqVq1ocJ5NjA7VZrXKpD7bPeUFJDdnG29Hd/rlH5MPGmKZAsp4dJN/M8g0Y2Kzvf2o+9zSLOrniFwJdtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7iI4sG5ccFDAseKHYLIAbbrV1FZm8Jj/ahp9xsvOjKA=; b=d/lxnz751aCPKRTaqYRqcJo3oDzqmp+rCxql52cUmfFBVcGAzbomlyxGhhu+qNlz5sAvNtKWCOWfIc3QuwjMZYD9WTfhNqqJkOEVIwnpm9Dm62j99A7xD2FvNQAowpTLIaiYWKnhLDcehOM/m4++p9fzGiKhd7RaQZfKpvlI+ZA= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Ian Jackson Subject: [PATCH for-4.16 v2] efi: fix alignment of function parameters in compat mode Date: Thu, 18 Nov 2021 09:28:06 +0100 Message-ID: <20211118082806.23335-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.33.0 X-ClientProxiedBy: MR2P264CA0058.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::22) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66dba142-702b-4046-9c6a-08d9aa6d5c25 X-MS-TrafficTypeDiagnostic: DM6PR03MB4396: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t9jiONIgMjVpDiNBi0q6qdX363TuVGn7XkMlBDO0jC3eIi+m96T/+Lkyxt5yuizFeKTCdJ6kjWSi76zZHzuof1t/x9E1ZN/xewqQfjzAbk9v41fcCM1I9GqqAclgNzymh9a3sMsBo3A+v3AKs6GGc3k6ZDnVSRGVFvdPc+ktLZYO3L+vUCXSgsfy/H43NWUrsYVf8VpXAFIUnlXR/FFpkF7auKbMDbRmQoVlIPB/NRaCXIYtnx1xtE3uKOuunakKi/rdORBwERfFcirc+WpBtpzyCLD/XncpjtRJc2qkpkOQR3MvrCWXSCMHlEDuMWu3fblEpHoLIdwrxcWf/Ebj7Pt1Ia9ycr0diz2RDAl60WPtCIDZzgUOW7OmuscpbodVADMcPXYe5RgoBLw3jVeDXbo2R0TFacxpySQ4LkcUxtEQm+ll+faO20fWSZMoSFFP+r90nw/u/9DdlKTqlBUAUfQ47Z6dkcwErAwhC8oUn6Ega63vt5QhE7S1uorGgaX+CHyI6c6E7FwshPKIjaIg+x6cRS1ZUV2ZTQOXwVpdVQKtMThsF/iBX04uTnE7dDpwoogIzJJ0xKLMNWHynvTh7rzJTD+WkIl9T3s35aCX3oJTsMBdyKogZFVGgn5l71h/O/rDyvBo3piNcPpAEqOvwA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8676002)(4326008)(83380400001)(6666004)(2906002)(1076003)(86362001)(26005)(36756003)(8936002)(6496006)(186003)(38100700002)(6916009)(6486002)(316002)(66946007)(82960400001)(66476007)(66556008)(508600001)(5660300002)(2616005)(956004)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NvQnHvi2oCvTaf1jh+iVGDztksSa?= =?utf-8?q?73YCTiRWlXU7HFRzqjFx9x5wYoxgE16HoyEehDRZ8KbQK8zzMoJHS7DF1RlGJKfFa?= =?ut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-8?q?1MjDNT0GL8ZKehCJYXW+aDjmrTmpDQxXSP4Jiys8xuB4RujRdR7PlCUzvUTDvO40d?= =?utf-8?q?TFEoM1NbDJCzJn/k1tedMCAvJt194h8fEbX+qPrrlgC3GGC8brgFceovnd4QOfm0M?= =?utf-8?q?9XioQ0lewRPXbswVLVIaf55Je6UcytDrmdUSHZiH1RgzBYWzn82wOnnqGNbWoMszV?= =?utf-8?q?GE9j2O3jm+VwHvd9Ve1wUDh7tMqWn1MNebCbhr2Irer4IszPqBtcYItlSE+d91DB+?= =?utf-8?q?TGcp1FxNVmnuca/n7mN7Y75Cmv9JU5FMdEStUUq0w1hjcbyWhUzNwYWygnIAsh5bn?= =?utf-8?q?ouTTF951i38LUFhlWMDneT8fu/5qxXfj/JedV1dOhOjCa+9fejAIBS5/e2aXapHGc?= =?utf-8?q?g0DL0xaTwYbdF0Qs7BwtMp2XD3bajT+ekHTq0tOJ4If6v+EpGr9yYzw9B32rUWeEz?= =?utf-8?q?EkrfVWAW1HE8yKVJhngVYUjqETwOIHt8pGjUmDBzzZQDNLfc5g2O0lLx1lAgDxg7W?= =?utf-8?q?KeY9Lxrv8BULALRUqJEY/71ufJxwgT82VGYn2+oxD2TwoZxR478ryyZU2yAQ3JVX7?= =?utf-8?q?aE6cbggjmofSFCdsSSejOEN3OqdEZu765KatdNuTi/XSKshVx0275E4=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 66dba142-702b-4046-9c6a-08d9aa6d5c25 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 08:28:12.6370 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nQ4clU7zljViU11rfnkUHmMhvilabj8qpU31opCmsVT/k8GNvT8XEHlB826hFrWSTUiw7sgbsyWi696MapGatA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4396 X-OriginatorOrg: citrix.com Currently the max_store_size, remain_store_size and max_size in compat_pf_efi_runtime_call are 4 byte aligned, which makes clang 13.0.0 complain with: In file included from compat.c:30: ./runtime.c:646:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch] &op->u.query_variable_info.max_store_size, ^ ./runtime.c:647:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 3 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch] &op->u.query_variable_info.remain_store_size, ^ ./runtime.c:648:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 4 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch] &op->u.query_variable_info.max_size); ^ Fix this by bouncing the variables on the stack in order for them to be 8 byte aligned. Note this could be done in a more selective manner to only apply to compat code calls, but given the overhead of making an EFI call doing an extra copy of 3 variables doesn't seem to warrant the special casing. Signed-off-by: Roger Pau Monné Release-Acked-by: Ian Jackson --- Changes since v1: - Copy back the results. --- Cc: Ian Jackson Tagged for possible inclusion into the release, as it's a likely candidate for backport. It shouldn't introduce any functional change from a caller PoV. I think the risk is getting the patch wrong and not passing the right parameters, or broken EFI implementations corrupting data on our stack instead of doing it in xenpf_efi_runtime_call. --- xen/common/efi/runtime.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c index 375b94229e..f1cbf3088c 100644 --- 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,34 @@ 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 + * clang will complain. + * + * Note we do this 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; status = efi_rs->QueryVariableInfo( - op->u.query_variable_info.attr, - &op->u.query_variable_info.max_store_size, - &op->u.query_variable_info.remain_store_size, - &op->u.query_variable_info.max_size); + op->u.query_variable_info.attr, &max_store_size, &remain_store_size, + &max_size); efi_rs_leave(&state); + + op->u.query_variable_info.max_store_size = max_store_size; + op->u.query_variable_info.remain_store_size = remain_store_size; + op->u.query_variable_info.max_size = max_size; + break; + } case XEN_EFI_query_capsule_capabilities: case XEN_EFI_update_capsule: