brintos

brintos / llvm-project-archived public Read only

0
0
Text · 390 B · b4818de Raw
22 lines · c
1#include <signal.h>2#include <stdint.h>3#include <unistd.h>4 5void sigbus_handler(int signo) { _exit(47); }6 7int target_function() { return 47; }8 9int main() {10  signal(SIGBUS, sigbus_handler);11 12  // Generate a SIGBUS by deliverately calling through an unaligned function13  // pointer.14  union {15    int (*t)();16    uintptr_t p;17  } u;18  u.t = target_function;19  u.p |= 1;20  return u.t();21}22