iOS 8.1上使用vm_allocate分配内存失败

rt,我尝试在iOS 8.1上运行这样一段代码来分配一段内存:

vm_address_t addr= 0;
vm_address_t buf;
vm_size_t read_size, bufsiz = 0xc00;

kret = vm_allocate(mach_task_self(), &buf, bufsiz, VM_PROT_READ | VM_PROT_WRITE);
if (kret != KERN_SUCCESS) {
	printf("vm_allocate failed : %x\n", kret);
	return 0;
}

用gcc编译之后,然后嵌入entitlement(get-task-allow, task_for_pid-allow, run-unsigned-code),程序运行到vm_allocate这里就挂掉了,没能找到任何的错误提示。

有人有类似的经验嘛?