mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 18:48:08 +00:00
code format, llvm 18
This commit is contained in:
@ -24,7 +24,7 @@ import importlib.metadata
|
|||||||
|
|
||||||
# string_re = re.compile('(\\"(\\\\.|[^"\\\\])*\\")') # TODO: for future use
|
# string_re = re.compile('(\\"(\\\\.|[^"\\\\])*\\")') # TODO: for future use
|
||||||
|
|
||||||
CURRENT_LLVM = os.getenv('LLVM_VERSION', 17)
|
CURRENT_LLVM = os.getenv('LLVM_VERSION', 18)
|
||||||
CLANG_FORMAT_BIN = os.getenv("CLANG_FORMAT_BIN", "")
|
CLANG_FORMAT_BIN = os.getenv("CLANG_FORMAT_BIN", "")
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
- new runtime (!) variable: `AFL_OLD_FORKSERVER` to use the old vanilla
|
- new runtime (!) variable: `AFL_OLD_FORKSERVER` to use the old vanilla
|
||||||
AFL type forkserver. Useful for symcc/symqemu/nautilus/etc. with
|
AFL type forkserver. Useful for symcc/symqemu/nautilus/etc. with
|
||||||
AFL_LLVM_INSTRUMENT=CLASSIC
|
AFL_LLVM_INSTRUMENT=CLASSIC
|
||||||
|
- code formatting updated to llvm 18
|
||||||
|
|
||||||
|
|
||||||
### Version ++4.21c (release)
|
### Version ++4.21c (release)
|
||||||
|
@ -456,8 +456,9 @@ typedef struct {
|
|||||||
} __attribute__((__packed__)) t1ha_unaligned_proxy;
|
} __attribute__((__packed__)) t1ha_unaligned_proxy;
|
||||||
|
|
||||||
#define read_unaligned(ptr, bits) \
|
#define read_unaligned(ptr, bits) \
|
||||||
(((const t1ha_unaligned_proxy *)((const uint8_t *)(ptr)-offsetof( \
|
(((const t1ha_unaligned_proxy *)((const uint8_t *)(ptr) - \
|
||||||
t1ha_unaligned_proxy, unaligned_##bits))) \
|
offsetof(t1ha_unaligned_proxy, \
|
||||||
|
unaligned_##bits))) \
|
||||||
->unaligned_##bits)
|
->unaligned_##bits)
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#pragma warning( \
|
#pragma warning( \
|
||||||
@ -478,8 +479,9 @@ typedef struct {
|
|||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
#define read_unaligned(ptr, bits) \
|
#define read_unaligned(ptr, bits) \
|
||||||
(((const t1ha_unaligned_proxy *)((const uint8_t *)(ptr)-offsetof( \
|
(((const t1ha_unaligned_proxy *)((const uint8_t *)(ptr) - \
|
||||||
t1ha_unaligned_proxy, unaligned_##bits))) \
|
offsetof(t1ha_unaligned_proxy, \
|
||||||
|
unaligned_##bits))) \
|
||||||
->unaligned_##bits)
|
->unaligned_##bits)
|
||||||
#endif
|
#endif
|
||||||
#endif /* read_unaligned */
|
#endif /* read_unaligned */
|
||||||
@ -496,21 +498,24 @@ typedef struct {
|
|||||||
#elif __has_attribute(__assume_aligned__)
|
#elif __has_attribute(__assume_aligned__)
|
||||||
|
|
||||||
static __always_inline const uint16_t *__attribute__((
|
static __always_inline const uint16_t *__attribute__((
|
||||||
__assume_aligned__(ALIGNMENT_16))) cast_aligned_16(const void *ptr) {
|
__assume_aligned__(ALIGNMENT_16)))
|
||||||
|
cast_aligned_16(const void *ptr) {
|
||||||
|
|
||||||
return (const uint16_t *)ptr;
|
return (const uint16_t *)ptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline const uint32_t *__attribute__((
|
static __always_inline const uint32_t *__attribute__((
|
||||||
__assume_aligned__(ALIGNMENT_32))) cast_aligned_32(const void *ptr) {
|
__assume_aligned__(ALIGNMENT_32)))
|
||||||
|
cast_aligned_32(const void *ptr) {
|
||||||
|
|
||||||
return (const uint32_t *)ptr;
|
return (const uint32_t *)ptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline const uint64_t *__attribute__((
|
static __always_inline const uint64_t *__attribute__((
|
||||||
__assume_aligned__(ALIGNMENT_64))) cast_aligned_64(const void *ptr) {
|
__assume_aligned__(ALIGNMENT_64)))
|
||||||
|
cast_aligned_64(const void *ptr) {
|
||||||
|
|
||||||
return (const uint64_t *)ptr;
|
return (const uint64_t *)ptr;
|
||||||
|
|
||||||
|
@ -6619,8 +6619,10 @@ static XXH64_hash_t XXH3_mergeAccs(const xxh_u64 *XXH_RESTRICT acc,
|
|||||||
#define XXH3_INIT_ACC \
|
#define XXH3_INIT_ACC \
|
||||||
{ \
|
{ \
|
||||||
\
|
\
|
||||||
XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \
|
\
|
||||||
XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 \
|
XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, \
|
||||||
|
XXH_PRIME64_3, XXH_PRIME64_4, XXH_PRIME32_2, \
|
||||||
|
XXH_PRIME64_5, XXH_PRIME32_1 \
|
||||||
\
|
\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,8 @@ void set_sanitizer_defaults() {
|
|||||||
if (!have_san_options) { strcpy(buf, default_options); }
|
if (!have_san_options) { strcpy(buf, default_options); }
|
||||||
if (have_asan_options) {
|
if (have_asan_options) {
|
||||||
|
|
||||||
if (NULL != strstr(have_asan_options, "detect_leaks=0") || NULL != strstr(have_asan_options, "detect_leaks=false")) {
|
if (NULL != strstr(have_asan_options, "detect_leaks=0") ||
|
||||||
|
NULL != strstr(have_asan_options, "detect_leaks=false")) {
|
||||||
|
|
||||||
strcat(buf, "exitcode=" STRINGIFY(LSAN_ERROR) ":fast_unwind_on_malloc=0:print_suppressions=0:detect_leaks=0:malloc_context_size=0:");
|
strcat(buf, "exitcode=" STRINGIFY(LSAN_ERROR) ":fast_unwind_on_malloc=0:print_suppressions=0:detect_leaks=0:malloc_context_size=0:");
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ void afl_fsrv_init_dup(afl_forkserver_t *fsrv_to, afl_forkserver_t *from) {
|
|||||||
Returns the time passed to read.
|
Returns the time passed to read.
|
||||||
If the wait times out, returns timeout_ms + 1;
|
If the wait times out, returns timeout_ms + 1;
|
||||||
Returns 0 if an error occurred (fd closed, signal, ...); */
|
Returns 0 if an error occurred (fd closed, signal, ...); */
|
||||||
static u32 __attribute__((hot))
|
static u32 __attribute__((hot)) read_s32_timed(s32 fd, s32 *buf, u32 timeout_ms,
|
||||||
read_s32_timed(s32 fd, s32 *buf, u32 timeout_ms, volatile u8 *stop_soon_p) {
|
volatile u8 *stop_soon_p) {
|
||||||
|
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
@ -1450,7 +1450,8 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// The binary is most likely instrumented using AFL's tool, and we will set map_size to MAP_SIZE.
|
// The binary is most likely instrumented using AFL's tool, and we will
|
||||||
|
// set map_size to MAP_SIZE.
|
||||||
fsrv->real_map_size = fsrv->map_size = MAP_SIZE;
|
fsrv->real_map_size = fsrv->map_size = MAP_SIZE;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1704,8 +1705,8 @@ u32 afl_fsrv_get_mapsize(afl_forkserver_t *fsrv, char **argv,
|
|||||||
|
|
||||||
/* Delete the current testcase and write the buf to the testcase file */
|
/* Delete the current testcase and write the buf to the testcase file */
|
||||||
|
|
||||||
void __attribute__((hot))
|
void __attribute__((hot)) afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv,
|
||||||
afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
|
u8 *buf, size_t len) {
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (unlikely(fsrv->nyx_mode)) {
|
if (unlikely(fsrv->nyx_mode)) {
|
||||||
@ -1823,9 +1824,8 @@ afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
|
|||||||
/* Execute target application, monitoring for timeouts. Return status
|
/* Execute target application, monitoring for timeouts. Return status
|
||||||
information. The called program will update afl->fsrv->trace_bits. */
|
information. The called program will update afl->fsrv->trace_bits. */
|
||||||
|
|
||||||
fsrv_run_result_t __attribute__((hot))
|
fsrv_run_result_t __attribute__((hot)) afl_fsrv_run_target(
|
||||||
afl_fsrv_run_target(afl_forkserver_t *fsrv, u32 timeout,
|
afl_forkserver_t *fsrv, u32 timeout, volatile u8 *stop_soon_p) {
|
||||||
volatile u8 *stop_soon_p) {
|
|
||||||
|
|
||||||
s32 res;
|
s32 res;
|
||||||
u32 exec_ms;
|
u32 exec_ms;
|
||||||
|
@ -456,8 +456,8 @@ void write_crash_readme(afl_state_t *afl) {
|
|||||||
save or queue the input test case for further analysis if so. Returns 1 if
|
save or queue the input test case for further analysis if so. Returns 1 if
|
||||||
entry is saved, 0 otherwise. */
|
entry is saved, 0 otherwise. */
|
||||||
|
|
||||||
u8 __attribute__((hot))
|
u8 __attribute__((hot)) save_if_interesting(afl_state_t *afl, void *mem,
|
||||||
save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
|
u32 len, u8 fault) {
|
||||||
|
|
||||||
if (unlikely(len == 0)) { return 0; }
|
if (unlikely(len == 0)) { return 0; }
|
||||||
|
|
||||||
|
@ -41,8 +41,9 @@ u64 time_spent_working = 0;
|
|||||||
/* Execute target application, monitoring for timeouts. Return status
|
/* Execute target application, monitoring for timeouts. Return status
|
||||||
information. The called program will update afl->fsrv->trace_bits. */
|
information. The called program will update afl->fsrv->trace_bits. */
|
||||||
|
|
||||||
fsrv_run_result_t __attribute__((hot))
|
fsrv_run_result_t __attribute__((hot)) fuzz_run_target(afl_state_t *afl,
|
||||||
fuzz_run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
|
afl_forkserver_t *fsrv,
|
||||||
|
u32 timeout) {
|
||||||
|
|
||||||
#ifdef PROFILING
|
#ifdef PROFILING
|
||||||
static u64 time_spent_start = 0;
|
static u64 time_spent_start = 0;
|
||||||
@ -111,8 +112,8 @@ fuzz_run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
|
|||||||
old file is unlinked and a new one is created. Otherwise, afl->fsrv.out_fd is
|
old file is unlinked and a new one is created. Otherwise, afl->fsrv.out_fd is
|
||||||
rewound and truncated. */
|
rewound and truncated. */
|
||||||
|
|
||||||
u32 __attribute__((hot))
|
u32 __attribute__((hot)) write_to_testcase(afl_state_t *afl, void **mem,
|
||||||
write_to_testcase(afl_state_t *afl, void **mem, u32 len, u32 fix) {
|
u32 len, u32 fix) {
|
||||||
|
|
||||||
u8 sent = 0;
|
u8 sent = 0;
|
||||||
|
|
||||||
@ -1173,8 +1174,8 @@ abort_trimming:
|
|||||||
error conditions, returning 1 if it's time to bail out. This is
|
error conditions, returning 1 if it's time to bail out. This is
|
||||||
a helper function for fuzz_one(). */
|
a helper function for fuzz_one(). */
|
||||||
|
|
||||||
u8 __attribute__((hot))
|
u8 __attribute__((hot)) common_fuzz_stuff(afl_state_t *afl, u8 *out_buf,
|
||||||
common_fuzz_stuff(afl_state_t *afl, u8 *out_buf, u32 len) {
|
u32 len) {
|
||||||
|
|
||||||
u8 fault;
|
u8 fault;
|
||||||
|
|
||||||
|
@ -2237,6 +2237,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
snprintf(fn, PATH_MAX, "%s/fastresume.bin", afl->out_dir);
|
snprintf(fn, PATH_MAX, "%s/fastresume.bin", afl->out_dir);
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
if ((fr_fd = ZLIBOPEN(fn, "rb")) != NULL) {
|
if ((fr_fd = ZLIBOPEN(fn, "rb")) != NULL) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if ((fr_fd = open(fn, O_RDONLY)) >= 0) {
|
if ((fr_fd = open(fn, O_RDONLY)) >= 0) {
|
||||||
|
|
||||||
@ -3340,9 +3341,11 @@ stop_fuzzing:
|
|||||||
ACTF("Writing %s ...", fr);
|
ACTF("Writing %s ...", fr);
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
if ((fr_fd = ZLIBOPEN(fr, "wb9")) != NULL) {
|
if ((fr_fd = ZLIBOPEN(fr, "wb9")) != NULL) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if ((fr_fd = open(fr, O_WRONLY | O_TRUNC | O_CREAT, DEFAULT_PERMISSION)) >=
|
if ((fr_fd = open(fr, O_WRONLY | O_TRUNC | O_CREAT, DEFAULT_PERMISSION)) >=
|
||||||
0) {
|
0) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u8 ver_string[8];
|
u8 ver_string[8];
|
||||||
|
Reference in New Issue
Block a user