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 24d7c448e49e3dc2abbf3bc804247fb30410775a
parent 647ced3c3389a01515aea1e391830fd8e7134931
Author: Louis Burda <quent.burda@gmail.com>
Date:   Tue,  6 Sep 2022 13:04:50 +0200

Fix kvm-amd module

Diffstat:
MMakefile | 2+-
Mkmod/kvm.c | 16+++++++---------
Mpatch.diff | 2+-
3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile @@ -3,7 +3,7 @@ PWD := $(shell pwd) .PHONY: all reset clean prepare build -all: reset clean prepare build test/eviction test/access test/kvm test/sev +all: reset clean prepare build test/eviction test/access test/kvm test/sev test/sev-es clean: $(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=arch/x86/kvm clean diff --git a/kmod/kvm.c b/kmod/kvm.c @@ -270,7 +270,7 @@ cachepc_kvm_ioctl(struct file *file, unsigned int cmd, unsigned long argp) { void __user *arg_user; uint32_t u32; - int r; + int ret; arg_user = (void __user *)argp; switch (cmd) { @@ -279,9 +279,9 @@ cachepc_kvm_ioctl(struct file *file, unsigned int cmd, unsigned long argp) if (!arg_user) return -EINVAL; if (copy_from_user(&u32, arg_user, sizeof(uint32_t))) return -EFAULT; - r = smp_call_function_single(2, + ret = smp_call_function_single(2, cachepc_kvm_single_access_test, &u32, true); - WARN_ON(r != 0); + WARN_ON(ret != 0); if (copy_to_user(arg_user, &u32, sizeof(uint32_t))) return -EFAULT; break; @@ -290,9 +290,9 @@ cachepc_kvm_ioctl(struct file *file, unsigned int cmd, unsigned long argp) if (!arg_user) return -EINVAL; if (copy_from_user(&u32, arg_user, sizeof(uint32_t))) return -EFAULT; - r = smp_call_function_single(2, + ret = smp_call_function_single(2, cachepc_kvm_single_eviction_test, &u32, true); - WARN_ON(r != 0); + WARN_ON(ret != 0); if (copy_to_user(arg_user, &u32, sizeof(uint32_t))) return -EFAULT; break; @@ -301,9 +301,9 @@ cachepc_kvm_ioctl(struct file *file, unsigned int cmd, unsigned long argp) if (!arg_user) return -EINVAL; if (copy_from_user(&u32, arg_user, sizeof(uint32_t))) return -EFAULT; - r = smp_call_function_single(2, + ret = smp_call_function_single(2, cachepc_kvm_init_pmc_ioctl, &u32, true); - WARN_ON(r != 0); + WARN_ON(ret != 0); break; default: return -EINVAL; @@ -364,5 +364,3 @@ cachepc_kvm_exit(void) cachepc_release_ds(cachepc_ctx, cachepc_ds); cachepc_release_ctx(cachepc_ctx); } - - diff --git a/patch.diff b/patch.diff @@ -27,7 +27,7 @@ index b804444e16d4..66a4d56e331a 100644 vmx/evmcs.o vmx/nested.o vmx/posted_intr.o -kvm-amd-y += svm/svm.o svm/vmenter.o svm/pmu.o svm/nested.o svm/avic.o svm/sev.o +kvm-amd-y += svm/svm.o svm/vmenter.o svm/pmu.o svm/nested.o svm/avic.o svm/sev.o \ -+ svm/cachepc/cachepc.o svm/cachepc/util.o svm/cachepc/kvm.o ++ svm/cachepc/cachepc.o svm/cachepc/util.o obj-$(CONFIG_KVM) += kvm.o obj-$(CONFIG_KVM_INTEL) += kvm-intel.o