Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
66b7130
Add TDX Makefile target
jakecorrenti Feb 27, 2025
3e50bea
Add TDX Makefile target for examples
jakecorrenti Feb 27, 2025
4af1d46
add tdx-config-noattest.json
jakecorrenti Feb 27, 2025
3f20d2b
update dependencies
jakecorrenti Feb 27, 2025
48198ae
update pre-existing CC feature checks
jakecorrenti Feb 27, 2025
02c0189
temporarily link libkrun-tdx with libkrunfw-sev
jakecorrenti Feb 27, 2025
4e7d38c
Use `kvm_userspace_memory_region2` and friends
jakecorrenti Sep 17, 2024
5eed8f1
Disable `KVM_CREATE_IRQCHIP` for TDX
jakecorrenti Feb 27, 2025
68d1e25
Disable register setup for TDX
jakecorrenti Feb 27, 2025
25b3a62
Implement `Vm::new()` for TDX
jakecorrenti Sep 17, 2024
4adca37
adjust params header
jakecorrenti Feb 27, 2025
3044cf5
change reset vector for TDX
jakecorrenti Feb 27, 2025
8c65fbd
Implement `tdx_secure_virt_prepare`
jakecorrenti Sep 17, 2024
fd8d51e
Change measured regions for TDX
jakecorrenti Feb 27, 2025
3a3ac1c
update how qboot is written to memory
jakecorrenti Feb 27, 2025
6f28cfc
update CPUID for vcpu on TDX
jakecorrenti Feb 27, 2025
0b0a24c
init tdx vcpu
jakecorrenti Feb 27, 2025
9acdc26
init memory regions for tdx
jakecorrenti Feb 27, 2025
657a0a3
finalize vm for tdx
jakecorrenti Feb 27, 2025
fe1dadf
add serial device to TDX or else it hangs
jakecorrenti Feb 27, 2025
6368123
introduce support for TDX vCPU exit reason
jakecorrenti Feb 27, 2025
7e7acfa
implement TDG_VP_VMCALL_REPORT_FATAL_ERROR handler
jakecorrenti Feb 27, 2025
77caaf5
add TDG_VP_VMCALL_SETUP_EVENT_NOTIFY_INTERRUPT handler
jakecorrenti Feb 27, 2025
5418aec
keep track of guest memfd regions in vmm
jakecorrenti Feb 28, 2025
2b05f41
add Vmm::vm_fd()
jakecorrenti Feb 28, 2025
6686e41
add convert_memory()
jakecorrenti Feb 28, 2025
311e0fd
setup thread that when sent a GPA, length, and to_private, will conve…
jakecorrenti Feb 28, 2025
8d02d59
add TDG_VP_VMCALL_MAP_GPA handler
jakecorrenti Feb 28, 2025
f8b3c5d
implement VcpuExit::MemoryFault
jakecorrenti Feb 28, 2025
8e8c20e
misc intermediate commit before adding IOAPIC
jakecorrenti Mar 6, 2025
c1f34bc
libkrun: load libkrunfw as a dynamic library
slp Jan 21, 2025
3448d30
libkrun: support external kernels on aarch64
slp Jan 21, 2025
4db1e64
Support multiple kernel formats
slp Jan 23, 2025
4c71406
Support external initramfs and custom cmdline
slp Feb 17, 2025
fb4aa04
examples: add an example for external kernels
slp Feb 19, 2025
0aaea80
misc commit for changing cfg feat. should be added as its own name
jakecorrenti Mar 18, 2025
123a09b
devices: generalize interrupt controllers
slp Mar 6, 2025
045a0fd
macos/vstate: unify MPIDR generation
slp Mar 14, 2025
0049b2b
hvf: update Hypervisor.framework bindings
slp Feb 27, 2025
f796d4d
devices: implement support for in-kernel HVF GICv3
slp Mar 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 98 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ SNP_INIT_SRC = init/tee/snp_attest.c \
init/tee/snp_attest.h \
$(KBS_INIT_SRC) \

TDX_INIT_SRC = $(KBS_INIT_SRC)

KBS_LD_FLAGS = -lcurl -lidn2 -lssl -lcrypto -lzstd -lz -lbrotlidec-static \
-lbrotlicommon-static

Expand All @@ -27,6 +29,14 @@ ifeq ($(SEV),1)
INIT_SRC += $(SNP_INIT_SRC)
BUILD_INIT = 0
endif
ifeq ($(TDX),1)
VARIANT = -tdx
FEATURE_FLAGS := --features intel-tdx,tee,blk,kbs-types,serde,serde_json,curl
INIT_DEFS += -DTDX=1
INIT_DEFS += $(KBS_LD_FLAGS)
INIT_SRC += $(KBS_INIT_SRC)
BUILD_INIT = 0
endif
ifeq ($(GPU),1)
FEATURE_FLAGS += --features gpu
endif
Expand Down Expand Up @@ -91,6 +101,9 @@ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
ifeq ($(SEV),1)
mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
endif
ifeq ($(TDX),1)
mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
endif
ifeq ($(OS),Linux)
patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
else
Expand All @@ -108,6 +121,9 @@ $(LIBRARY_DEBUG_$(OS)): $(INIT_BINARY)
ifeq ($(SEV),1)
mv target/debug/libkrun.so target/debug/$(KRUN_BASE_$(OS))
endif
ifeq ($(TDX),1)
mv target/debug/libkrun.so target/debug/$(KRUN_BASE_$(OS))
endif
ifeq ($(OS),Linux)
patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_DEBUG_$(OS)) target/debug/$(KRUN_BASE_$(OS))
else
Expand Down
22 changes: 19 additions & 3 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,54 @@ LDFLAGS_x86_64_Linux = -lkrun
LDFLAGS_aarch64_Linux = -lkrun
LDFLAGS_arm64_Darwin = -L/opt/homebrew/lib -lkrun
LDFLAGS_sev = -lkrun-sev
LDFLAGS_tdx = -L../target/debug -lkrun-tdx
LDFLAGS_efi = -L/opt/homebrew/lib -lkrun-efi
CFLAGS = -O2 -g -I../include
ROOTFS_DISTRO := fedora
ROOTFS_DIR = rootfs_$(ROOTFS_DISTRO)

.PHONY: clean rootfs

EXAMPLES := chroot_vm
EXAMPLES := chroot_vm external_kernel
ifeq ($(SEV),1)
EXAMPLES := launch-tee
endif
ifeq ($(TDX),1)
EXAMPLES := launch-tee
endif
ifeq ($(EFI),1)
EXAMPLES := boot_efi
endif

all: $(EXAMPLES)

chroot_vm: chroot_vm.c
gcc -o $@ $< $(CFLAGS) $(LDFLAGS_$(ARCH)_$(OS))
# gcc -o $@ $< $(CFLAGS) $(LDFLAGS_$(ARCH)_$(OS))
gcc -o $@ $< $(CFLAGS) $(LDFLAGS_tdx)
ifeq ($(OS),Darwin)
codesign --entitlements chroot_vm.entitlements --force -s - $@
endif

launch-tee: launch-tee.c
ifeq ($(SEV),1)
gcc -o $@ $< $(CFLAGS) $(LDFLAGS_sev)
endif
ifeq ($(TDX),1)
gcc -o $@ $< $(CFLAGS) $(LDFLAGS_tdx)
endif

boot_efi: boot_efi.c
gcc -o $@ $< $(CFLAGS) $(LDFLAGS_efi)
ifeq ($(OS),Darwin)
codesign --entitlements chroot_vm.entitlements --force -s - $@
endif

external_kernel: external_kernel.c
gcc -o $@ $< $(CFLAGS) $(LDFLAGS_$(ARCH)_$(OS))
ifeq ($(OS),Darwin)
codesign --entitlements chroot_vm.entitlements --force -s - $@
endif

# Build the rootfs to be used with chroot_vm.
rootfs:
mkdir -p $(ROOTFS_DIR)
Expand All @@ -44,4 +60,4 @@ rootfs:
podman rm libkrun_chroot_vm

clean:
rm -rf chroot_vm $(ROOTFS_DIR) launch-tee boot_efi
rm -rf chroot_vm $(ROOTFS_DIR) launch-tee boot_efi external_kernel
8 changes: 7 additions & 1 deletion examples/chroot_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int main(int argc, char *const argv[])
}

// Set the log level to "off".
err = krun_set_log_level(0);
err = krun_set_log_level(4);
if (err) {
errno = -err;
perror("Error configuring log level");
Expand Down Expand Up @@ -280,6 +280,12 @@ int main(int argc, char *const argv[])
}
}

if (err = krun_set_tee_config_file(ctx_id, "/home/jcorrent/libkrun/examples/tdx-config-noattest.json")) {
errno = -err;
perror("Error setting the TEE config file");
return -1;
}

// Configure the rlimits that will be set in the guest
if (err = krun_set_rlimits(ctx_id, &rlimits[0])) {
errno = -err;
Expand Down
Loading