Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuilding gives "error: variable length array folded to constant array as an extension" #1

Closed
rnertney opened this issue Feb 21, 2024 · 3 comments

Comments

@rnertney
Copy link

Running Ubuntu 23.10, and configured via their steps outlined here.

Confirmed that TDX is working, but with 1.0:

[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-6.5.0-1003-intel-opt root=/dev/mapper/ubuntu--vg-ubuntu--lv ro kvm_intel.tdx=1 nomodeset
[    1.283582] Kernel command line: BOOT_IMAGE=/vmlinuz-6.5.0-1003-intel-opt root=/dev/mapper/ubuntu--vg-ubuntu--lv ro kvm_intel.tdx=1 nomodeset
[    2.699098] smpboot: CPU0: Intel(R) Xeon(R) Platinum 8480CTDX (family: 0x6, model: 0x8f, stepping: 0x8)
[    2.699748] tdx: BIOS enabled: private KeyID range [32, 64)
[   10.332676] systemd[1]: Hostname set to <tdx-01>.
[   12.053301] tdx: TDX module: attributes 0x0, vendor_id 0x8086, major_version 1, minor_version 0, build_date 20230206, build_num 457
[   12.053306] tdx: CMR: [0x100000, 0x77800000)
[   12.053306] tdx: CMR: [0x100000000, 0x406e000000)
[   12.053307] tdx: CMR: [0x4080000000, 0x8070000000)
[   13.325507] tdx: 2101260 KBs allocated for PAMT.
[   13.325512] tdx: module initialized.

Building and running the guest return this under dmesg

[ 7719.989358] ================================================================================
[ 7719.989485] UBSAN: array-index-out-of-bounds in /build/linux-intel-opt-Gcjo4J/linux-intel-opt-6.5.0/arch/x86/kvm/vmx/tdx.c:2609:59
[ 7719.989669] index 1 is out of range for type 'tdx_cpuid_value [*]'
[ 7719.989767] CPU: 151 PID: 11151 Comm: CPU 0/KVM Not tainted 6.5.0-1003-intel-opt #3-Ubuntu
[ 7719.989769] Hardware name: Supermicro SYS-741GE-TNRT/X13DEG-QT, BIOS 1.4 08/15/2023
[ 7719.989770] Call Trace:
[ 7719.989773]  <TASK>
[ 7719.989776]  dump_stack_lvl+0x48/0x70
[ 7719.989788]  dump_stack+0x10/0x20
[ 7719.989790]  __ubsan_handle_out_of_bounds+0xc6/0x110
[ 7719.989797]  setup_tdparams+0x4a3/0x4b0 [kvm_intel]
[ 7719.989820]  tdx_td_init+0x23e/0x330 [kvm_intel]
[ 7719.989833]  ? kmem_cache_free+0x22/0x3b0
[ 7719.989839]  tdx_vm_ioctl+0x9d/0x200 [kvm_intel]
[ 7719.989853]  vt_mem_enc_ioctl+0x18/0x30 [kvm_intel]
[ 7719.989866]  kvm_arch_vm_ioctl+0x77b/0xae0 [kvm]
[ 7719.989959]  ? memcg_account_kmem+0x1d/0x60
[ 7719.989964]  ? __cond_resched+0x1a/0x60
[ 7719.989970]  ? mutex_lock+0x12/0x50
[ 7719.989973]  ? tdx_vm_enable_cap+0x63/0x90 [kvm_intel]
[ 7719.989987]  ? vt_vm_enable_cap+0x18/0x30 [kvm_intel]
[ 7719.989999]  ? kvm_vm_ioctl_enable_cap+0x443/0x670 [kvm]
[ 7719.990059]  ? kvm_vm_ioctl+0x708/0xb30 [kvm]
[ 7719.990107]  ? __mod_lruvec_page_state+0x8a/0x130
[ 7719.990109]  kvm_vm_ioctl+0x708/0xb30 [kvm]
[ 7719.990152]  ? __handle_mm_fault+0x657/0x720
[ 7719.990157]  ? exit_to_user_mode_prepare+0x30/0xb0
[ 7719.990162]  ? syscall_exit_to_user_mode+0x37/0x60
[ 7719.990165]  ? do_syscall_64+0x68/0x90
[ 7719.990168]  ? count_memcg_events.constprop.0+0x2a/0x50
[ 7719.990173]  __x64_sys_ioctl+0xa0/0xf0
[ 7719.990177]  do_syscall_64+0x59/0x90
[ 7719.990178]  ? irqentry_exit_to_user_mode+0x17/0x20
[ 7719.990180]  ? irqentry_exit+0x21/0x40
[ 7719.990182]  ? exc_page_fault+0x94/0x190
[ 7719.990183]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[ 7719.990188] RIP: 0033:0x7f5b3992396f
[ 7719.990237] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00
[ 7719.990239] RSP: 002b:00007f5b331b43f0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 7719.990242] RAX: ffffffffffffffda RBX: 00000000c008aeba RCX: 00007f5b3992396f
[ 7719.990243] RDX: 00007f5b331b4570 RSI: ffffffffc008aeba RDI: 000000000000000b
[ 7719.990244] RBP: 00005652a3027050 R08: 0000000000000000 R09: 00007f5b331b6c38
[ 7719.990245] R10: 000000000000002b R11: 0000000000000246 R12: 00007f5b331b4570
[ 7719.990246] R13: 00007f5b331b4580 R14: 00007f5b331b4590 R15: 00005652a2041538
[ 7719.990248]  </TASK>
[ 7719.990249] ================================================================================
[ 7720.098641] NET: Registered PF_VSOCK protocol family

Checking the logfiles for qemu:

$ cat /tmp/tdx-guest-td.log
Invalid read at addr 0xFED40000, size 1, region '(null)', reason: rejected
Invalid read at addr 0xFED40030, size 4, region '(null)', reason: rejected
Invalid read at addr 0xFED40014, size 4, region '(null)', reason: rejected
Invalid read at addr 0xFED40000, size 1, region '(null)', reason: rejected
Invalid read at addr 0xFED40030, size 4, region '(null)', reason: rejected
Invalid read at addr 0xFED40014, size 4, region '(null)', reason: rejected
qemu-system-x86_64: warning: ram_block_discard_range_fd: Discarding RAM in private file mappings is possibly dangerous, because it will modify the underlying file and will affect other users of the file

I tried to update the tdx-module to 1.5. I checked out the 1.5 branch and tried to build, and got several of these messages:

$ make RELEASE=1
clang -I/home/user/tdx-module/include -I/home/user/tdx-module/libs/ipp/ipp-crypto-ippcp_2021.7.1/_build/.build/RELEASE/include -I/home/user/tdx-module/src -I/home/user/tdx-module/src/common -MD -MP -m64 -Wall -Wextra -fPIC -fno-builtin-memset -fvisibility=hidden -mcmodel=small -mstack-alignment=16 -mstackrealign -std=c17 -mno-mmx -mno-sse -fno-jump-tables -DFAULT_SAFE_MAGIC_INDICATOR=0xFF0F0F0F0F0F0FFF -DTDX_MODULE_BUILD_DATE=20240221 -DTDX_MODULE_BUILD_NUM=0 -DTDX_MINOR_SEAM_SVN=0 -DTDX_MODULE_MAJOR_VER=1 -DTDX_MODULE_MINOR_VER=5 -DTDX_MODULE_UPDATE_VER=0 -DTDX_MODULE_INTERNAL_VER=0 -DTDX_MODULE_HV=0 -DTDX_MIN_UPDATE_HV=0 -DTDX_NO_DOWNGRADE=0 -D_NO_IPP_DEPRECATED -O2 -Wdouble-promotion -Wshadow -Wconversion -Wmissing-prototypes -Wpointer-arith -Wuninitialized -Wunreachable-code -Wunused-function -Werror -D_FORTIFY_SOURCE=2 -fno-zero-initialized-in-bss -fstack-protector-strong -mshstk -fcf-protection   -D__FILENAME__=\"cpuid_configurations.c\" -c /home/user/tdx-module/include/auto_gen/cpuid_configurations.c -o /home/user/tdx-module/bin/release/obj/cpuid_configurations.o
In file included from /home/user/tdx-module/include/auto_gen/cpuid_configurations.c:28:
In file included from /home/user/tdx-module/include/auto_gen/cpuid_configurations.h:34:
/home/user/tdx-module/include/tdx_api_defs.h:592:1: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
tdx_static_assert(offsetof(td_sys_info_t, max_tdmrs) == OFFSET_OF_MEMORY_INFO_IN_TDHSYSINFO, td_sys_info_t);
^
/home/user/tdx-module/include/tdx_basic_defs.h:40:45: note: expanded from macro 'tdx_static_assert'
#define tdx_static_assert(e,x) typedef char assertion_##x  [(e)?1:-1]
                                            ^
<scratch space>:18:1: note: expanded from here
assertion_td_sys_info_t
^

I can edit the file to remove -Werror, and I see these...looks like some bad comments:

/home/user/tdx-module/src/td_dispatcher/tdx_td_transitions.S:2:4: error: unexpected token at start of statement
   / Copyright (C) 2023 Intel Corporation
   ^

Editing out the headers gets me further:

$ make RELEASE=1
clang -I/home/user/tdx-module/include -I/home/user/tdx-module/libs/ipp/ipp-crypto-ippcp_2021.7.1/_build/.build/RELEASE/include -I/home/user/tdx-module/src -I/home/user/tdx-module/src/common -MD -MP -m64 -Wall -Wextra -fPIC -fno-builtin-memset -fvisibility=hidden -mcmodel=small -mstack-alignment=16 -mstackrealign -std=c17 -mno-mmx -mno-sse -fno-jump-tables -DFAULT_SAFE_MAGIC_INDICATOR=0xFF0F0F0F0F0F0FFF -DTDX_MODULE_BUILD_DATE=20240221 -DTDX_MODULE_BUILD_NUM=0 -DTDX_MINOR_SEAM_SVN=0 -DTDX_MODULE_MAJOR_VER=1 -DTDX_MODULE_MINOR_VER=5 -DTDX_MODULE_UPDATE_VER=0 -DTDX_MODULE_INTERNAL_VER=0 -DTDX_MODULE_HV=0 -DTDX_MIN_UPDATE_HV=0 -DTDX_NO_DOWNGRADE=0 -D_NO_IPP_DEPRECATED -O2 -Wdouble-promotion -Wshadow -Wconversion -Wmissing-prototypes -Wpointer-arith -Wuninitialized -Wunreachable-code -Wunused-function -D_FORTIFY_SOURCE=2 -fno-zero-initialized-in-bss -fstack-protector-strong -mshstk -fcf-protection   -D__FILENAME__=\"exception_handling_asm.S\" -c /home/user/tdx-module/src/common/exception_handling/exception_handling_asm.S -o /home/user/tdx-module/bin/release/obj/exception_handling_asm.o
clang /home/user/tdx-module/bin/release/obj/cpuid_configurations.o /home/user/tdx-module/bin/release/obj/global_sys_fields_lookup.o /home/user/tdx-module/bin/release/obj/msr_config_lookup.o /home/user/tdx-module/bin/release/obj/op_state_lookup.o /home/user/tdx-module/bin/release/obj/sept_state_lookup.o /home/user/tdx-module/bin/release/obj/td_l2_vmcs_fields_lookup.o /home/user/tdx-module/bin/release/obj/tdr_tdcs_fields_lookup.o /home/user/tdx-module/bin/release/obj/td_vmcs_fields_lookup.o /home/user/tdx-module/bin/release/obj/tdvps_fields_lookup.o /home/user/tdx-module/bin/release/obj/aes_gcm.o /home/user/tdx-module/bin/release/obj/aes_gcm_stubs.o /home/user/tdx-module/bin/release/obj/crypto_stubs.o /home/user/tdx-module/bin/release/obj/sha384.o /home/user/tdx-module/bin/release/obj/td_vmcs_init.o /home/user/tdx-module/bin/release/obj/serial_port.o /home/user/tdx-module/bin/release/obj/sprintf.o /home/user/tdx-module/bin/release/obj/tdx_debug.o /home/user/tdx-module/bin/release/obj/cpuid_fms.o /home/user/tdx-module/bin/release/obj/error_reporting.o /home/user/tdx-module/bin/release/obj/ext_libs_override.o /home/user/tdx-module/bin/release/obj/helpers.o /home/user/tdx-module/bin/release/obj/migration.o /home/user/tdx-module/bin/release/obj/virt_msr_helpers.o /home/user/tdx-module/bin/release/obj/keyhole_manager.o /home/user/tdx-module/bin/release/obj/pamt_manager.o /home/user/tdx-module/bin/release/obj/sept_manager.o /home/user/tdx-module/bin/release/obj/metadata_generic.o /home/user/tdx-module/bin/release/obj/metadata_sys.o /home/user/tdx-module/bin/release/obj/metadata_td.o /home/user/tdx-module/bin/release/obj/metadata_vp.o /home/user/tdx-module/bin/release/obj/tdx_td_dispatcher.o /home/user/tdx-module/bin/release/obj/tdx_td_l2_dispatcher.o /home/user/tdx-module/bin/release/obj/td_cpuid.o /home/user/tdx-module/bin/release/obj/td_ept_violation.o /home/user/tdx-module/bin/release/obj/tdg_mem_page_accept.o /home/user/tdx-module/bin/release/obj/tdg_mem_page_attr_rd.o /home/user/tdx-module/bin/release/obj/tdg_mem_page_attr_wr.o /home/user/tdx-module/bin/release/obj/tdg_mr_report.o /home/user/tdx-module/bin/release/obj/tdg_mr_rtmr_extend.o /home/user/tdx-module/bin/release/obj/tdg_mr_verifyreport.o /home/user/tdx-module/bin/release/obj/tdg_sys_rdall.o /home/user/tdx-module/bin/release/obj/tdg_sys_rd.o /home/user/tdx-module/bin/release/obj/tdg_vm_rd_wr.o /home/user/tdx-module/bin/release/obj/tdg_vp_cpuidve_set.o /home/user/tdx-module/bin/release/obj/tdg_vp_info.o /home/user/tdx-module/bin/release/obj/tdg_vp_invept.o /home/user/tdx-module/bin/release/obj/tdg_vp_invvpid.o /home/user/tdx-module/bin/release/obj/tdg_vp_rd_wr.o /home/user/tdx-module/bin/release/obj/tdg_vp_veinfo_get.o /home/user/tdx-module/bin/release/obj/tdg_vp_vmcall.o /home/user/tdx-module/bin/release/obj/td_msr_access.o /home/user/tdx-module/bin/release/obj/td_other_exits.o /home/user/tdx-module/bin/release/obj/td_xsetbv.o /home/user/tdx-module/bin/release/obj/td_exit.o /home/user/tdx-module/bin/release/obj/td_exit_stepping.o /home/user/tdx-module/bin/release/obj/tdg_vp_enter.o /home/user/tdx-module/bin/release/obj/tdh_vp_enter.o /home/user/tdx-module/bin/release/obj/tdx_vmm_dispatcher.o /home/user/tdx-module/bin/release/obj/tdh_mem_page_add.o /home/user/tdx-module/bin/release/obj/tdh_mem_page_aug.o /home/user/tdx-module/bin/release/obj/tdh_mem_page_demote.o /home/user/tdx-module/bin/release/obj/tdh_mem_page_promote.o /home/user/tdx-module/bin/release/obj/tdh_mem_page_relocate.o /home/user/tdx-module/bin/release/obj/tdh_mem_page_remove.o /home/user/tdx-module/bin/release/obj/tdh_mem_range_block.o /home/user/tdx-module/bin/release/obj/tdh_mem_range_unblock.o /home/user/tdx-module/bin/release/obj/tdh_mem_rd_wr.o /home/user/tdx-module/bin/release/obj/tdh_mem_sept_add.o /home/user/tdx-module/bin/release/obj/tdh_mem_sept_rd.o /home/user/tdx-module/bin/release/obj/tdh_mem_sept_remove.o /home/user/tdx-module/bin/release/obj/tdh_mem_track.o /home/user/tdx-module/bin/release/obj/tdh_mng_add_cx.o /home/user/tdx-module/bin/release/obj/tdh_mng_create.o /home/user/tdx-module/bin/release/obj/tdh_mng_init.o /home/user/tdx-module/bin/release/obj/tdh_mng_key_config.o /home/user/tdx-module/bin/release/obj/tdh_mng_key_freeid.o /home/user/tdx-module/bin/release/obj/tdh_mng_key_reclaimid.o /home/user/tdx-module/bin/release/obj/tdh_mng_rd_wr.o /home/user/tdx-module/bin/release/obj/tdh_mng_vpflushdone.o /home/user/tdx-module/bin/release/obj/tdh_mr_extend.o /home/user/tdx-module/bin/release/obj/tdh_mr_finalize.o /home/user/tdx-module/bin/release/obj/tdh_phymem_cache_wb.o /home/user/tdx-module/bin/release/obj/tdh_phymem_page_rdmd.o /home/user/tdx-module/bin/release/obj/tdh_phymem_page_reclaim.o /home/user/tdx-module/bin/release/obj/tdh_phymem_page_wbinvd.o /home/user/tdx-module/bin/release/obj/tdh_sys_config.o /home/user/tdx-module/bin/release/obj/tdh_sys_info.o /home/user/tdx-module/bin/release/obj/tdh_sys_init.o /home/user/tdx-module/bin/release/obj/tdh_sys_key_config.o /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o /home/user/tdx-module/bin/release/obj/tdh_sys_lp_shutdown.o /home/user/tdx-module/bin/release/obj/tdh_sys_rdall.o /home/user/tdx-module/bin/release/obj/tdh_sys_rd.o /home/user/tdx-module/bin/release/obj/tdh_sys_shutdown.o /home/user/tdx-module/bin/release/obj/tdh_sys_tdmr_init.o /home/user/tdx-module/bin/release/obj/tdh_sys_update.o /home/user/tdx-module/bin/release/obj/tdh_vp_addcx.o /home/user/tdx-module/bin/release/obj/tdh_vp_create.o /home/user/tdx-module/bin/release/obj/tdh_vp_flush.o /home/user/tdx-module/bin/release/obj/tdh_vp_init.o /home/user/tdx-module/bin/release/obj/tdh_vp_rd_wr.o /home/user/tdx-module/bin/release/obj/exception_handling.o /home/user/tdx-module/bin/release/obj/td_l2_ept_violation.o /home/user/tdx-module/bin/release/obj/td_l2_interrupt.o /home/user/tdx-module/bin/release/obj/td_l2_other_exits.o /home/user/tdx-module/bin/release/obj/tdg_servtd_rd_wr.o /home/user/tdx-module/bin/release/obj/tdh_export_abort.o /home/user/tdx-module/bin/release/obj/tdh_export_blockw.o /home/user/tdx-module/bin/release/obj/tdh_export_mem.o /home/user/tdx-module/bin/release/obj/tdh_export_pause.o /home/user/tdx-module/bin/release/obj/tdh_export_restore.o /home/user/tdx-module/bin/release/obj/tdh_export_state_immutable.o /home/user/tdx-module/bin/release/obj/tdh_export_state_td.o /home/user/tdx-module/bin/release/obj/tdh_export_state_vp.o /home/user/tdx-module/bin/release/obj/tdh_export_track.o /home/user/tdx-module/bin/release/obj/tdh_export_unblockw.o /home/user/tdx-module/bin/release/obj/tdh_import_abort.o /home/user/tdx-module/bin/release/obj/tdh_import_commit.o /home/user/tdx-module/bin/release/obj/tdh_import_end.o /home/user/tdx-module/bin/release/obj/tdh_import_mem.o /home/user/tdx-module/bin/release/obj/tdh_import_state_immutable.o /home/user/tdx-module/bin/release/obj/tdh_import_state_td.o /home/user/tdx-module/bin/release/obj/tdh_import_state_vp.o /home/user/tdx-module/bin/release/obj/tdh_import_track.o /home/user/tdx-module/bin/release/obj/tdh_mig_stream_create.o /home/user/tdx-module/bin/release/obj/tdh_servtd_bind.o /home/user/tdx-module/bin/release/obj/tdh_servtd_prebind.o /home/user/tdx-module/bin/release/obj/tdx_td_transitions.o /home/user/tdx-module/bin/release/obj/tdx_seamcall_entry_point.o /home/user/tdx-module/bin/release/obj/tdx_seamret_to_vmm.o /home/user/tdx-module/bin/release/obj/exception_handling_asm.o -Wl,-shared -Wl,-pie -Wl,-e,tdx_seamcall_entry_point -Wl,-z,relro -Wl,-z,now -Wl,--wrap=__stack_chk_fail -disable-red-zone -nostartfiles -Wl,-T,/home/user/tdx-module/tdx_linker_script.lds -L/home/user/tdx-module/libs/ipp/ipp-crypto-ippcp_2021.7.1/_build/.build/RELEASE/lib -lippcp_s_y8 -o /home/user/tdx-module/bin/release/libtdx.so
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x1800): multiple definition of `msr_lookup'; /home/user/tdx-module/bin/release/obj/msr_config_lookup.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x2490): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x26d0): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x2800): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x2930): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x2a60): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/helpers.o:(.rodata+0x2b90): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_generic.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_sys.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/metadata_td.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_cpuid.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/td_msr_access.o:(.rodata+0x0): multiple definition of `msr_lookup'; /home/user/tdx-module/bin/release/obj/msr_config_lookup.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0xc90): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x2490): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x2a60): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x2800): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x2b90): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x26d0): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x0): multiple definition of `msr_lookup'; /home/user/tdx-module/bin/release/obj/msr_config_lookup.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_mng_init.o:(.rodata+0x2930): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_config.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x0): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x240): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_info.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_init.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x0): multiple definition of `cpuid_lookup'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x1800): multiple definition of `cpuid_configurable'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1800): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x1a40): multiple definition of `xfam_mask_0x7_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1ca0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x1b70): multiple definition of `xfam_mask_0x7_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1b70): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x1ca0): multiple definition of `xfam_mask_0x1_0xffffffff'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1a40): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x1dd0): multiple definition of `xfam_mask_0xd_0x0'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1dd0): first defined here
/usr/bin/ld: /home/user/tdx-module/bin/release/obj/tdh_sys_lp_init.o:(.rodata+0x1f00): multiple definition of `xfam_mask_0xd_0x1'; /home/user/tdx-module/bin/release/obj/cpuid_configurations.o:(.rodata+0x1f00): first defined here
/usr/bin/ld: warning: /home/user/tdx-module/bin/release/obj/exception_handling_asm.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:74: /home/user/tdx-module/bin/release/libtdx.so] Error 1
user@tdx-01:~/tdx-module$

And at this point I'm stuck. Any suggestions?

@sergey687
Copy link

sergey687 commented Feb 21, 2024

Hi Rob, thank you for your interest in the TDX module. Which Clang version are you using? The requirement for the current TDX 1.5 code is Clang 9.0.0 (not newer than that).

@rnertney
Copy link
Author

rnertney commented Feb 21, 2024

Hi Rob, thank you for your interest in the TDX module. Which Clang version are you using? The requirement for the current TDX 1.5 code is Clang 9.0.0 (not newer than that).

$ clang --version
Ubuntu clang version 16.0.6 (15)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

not newer than that .... oh! let me try to get some alternatives installed!

I'll reply back shortly :)

@rnertney
Copy link
Author

rnertney commented Feb 21, 2024

Thanks Sergey!

For future reference, here are the steps I took on Ubuntu 23.10 to fix this issue:

  • Download clang 9.0.0 (for Ubuntu 18.04)
    • wget https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-pc-linux-gnu.tar.xz
  • Extract it and move it to a reasonable location in your path:
    • tar -xvf clang+llvm-9.0.0-x86_64-pc-linux-gnu.tar.xz
    • sudo mv clang+llvm-9.0.0-x86_64-pc-linux-gnu/ /usr/local/clang_9.0.0
  • Utilize update-alternatives to install the two clang's side-by-side:
    • sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16
    • sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100
    • sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100
    • sudo update-alternatives --install /usr/bin/clang clang /usr/local/clang_9.0.0/bin/clang 50
    • sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/local/clang_9.0.0/bin/clang++ 50
  • Configure update-alternatives to utilize the older clang (each of these will prompt you to select the desired choice):
    • sudo update-alternatives --config clang
    • sudo update-alternatives --config clang++

This will get you 90% of the way there, but clang 9.0.0 will require semantically versioned libz3 if you just jump into make RELEASE=1. To get around this symlink to the installed libz3 from the 23.10 apt repo:

  • sudo ln -s /usr/lib/x86_64-linux-gnu/libz3.so.4 /usr/lib/x86_64-linux-gnu/libz3.so.4.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants