Revert "MONOTONIC"

This reverts commit 0c9b460cc4.
This commit is contained in:
vanhauser-thc
2024-06-13 09:18:44 +02:00
parent c134df30db
commit e7da8b9d6b
2 changed files with 12 additions and 47 deletions

View File

@ -4,10 +4,6 @@
release of the tool. See README.md for the general instruction manual. release of the tool. See README.md for the general instruction manual.
### Version ++4.22a (dev) ### Version ++4.22a (dev)
- afl-fuzz:
- the reason for the regression in 4.20c has been found, COARSE timing
is measuring too broad for our purpose, MONOTONIC is fine and better
than gettimeofday() so switching to this
- frida_mode: - frida_mode:
- AFL_FRIDA_PERSISTENT_ADDR can now be be any reachable address not just - AFL_FRIDA_PERSISTENT_ADDR can now be be any reachable address not just
a function entry a function entry

View File

@ -59,43 +59,6 @@ u8 last_intr = 0;
#define AFL_PATH "/usr/local/lib/afl/" #define AFL_PATH "/usr/local/lib/afl/"
#endif #endif
/* Convert seconds to milliseconds. */
#define SEC_TO_MS(sec) ((sec) * 1000)
/* Convert seconds to microseconds. */
#define SEC_TO_US(sec) ((sec) * 1000000)
/* Convert nanoseconds to milliseconds. */
#define NS_TO_MS(ns) ((ns) / 1000000)
/* Convert nanoseconds to microseconds. */
#define NS_TO_US(ns) ((ns) / 1000)
/* Convert seconds to milliseconds. */
#define SEC_TO_MS(sec) ((sec) * 1000)
/* Convert seconds to microseconds. */
#define SEC_TO_US(sec) ((sec) * 1000000)
/* Convert nanoseconds to milliseconds. */
#define NS_TO_MS(ns) ((ns) / 1000000)
/* Convert nanoseconds to microseconds. */
#define NS_TO_US(ns) ((ns) / 1000)
/* Convert nanoseconds to microseconds. */
#define US_TO_MS(us) ((us) / 1000)
/* Convert seconds to milliseconds. */
#define SEC_TO_MS(sec) ((sec) * 1000)
/* Convert seconds to microseconds. */
#define SEC_TO_US(sec) ((sec) * 1000000)
/* Convert nanoseconds to milliseconds. */
#define NS_TO_MS(ns) ((ns) / 1000000)
/* Convert nanoseconds to microseconds. */
#define NS_TO_US(ns) ((ns) / 1000)
/* Convert seconds to milliseconds. */
#define SEC_TO_MS(sec) ((sec) * 1000)
/* Convert seconds to microseconds. */
#define SEC_TO_US(sec) ((sec) * 1000000)
/* Convert nanoseconds to milliseconds. */
#define NS_TO_MS(ns) ((ns) / 1000000)
/* Convert nanoseconds to microseconds. */
#define NS_TO_US(ns) ((ns) / 1000)
/* Convert nanoseconds to microseconds. */
#define US_TO_MS(us) ((us) / 1000)
void *afl_memmem(const void *haystack, size_t haystacklen, const void *needle, void *afl_memmem(const void *haystack, size_t haystacklen, const void *needle,
size_t needlelen) { size_t needlelen) {
@ -1013,9 +976,12 @@ void read_bitmap(u8 *fname, u8 *map, size_t len) {
inline u64 get_cur_time(void) { inline u64 get_cur_time(void) {
struct timespec ts; struct timeval tv;
(void)clock_gettime(CLOCK_MONOTONIC, &ts); struct timezone tz;
return (u64)(SEC_TO_MS((uint64_t)ts.tv_sec) + NS_TO_MS((uint64_t)ts.tv_nsec));
gettimeofday(&tv, &tz);
return (tv.tv_sec * 1000ULL) + (tv.tv_usec / 1000);
} }
@ -1023,9 +989,12 @@ inline u64 get_cur_time(void) {
inline u64 get_cur_time_us(void) { inline u64 get_cur_time_us(void) {
struct timespec ts; struct timeval tv;
(void)clock_gettime(CLOCK_MONOTONIC, &ts); struct timezone tz;
return (u64)(SEC_TO_US((uint64_t)ts.tv_sec) + NS_TO_US((uint64_t)ts.tv_nsec));
gettimeofday(&tv, &tz);
return (tv.tv_sec * 1000000ULL) + tv.tv_usec;
} }