Created
July 27, 2022 11:34
-
-
Save jarkkojs/823f6e989512a1b1b083dee8b6d8de7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define CC_USING_FENTRY | |
#include <linux/types.h> | |
#include <linux/stddef.h> | |
#include <linux/container_of.h> | |
#include <linux/psp-sev.h> | |
#include <linux/kvm.h> | |
#include <linux/kvm_host.h> | |
#include <uapi/asm/kvm.h> | |
/* | |
* sudo CPATH=$LINUX/arch/x86/kvm bpftrace snp-dump-vmsa.bt | |
*/ | |
#include <kvm_cache_regs.h> | |
#include <svm/svm.h> | |
k:vcpu_load | |
{ | |
printf("-> vcpu_load\n"); | |
/* vcpu is the first field of struct cpu_svm */ | |
@svm = (struct vcpu_svm *)arg1; | |
} | |
k:sev_mem_enc_ioctl /((struct kvm_sev_cmd *)uptr(arg2))->id == KVM_SEV_LAUNCH_UPDATE_VMSA/ | |
{ | |
@kvm[tid] = (struct kvm *)arg1; | |
} | |
kr:sev_mem_enc_ioctl /@kvm[tid] != 0 && retval == 0/ | |
{ | |
$data = (uint8 *)@svm->sev_es.vmsa; | |
$hex = buf($data, sizeof(struct vmcb_save_area)); | |
printf("%r\n", $hex); | |
delete(@kvm[tid]); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment