robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | |
| 3 | honggfuzz - core structures and macros |
| 4 | ----------------------------------------- |
| 5 | |
| 6 | Author: Robert Swiecki <swiecki@google.com> |
| 7 | |
robert.swiecki@gmail.com | ba85c3e | 2015-02-02 14:55:16 +0000 | [diff] [blame] | 8 | Copyright 2010-2015 by Google Inc. All Rights Reserved. |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 9 | |
| 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.com | ba85c3e | 2015-02-02 14:55:16 +0000 | [diff] [blame] | 27 | #include <limits.h> |
robert.swiecki@gmail.com | e507cb6 | 2015-02-11 17:14:49 +0000 | [diff] [blame] | 28 | #include <semaphore.h> |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 29 | #include <stdbool.h> |
| 30 | #include <stdint.h> |
robert.swiecki@gmail.com | ba85c3e | 2015-02-02 14:55:16 +0000 | [diff] [blame] | 31 | #include <sys/param.h> |
| 32 | #include <sys/types.h> |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 33 | |
| 34 | #define PROG_NAME "honggfuzz" |
robert.swiecki@gmail.com | e68a71c | 2015-02-01 16:13:00 +0000 | [diff] [blame] | 35 | #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.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 37 | |
robert.swiecki@gmail.com | a0d8714 | 2015-02-14 13:11:18 +0000 | [diff] [blame^] | 38 | #define _HF_FILE_PLACEHOLDER "___FILE___" |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 39 | |
| 40 | typedef 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.com | 8e2f44a | 2013-03-15 13:54:18 +0000 | [diff] [blame] | 51 | long mutationsMax; |
| 52 | long mutationsCnt; |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 53 | long threadsMax; |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 54 | void *ignoreAddr; |
| 55 | unsigned long asLimit; |
robert.swiecki | 28cba5c | 2011-06-22 01:38:55 +0000 | [diff] [blame] | 56 | int pid; |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 57 | char **files; |
| 58 | int fileCnt; |
robert.swiecki@gmail.com | 9bc725e | 2015-02-13 12:40:06 +0000 | [diff] [blame] | 59 | sem_t *sem; |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 60 | } honggfuzz_t; |
| 61 | |
robert.swiecki@gmail.com | 882900b | 2015-02-11 13:56:22 +0000 | [diff] [blame] | 62 | typedef 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.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 72 | |
robert.swiecki@gmail.com | a0d8714 | 2015-02-14 13:11:18 +0000 | [diff] [blame^] | 73 | #define _HF_MAX_FUNCS 200 |
| 74 | typedef struct { |
| 75 | void *pc; |
| 76 | char func[64]; |
| 77 | } funcs_t; |
| 78 | |
robert.swiecki | 3bb518c | 2010-10-14 00:48:24 +0000 | [diff] [blame] | 79 | #endif |