Ho tentato di compilare POC per Dirty COW su OSX (< em> Disclaimer: non un programmatore C ). Ecco l'errore:
dirtycow.c: In function ‘procselfmemThread’:
dirtycow.c:64:5: warning: implicit declaration of function ‘lseek’ [-Wimplicit-function-declaration]
lseek(f,map,SEEK_SET);
^~~~~
dirtycow.c:65:8: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
c+=write(f,str,strlen(str));
^~~~~
dirtycow.c: In function ‘main’:
dirtycow.c:82:3: warning: implicit declaration of function ‘fstat’ [-Wimplicit-function-declaration]
fstat(f,&st);
^~~~~
dirtycow.c:95:3: error: invalid use of undefined type ‘struct stat’
map=mmap(NULL,st.st_size,PROT_READ,MAP_PRIVATE,f,0);
^~~
dirtycow.c: At top level:
dirtycow.c:27:13: error: storage size of ‘st’ isn’t known
struct stat st;
Quindi la domanda è: ho la sintassi errata per C su OSX, oppure OSX non è vulnerabile a questo exploit?