native-capability-library / layerfault_fixture.c
izm1chael's picture
Publish Layerfault synthetic corpus LF-CORPUS-NATIVE-0001
eb12c8e verified
Raw
History Blame Contribute Delete
487 Bytes
#include <dlfcn.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <unistd.h>
/*
* Inert security fixture: capabilities are present in the import table.
* The function is never called by the generator or validation harness.
*/
int layerfault_capability_fixture(void) {
void *h = dlopen("libc.so.6", RTLD_LAZY);
if (h) dlclose(h);
int fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd >= 0) close(fd);
return system("/bin/echo LAYERFAULT_CANARY >/dev/null");
}