-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi,
I am trying to detect a memory corruption using this library. I wrote a little test program to try and test it but my callback doesn't get called. what am I missing?
#include "hwbp_lib.h"
#include <stdio.h>
#include <stdbool.h>
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
static void
handle_suspect_write(int dummy)
{
printf("gotcha!!!\n");
}
int main(int arc, char** argv)
{
uint64_t *dummy = malloc(sizeof(uint64_t));
*dummy = 0;
pid_t tid = syscall(__NR_gettid);
bool bp_written = install_breakpoint(dummy, 0, HW_BREAKPOINT_WRITE_ACCESS, tid, handle_suspect_write);
if (!bp_written)
{
printf("failed to install breakpoint\n");
return -1;
}
*dummy = 1;
usleep(1000000);
free(dummy);
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels