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 8b1535789509812763de132f877b596d01861714
parent 2305b5cbd8d75f8e01a1298f9490d2270d740d1d
Author: Louis Burda <quent.burda@gmail.com>
Date:   Tue,  4 Oct 2022 14:54:52 +0200

Small test fixes

Diffstat:
Mtest/access.c | 4++--
Mtest/eviction.c | 6++++--
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/test/access.c b/test/access.c @@ -1,5 +1,6 @@ #include "cachepc_user.h" +#include <sys/ioctl.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> @@ -7,14 +8,13 @@ #include <err.h> #include <fcntl.h> #include <unistd.h> -#include <stropts.h> int main(int argc, const char **argv) { uint32_t arg; - size_t i, len; int fd, ret; + size_t i; fd = open("/proc/cachepc", O_RDONLY); if (fd < 0) err(1, "open"); diff --git a/test/eviction.c b/test/eviction.c @@ -18,15 +18,17 @@ main(int argc, const char **argv) int fd, ret; fd = open("/proc/cachepc", O_RDONLY); + if (fd < 0) err(1, "open"); arg = 48; if (argc == 2) arg = atoi(argv[1]); ret = ioctl(fd, CACHEPC_IOCTL_TEST_EVICTION, &arg); - if (ret == -1) err(1, "ioctl fail"); + if (ret == -1) err(1, "ioctl"); len = read(fd, counts, sizeof(counts)); - assert(len == sizeof(counts)); + if (len != sizeof(counts)) + errx(1, "invalid count read"); for (i = 0; i < 64; i++) { if (i % 16 == 0 && i)