cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

check_sigalrm.c (355B)


      1#include <stdio.h>
      2#include <stdlib.h>
      3#include <signal.h>
      4#include <unistd.h>
      5
      6#define MAGIC (0xdeadbeef)
      7
      8int s = 0;
      9void sighandler(int sig)
     10{
     11	s = MAGIC;
     12}
     13
     14int main(int argc, char **argv)
     15{
     16	int p;
     17
     18	p = getpid();
     19	signal(SIGALRM, sighandler);
     20	kill(p, SIGALRM);
     21	if (s != MAGIC)
     22		return EXIT_FAILURE;
     23
     24	printf ("passed\n");
     25	return EXIT_SUCCESS;
     26}