File size: 487 Bytes
eb12c8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#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");
}