brintos

brintos / llvm-project-archived public Read only

0
0
Text · 557 B · a5c6a5e Raw
29 lines · cpp
1// RUN: %clangxx %s -o %t && %run %t %p2 3#include <assert.h>4#include <errno.h>5#include <unistd.h>6#include <sys/procctl.h>7 8int main() {9  struct procctl_reaper_status status = {0};10  int res, aslr;11  res = procctl(P_PID, getpid(), PROC_REAP_STATUS, &status);12  if (res < 0) {13    assert(errno == EPERM);14    return 0;15  }16 17  assert(status.rs_flags >= REAPER_STATUS_OWNED);18 19  res = procctl(P_PID, getpid(), PROC_ASLR_STATUS, &aslr);20  if (res < 0) {21    assert(errno == EPERM);22    return 0;23  }24 25  assert(aslr >= PROC_ASLR_FORCE_ENABLE);26 27  return 0;28}29