diff options
Diffstat (limited to 'emulators/xen-kernel/files/0002-build-clang-fix-XSM-dummy-policy-when-using-clang-4..patch')
-rw-r--r-- | emulators/xen-kernel/files/0002-build-clang-fix-XSM-dummy-policy-when-using-clang-4..patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/emulators/xen-kernel/files/0002-build-clang-fix-XSM-dummy-policy-when-using-clang-4..patch b/emulators/xen-kernel/files/0002-build-clang-fix-XSM-dummy-policy-when-using-clang-4..patch new file mode 100644 index 000000000000..51c37ee70547 --- /dev/null +++ b/emulators/xen-kernel/files/0002-build-clang-fix-XSM-dummy-policy-when-using-clang-4..patch @@ -0,0 +1,69 @@ +From e5a1bf46187b0d39ec7e8c46e11c42027840747c Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne <roger.pau@citrix.com> +Date: Fri, 10 Mar 2017 01:08:26 +0900 +Subject: [PATCH 2/2] build/clang: fix XSM dummy policy when using clang 4.0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There seems to be some weird bug in clang 4.0 that prevents xsm_pmu_op from +working as expected, and vpmu.o ends up with a reference to +__xsm_action_mismatch_detected which makes the build fail: + +[...] +ld -melf_x86_64_fbsd -T xen.lds -N prelink.o \ + xen/common/symbols-dummy.o -o xen/.xen-syms.0 +prelink.o: In function `xsm_default_action': +xen/include/xsm/dummy.h:80: undefined reference to `__xsm_action_mismatch_detected' +xen/xen/include/xsm/dummy.h:80: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__xsm_action_mismatch_detected' +ld: xen/xen/.xen-syms.0: hidden symbol `__xsm_action_mismatch_detected' isn't defined + +Then doing a search in the objects files: + +# find xen/ -type f -name '*.o' -print0 | xargs -0 bash -c \ + 'for filename; do nm "$filename" | \ + grep -q __xsm_action_mismatch_detected && echo "$filename"; done' bash +xen/arch/x86/prelink.o +xen/arch/x86/cpu/vpmu.o +xen/arch/x86/cpu/built_in.o +xen/arch/x86/built_in.o + +The current patch is the only way I've found to fix this so far, by simply +moving the XSM_PRIV check into the default case in xsm_pmu_op. This also fixes +the behavior of do_xenpmu_op, which will now return -EINVAL for unknown +XENPMU_* operations, instead of -EPERM when called by a privileged domain. + +Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> +--- +Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov> +--- + xen/include/xsm/dummy.h | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h +index abbe282..0039c39 100644 +--- a/xen/include/xsm/dummy.h ++++ b/xen/include/xsm/dummy.h +@@ -711,18 +711,13 @@ static XSM_INLINE int xsm_pmu_op (XSM_DEFAULT_ARG struct domain *d, unsigned int + XSM_ASSERT_ACTION(XSM_OTHER); + switch ( op ) + { +- case XENPMU_mode_set: +- case XENPMU_mode_get: +- case XENPMU_feature_set: +- case XENPMU_feature_get: +- return xsm_default_action(XSM_PRIV, d, current->domain); + case XENPMU_init: + case XENPMU_finish: + case XENPMU_lvtpc_set: + case XENPMU_flush: + return xsm_default_action(XSM_HOOK, d, current->domain); + default: +- return -EPERM; ++ return xsm_default_action(XSM_PRIV, d, current->domain); + } + } + +-- +2.10.1 (Apple Git-78) + |