From nobody Tue Nov 23 13:48:24 2021 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3ACA61888A1A; Tue, 23 Nov 2021 13:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hz57r6Rc8z3skB; Tue, 23 Nov 2021 13:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD1B51782A; Tue, 23 Nov 2021 13:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ANDmOEu072737; Tue, 23 Nov 2021 13:48:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ANDmOo7072736; Tue, 23 Nov 2021 13:48:24 GMT (envelope-from git) Date: Tue, 23 Nov 2021 13:48:24 GMT Message-Id: <202111231348.1ANDmOo7072736@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: =?utf-8?Q?Roger Pau Monn=C3=A9?= Subject: git: 96cede86ff9a - main - emulators/xen-kernel: fix build with clang 13.0.0 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96cede86ff9afdc44069daff2fede9880f530f84 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637675304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VgSyS+wRUNQ2/N1iPUrc8pQ5UnlWz3QX2cmzB3L+JGk=; b=kGZySRP1cFuvEmjTEHJHkD+BWomYUB8dYZ6wW6FHx+Q9gnQk0ESccEmKnWszqy/wQ8VRGy h8ei39zFl3kZ3Dn1hf3VexLh8OAUil6hOLc1MhPWlKel4iWnsxwQ28JWfUHDOdP11FgNVh M/jtu3NqxC9DVZGGPrdgaXShi+eVhaMxCUX7zrbbd2VMZ9a6DHkSOyC2caCv/GYtY1tYWh Ljjjwzo6j/gaLLPgbhnrJLPR3y1zh0MNXx+6K3K8DSm36vkM5CFJQURLovKdPbiTShfge4 eCDst1uhAc8ZDyabqYSVuS805K2R8cqFszY08HnGaVzLEA9McEnd/IRzW+jxZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637675304; a=rsa-sha256; cv=none; b=E+TawJJea7NNPEcksNdMkR5hOoVdkAkg5c/QUdYc3LpgkdLLgid2vSIVtQ7Wl/u4r9KMOF 3yO1FqOnHrZ2X49mg0VmEaSkYV4mjEAFIEcQ7Ux1q11gVRk0itCx9LtYqfCS+FZEs3FJpb i8tmwyQDgERuUxIR4rgI7SOMrh/cFKFZGJVq/IzSkOB0WgZUr3iweoGv1LiHWrvBgtZUeE 9ptzUxSc4z2Gq4KFf4WlMfkO40boHGQQdW56UIDcqnH8KEFTpN2sRJiKSWXjtwmV4siOIv dxlmEOlCYcYQB7Go/NzKVuRcW10uqkaS+511iL/oxipTV+mF22U3xg0zTN7BtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by royger (src committer): URL: https://cgit.FreeBSD.org/ports/commit/?id=96cede86ff9afdc44069daff2fede9880f530f84 commit 96cede86ff9afdc44069daff2fede9880f530f84 Author: Roger Pau Monné AuthorDate: 2021-11-23 08:57:48 +0000 Commit: Roger Pau Monné CommitDate: 2021-11-23 13:47:47 +0000 emulators/xen-kernel: fix build with clang 13.0.0 Sponsored by: Citrix Systems R&D Approved by: bapt (implicit) --- emulators/xen-kernel/Makefile | 5 +- ...gnment-of-function-parameters-in-compat-m.patch | 105 +++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/emulators/xen-kernel/Makefile b/emulators/xen-kernel/Makefile index 8bd1c117fa20..bb8cdb93dab0 100644 --- a/emulators/xen-kernel/Makefile +++ b/emulators/xen-kernel/Makefile @@ -1,6 +1,6 @@ PORTNAME= xen PORTVERSION= 4.15.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= emulators MASTER_SITES= http://downloads.xenproject.org/release/xen/${PORTVERSION}/ PKGNAMESUFFIX= -kernel @@ -28,6 +28,9 @@ EXTRA_PATCHES+= ${PATCHDIR}/0001-x86-mtrr-remove-stale-function-prototype.patch: ${PATCHDIR}/0002-x86-mtrr-move-epte_get_entry_emt-to-p2m-ept.c.patch:-p1 \ ${PATCHDIR}/0003-x86-ept-force-WB-cache-attributes-for-grant-and-fore.patch:-p1 +# Fix build with clang 13.0.0 +EXTRA_PATCHES+= ${PATCHDIR}/0001-efi-fix-alignment-of-function-parameters-in-compat-m.patch:-p1 + .include .if ${OPSYS} != FreeBSD diff --git a/emulators/xen-kernel/files/0001-efi-fix-alignment-of-function-parameters-in-compat-m.patch b/emulators/xen-kernel/files/0001-efi-fix-alignment-of-function-parameters-in-compat-m.patch new file mode 100644 index 000000000000..1612c5a113a1 --- /dev/null +++ b/emulators/xen-kernel/files/0001-efi-fix-alignment-of-function-parameters-in-compat-m.patch @@ -0,0 +1,105 @@ +From be12fcca8b784e456df3adedbffe657d753c5ff9 Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne +Date: Thu, 18 Nov 2021 09:28:06 +0100 +Subject: [PATCH] efi: fix alignment of function parameters in compat mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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 +Reviewed-by: Ian Jackson +Signed-off-by: Ian Jackson +Reviewed-by: Jan Beulich + +--- +Changes since v3: + - Remove hard tabs. Apply Jan's r-b as authorised in email. +Changes since v2: + - Adjust the commentary as per discussion. +Changes since v1: + - Copy back the results. +--- + xen/common/efi/runtime.c | 31 +++++++++++++++++++++++++++---- + 1 file changed, 27 insertions(+), 4 deletions(-) + +diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c +index 375b94229e..d2fdc28df3 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,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; ++ + 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: +-- +2.33.0 +