cachepc

Prime+Probe cache-based side-channel attack on AMD SEV-SNP protected virtual machines
git clone https://git.sinitax.com/sinitax/cachepc
Log | Files | Refs | Submodules | README | sfeed.txt

commit c1cc24c1e78f9c67bda882f2ee096fb8d6578cf0
parent d63e7e7e8c8632d7c0b1a9e2d2f9532b4f4815ae
Author: Louis Burda <quent.burda@gmail.com>
Date:   Thu,  5 Jan 2023 14:30:00 +0100

Stash previous changes

Diffstat:
MMakefile | 4++--
Mcachepc/cachepc.c | 2+-
Mcachepc/mmu.c | 4+++-
Mtest/fullstep.c | 6------
4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile @@ -10,7 +10,7 @@ BINS += test/readsvme util/debug util/reset CFLAGS = -I . -I test -Wunused-variable -Wunknown-pragmas -all: build $(BINS) +all: cachepc $(BINS) clean: $(MAKE) -C $(LINUX) SUBDIRS=arch/x86/kvm clean @@ -32,7 +32,7 @@ host: git -C $(LINUX) checkout HEAD git -C $(LINUX) stash pop -build: $(LINUX)/arch/x86/kvm/cachepc +cachepc: $(LINUX)/arch/x86/kvm/cachepc $(MAKE) -C $(LINUX) -j $(JOBS) M=arch/x86/kvm modules $(MAKE) -C $(LINUX) -j $(JOBS) M=crypto modules diff --git a/cachepc/cachepc.c b/cachepc/cachepc.c @@ -126,7 +126,7 @@ cachepc_init_pmc(uint8_t index, uint8_t event_no, uint8_t event_mask, uint64_t reg_addr; /* REF: https://developer.amd.com/resources/developer-guides-manuals - * (PPR 17H 31H, P.166) + * (PPR 19H 01H, P.166) * * performance event selection via 0xC001_020X with X = (0..A)[::2] * performance event reading viea 0XC001_020X with X = (1..B)[::2] diff --git a/cachepc/mmu.c b/cachepc/mmu.c @@ -34,7 +34,7 @@ cachepc_page_fault_handle(struct kvm_vcpu *vcpu, inst_fetch = fault->error_code & PFERR_FETCH_MASK; CPC_DBG("Tracked page fault attrs p:%i w:%i x:%i f:%i\n", - fault->present, inst_fetch, fault->write, fault->exec); + fault->present, fault->write, fault->exec, inst_fetch); count = 0; list_for_each_entry(tmp, &cachepc_faults, list) @@ -54,6 +54,8 @@ cachepc_page_fault_handle(struct kvm_vcpu *vcpu, cachepc_single_step = true; cachepc_apic_timer = 0; + + return false; /* setup untracked page */ } else if (cachepc_track_mode == CPC_TRACK_EXEC) { if (!inst_fetch || !fault->present) return false; diff --git a/test/fullstep.c b/test/fullstep.c @@ -522,11 +522,9 @@ main(int argc, const char **argv) /* Page tracking init needs to happen after kvm * init so main_kvm is set.. */ - /* Reset previous tracking */ ret = ioctl(kvm_dev, KVM_CPC_RESET_TRACKING, NULL); if (ret == -1) err(1, "ioctl RESET_TRACKING"); - /* Do data access stepping */ arg = CPC_TRACK_FULL; ret = ioctl(kvm_dev, KVM_CPC_TRACK_MODE, &arg); if (ret == -1) err(1, "ioctl TRACK_MODE"); @@ -536,10 +534,6 @@ main(int argc, const char **argv) ret = ioctl(kvm_dev, KVM_CPC_TRACK_ALL, &track_mode); if (ret == -1) err(1, "ioctl TRACK_ALL"); - arg = false; - ret = ioctl(kvm_dev, KVM_CPC_SUB_BASELINE, &arg); - if (ret == -1) err(1, "ioctl SUB_BASELINE"); - arg = true; ret = ioctl(kvm_dev, KVM_CPC_MEASURE_BASELINE, &arg); if (ret == -1) err(1, "ioctl MEASURE_BASELINE");