liyujie
2025-08-28 786ff4f4ca2374bdd9177f2e24b503d43e7a3b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifdef __cplusplus
extern "C" {
#endif
 
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
 
/*
 * buf: input fuzzing data
 * len: size of the 'buf' data
 *
 * Return value: should return 0
 */
int LLVMFuzzerTestOneInput(const uint8_t* buf, size_t len);
 
/*
 * argc: ptr to main's argc
 * argv: ptr to main's argv
 *
 * Return value: ignored
 */
int LLVMFuzzerInitialize(int* argc, char*** argv);
 
/*
 * Data: data to mutate
 * Size: size of the data to mutate
 * MaxSize: maximum size of the destination buffer
 *
 * Return value: size of the mutated buffer
 */
size_t LLVMFuzzerMutate(uint8_t* Data, size_t Size, size_t MaxSize);
 
/*
 *
 * An alternative for LLVMFuzzerTestOneInput()
 *
 * buf_ptr: will be set to input fuzzing data
 * len_ptr: will be set to the size of the input fuzzing data
 */
void HF_ITER(const uint8_t** buf_ptr, size_t* len_ptr);
void HonggfuzzFetchData(const uint8_t** buf_ptr, size_t* len_ptr);
 
#if defined(__linux__)
 
#include <sched.h>
 
/*
 * Enter Linux namespaces
 *
 * cloneFlags: see 'man unshare'
 */
bool linuxEnterNs(uintptr_t cloneFlags);
/*
 * Bring network interface up
 *
 * ifacename: name of the interface, typically "lo"
 */
bool linuxIfaceUp(const char* ifacename);
/*
 * Mount tmpfs over a mount point
 *
 * dst: mount point for tmfs
 */
bool linuxMountTmpfs(const char* dst);
 
#endif /* defined(__linux__) */
 
#ifdef __cplusplus
} /* extern "C" */
#endif