1 #include "libbpf.h" 2 libbpf_print_fn(enum libbpf_print_level level,const char * format,va_list args)3static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va_list args) 4 { 5 return 0; 6 } 7 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)8int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 9 struct bpf_object *obj = NULL; 10 DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts); 11 int err; 12 13 libbpf_set_print(libbpf_print_fn); 14 15 opts.object_name = "fuzz-object"; 16 obj = bpf_object__open_mem(data, size, &opts); 17 err = libbpf_get_error(obj); 18 if (err) 19 return 0; 20 21 bpf_object__close(obj); 22 return 0; 23 } 24