Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacobsapps/6480deac68d029692dd8ac2575bd27cc to your computer and use it in GitHub Desktop.
Save jacobsapps/6480deac68d029692dd8ac2575bd27cc to your computer and use it in GitHub Desktop.
typedef const struct _libkernel_functions {
/* The following functions are included in version 1 of this structure */
unsigned long version;
void* (*LIBKERNEL_FUNCTION_PTRAUTH(dlsym))(void*, const char*);
void* (*LIBKERNEL_FUNCTION_PTRAUTH(malloc))(size_t);
void(*LIBKERNEL_FUNCTION_PTRAUTH(free))(void*);
void* (*LIBKERNEL_FUNCTION_PTRAUTH(realloc))(void*, size_t);
void(*LIBKERNEL_FUNCTION_PTRAUTH(_pthread_exit_if_canceled))(int);
/* The following functions are included in version 2 of this structure */
void *reserved1;
void *reserved2;
void *reserved3;
void *reserved4;
void *reserved5;
/* The following functions are included in version 3 of this structure */
void(*LIBKERNEL_FUNCTION_PTRAUTH(pthread_clear_qos_tsd))(mach_port_t);
/* The following functions are included in version 4 of this structure */
int(*LIBKERNEL_FUNCTION_PTRAUTH(pthread_current_stack_contains_np))(const void *, size_t);
/* The following functions are included in version 5 of this structure */
void* (*LIBKERNEL_FUNCTION_PTRAUTH(malloc_type_malloc))(size_t, malloc_type_id_t);
void(*LIBKERNEL_FUNCTION_PTRAUTH(malloc_type_free))(void *, malloc_type_id_t);
void* (*LIBKERNEL_FUNCTION_PTRAUTH(malloc_type_realloc))(void *, size_t, malloc_type_id_t);
/* Subsequent versions must only add pointers! */
} *_libkernel_functions_t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment