I was hitting a bug in this function: https://github.com/TrenchBoot/xen/blob/aem-4.17.4/xen/arch/x86/intel_txt.c#L2
on the E820 checks/modifications:
(XEN) Xen version 4.17.4 (user@[unknown]) (gcc (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1)) debug=y Sun Sep 22 09:49:27 UTC 2024
(XEN) Latest ChangeSet:
(XEN) build-id: 0f9c9aafe32a3dd85ea590f5dd139d085afbd9d3
(XEN) Bootloader: GRUB 2.06
(XEN) Command line: placeholder loglvl=all console=com1 com1=115200,8n1,pci dom0_mem=min:1024M dom0_mem=max:4096M smt=off ucode=scan gnttab_max_frames=2048 gnttab_max_maptrack_frames=4096
(XEN) Xen image load base address: 0x75000000
(XEN) Video information:
(XEN) VGA is text mode 80x25, font 8x16
(XEN) Disc information:
(XEN) Found 1 MBR signatures
(XEN) Found 1 EDD information structures
(XEN) CPU Vendor: Intel, Family 6 (0x6), Model 154 (0x9a), Stepping 3 (raw 000906a3)
(XEN) Enabling Supervisor Shadow Stacks
(XEN) Enabling Indirect Branch Tracking
(XEN) SLAUNCH: reserving event log (0x7582c000 - 0x75834000)
(XEN) SLAUNCH: reserving TXT heap (0x7b710000 - 0x7b800000)
(XEN) Xen BUG at arch/x86/intel_txt.c:44
(XEN) ----[ Xen-4.17.4 x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<ffff82d040403efa>] protect_txt_mem_regions+0x115/0x11f
(XEN) RFLAGS: 0000000000010046 CONTEXT: hypervisor
(XEN) rax: 0000000000000000 rbx: 0000000075834000 rcx: 0000000000000001
(XEN) rdx: 0000000000000012 rsi: 000000000000001e rdi: 000000007b800000
(XEN) rbp: ffff82d04041fd98 rsp: ffff82d04041fd88 r8: 0000000000000002
(XEN) r9: 0000000000000000 r10: 0000000000000001 r11: 0000000000000010
(XEN) r12: 000000007582c000 r13: 0000000000000000 r14: ffff82d0403ebb30
(XEN) r15: 0000000000000000 cr0: 0000000080050033 cr4: 00000000008000a0
(XEN) cr3: 0000000075481000 cr2: 0000000000000000
(XEN) fsb: 0000000000000000 gsb: 0000000000000000 gss: 0000000000000000
(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: 0000 cs: e008
(XEN) Xen code around <ffff82d040403efa> (protect_txt_mem_regions+0x115/0x11f):
(XEN) 0f 5b 41 5c 5d c3 0f 0b <0f> 0b 0f 0b 0f 0b 0f 0b 0f 0b 48 8b 15 ed 2b 05
(XEN) Xen stack trace from rsp=ffff82d04041fd88:
(XEN) 0000000075834000 000000007582c000 ffff82d04041fdb8 ffff82d040407c40
(XEN) ffff82d0403a3070 00007d2fbfca34d0 ffff82d04041fee8 ffff82d040405c35
(XEN) ffffffffffffffff 0000000000000000 753ebb2c753eb0f0 7541fe5c7541fea0
(XEN) ffff82d04041fef8 7541fe1800000012 0000000000000020 7582c4d000000000
(XEN) 7541fe5c753ebb2c 0000000000000000 0020000b00000001 000000007582c4d2
(XEN) ffff83000009dec0 0000000000000000 ffff83000009df80 ffff83000009dfb0
(XEN) 0000000000000000 0000000000000000 0000000100000000 7582c4d20020000b
(XEN) 0000000000000000 0000000000000000 0000000000000000 2d00000000000000
(XEN) 0000000800000000 000000010000006e 0000000000000003 00000000000002f8
(XEN) 753ea64801000000 753ebe3a0009ded0 0000000000000002 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 ffff82d04027961b 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000e01000000000
(XEN) 0000000000000000 0000000000000000 00000000008000a0 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000
(XEN) Xen call trace:
(XEN) [<ffff82d040403efa>] R protect_txt_mem_regions+0x115/0x11f
(XEN) [<ffff82d040407c40>] F protect_slaunch_mem_regions+0x73/0xf8
(XEN) [<ffff82d040405c35>] F __start_xen+0xaa6/0x26cc
(XEN) [<ffff82d04027961b>] F __high_start+0xdb/0xdd
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Xen BUG at arch/x86/intel_txt.c:44
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
This code version worked well: https://github.com/TrenchBoot/xen/blob/v0.4.0/xen/arch/x86/intel_txt.c#L37
Hit the bug on protectli VP4670 running coreboot. coreboot already marks the TXT memory as reserved, so this could be a problem possibly?
I was hitting a bug in this function: https://github.com/TrenchBoot/xen/blob/aem-4.17.4/xen/arch/x86/intel_txt.c#L2
on the E820 checks/modifications:
This code version worked well: https://github.com/TrenchBoot/xen/blob/v0.4.0/xen/arch/x86/intel_txt.c#L37
Hit the bug on protectli VP4670 running coreboot. coreboot already marks the TXT memory as reserved, so this could be a problem possibly?