blob: 72933737cdbcda8632e63224b127ab7d971a3797 [file] [log] [blame]
robert.swiecki3bb518c2010-10-14 00:48:24 +00001/*
2
3 honggfuzz - core structures and macros
4 -----------------------------------------
5
6 Author: Robert Swiecki <swiecki@google.com>
7
robert.swiecki@gmail.comba85c3e2015-02-02 14:55:16 +00008 Copyright 2010-2015 by Google Inc. All Rights Reserved.
robert.swiecki3bb518c2010-10-14 00:48:24 +00009
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22*/
23
24#ifndef _COMMON_H_
25#define _COMMON_H_
26
robert.swiecki@gmail.comba85c3e2015-02-02 14:55:16 +000027#include <limits.h>
robert.swiecki@gmail.come507cb62015-02-11 17:14:49 +000028#include <semaphore.h>
robert.swiecki3bb518c2010-10-14 00:48:24 +000029#include <stdbool.h>
30#include <stdint.h>
robert.swiecki@gmail.comba85c3e2015-02-02 14:55:16 +000031#include <sys/param.h>
32#include <sys/types.h>
robert.swiecki3bb518c2010-10-14 00:48:24 +000033
34#define PROG_NAME "honggfuzz"
robert.swiecki@gmail.come68a71c2015-02-01 16:13:00 +000035#define PROG_VERSION "0.4"
36#define PROG_AUTHORS "Robert Swiecki <swiecki@google.com> and others, Copyright 2010-2015 by Google Inc. All Rights Reserved."
robert.swiecki3bb518c2010-10-14 00:48:24 +000037
robert.swiecki@gmail.coma0d87142015-02-14 13:11:18 +000038#define _HF_FILE_PLACEHOLDER "___FILE___"
robert.swiecki3bb518c2010-10-14 00:48:24 +000039
40typedef struct {
41 char **cmdline;
42 char *inputFile;
43 bool nullifyStdio;
44 bool fuzzStdin;
45 bool saveUnique;
46 char *fileExtn;
47 double flipRate;
48 char flipMode;
49 char *externalCommand;
50 long tmOut;
groebert@google.com8e2f44a2013-03-15 13:54:18 +000051 long mutationsMax;
52 long mutationsCnt;
robert.swiecki3bb518c2010-10-14 00:48:24 +000053 long threadsMax;
robert.swiecki3bb518c2010-10-14 00:48:24 +000054 void *ignoreAddr;
55 unsigned long asLimit;
robert.swiecki28cba5c2011-06-22 01:38:55 +000056 int pid;
robert.swiecki3bb518c2010-10-14 00:48:24 +000057 char **files;
58 int fileCnt;
robert.swiecki@gmail.com9bc725e2015-02-13 12:40:06 +000059 sem_t *sem;
robert.swiecki3bb518c2010-10-14 00:48:24 +000060} honggfuzz_t;
61
robert.swiecki@gmail.com882900b2015-02-11 13:56:22 +000062typedef struct fuzzer_t {
63 pid_t pid;
64 time_t timeStarted;
65 char origFileName[PATH_MAX];
66 char fileName[PATH_MAX];
67 uint64_t pc;
68 uint64_t backtrace;
69 uint64_t access;
70 int exception;
71} fuzzer_t;
robert.swiecki3bb518c2010-10-14 00:48:24 +000072
robert.swiecki@gmail.coma0d87142015-02-14 13:11:18 +000073#define _HF_MAX_FUNCS 200
74typedef struct {
75 void *pc;
76 char func[64];
77} funcs_t;
78
robert.swiecki3bb518c2010-10-14 00:48:24 +000079#endif