Skip to content

Commit 7d77cbd

Browse files
Merge pull request #2496 from AFLplusplus/dev
push to stable
2 parents 11a5e37 + 0ca5300 commit 7d77cbd

File tree

9 files changed

+29
-35
lines changed

9 files changed

+29
-35
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Release version: [4.33c](https://github.com/AFLplusplus/AFLplusplus/releases)
66

7-
GitHub version: 4.33c
7+
GitHub version: 4.34a
88

99
Repository:
1010
[https://github.com/AFLplusplus/AFLplusplus](https://github.com/AFLplusplus/AFLplusplus)

docs/Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
release of the tool. See README.md for the general instruction manual.
55

66

7+
### Version ++4.34a (dev)
8+
- afl-showmap
9+
- fix -C parameter breakage introduced in v4.33c
10+
- qemu_mode:
11+
- fix compilation for a few platforms
12+
13+
714
### Version ++4.33c (release)
815
- afl-fuzz:
916
- Use `AFL_PRELOAD_DISCRIMINATE_FORKSERVER_PARENT` if you use AFL_PRELOAD

include/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/* Version string: */
2727

2828
// c = release, a = volatile github dev, e = experimental branch
29-
#define VERSION "++4.33c"
29+
#define VERSION "++4.34a"
3030

3131
/******************************************************
3232
* *

qemu_mode/QEMUAFL_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8c7f180c5a
1+
a93b2934c5

qemu_mode/qemuafl

src/afl-forkserver.c

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
#include <signal.h>
4747
#include <fcntl.h>
4848
#include <limits.h>
49+
#include <poll.h>
4950
#include <sys/time.h>
5051
#include <sys/wait.h>
5152
#include <sys/resource.h>
52-
#include <sys/select.h>
5353
#include <sys/stat.h>
5454
#include <grp.h>
5555

@@ -400,31 +400,28 @@ void afl_fsrv_setup_preload(afl_forkserver_t *fsrv, char *argv0) {
400400

401401
}
402402

403-
/* Wrapper for select() and read(), reading a 32 bit var.
403+
/* Wrapper for poll() and read(), reading a 32 bit var.
404404
Returns the time passed to read.
405405
If the wait times out, returns timeout_ms + 1;
406406
Returns 0 if an error occurred (fd closed, signal, ...); */
407407
static u32 __attribute__((hot)) read_s32_timed(s32 fd, s32 *buf, u32 timeout_ms,
408408
volatile u8 *stop_soon_p) {
409409

410-
fd_set readfds;
411-
FD_ZERO(&readfds);
412-
FD_SET(fd, &readfds);
413-
struct timeval timeout;
414-
int sret;
415-
ssize_t len_read;
410+
int pret;
411+
ssize_t len_read;
412+
struct pollfd fds[1];
413+
int nfds = 1;
416414

417-
timeout.tv_sec = (timeout_ms / 1000);
418-
timeout.tv_usec = (timeout_ms % 1000) * 1000;
419-
#if !defined(__linux__)
420415
u32 read_start = get_cur_time_us();
421-
#endif
422416

423-
/* set exceptfds as well to return when a child exited/closed the pipe. */
424-
restart_select:
425-
sret = select(fd + 1, &readfds, NULL, NULL, &timeout);
417+
memset(&fds, 0, sizeof(fds));
418+
fds[0].fd = fd;
419+
fds[0].events = POLLIN;
426420

427-
if (likely(sret > 0)) {
421+
/* set exceptfds as well to return when a child exited/closed the pipe. */
422+
restart_poll:
423+
pret = poll(fds, nfds, timeout_ms);
424+
if (likely(pret > 0)) {
428425

429426
restart_read:
430427
if (*stop_soon_p) {
@@ -438,13 +435,7 @@ static u32 __attribute__((hot)) read_s32_timed(s32 fd, s32 *buf, u32 timeout_ms,
438435

439436
if (likely(len_read == 4)) { // for speed we put this first
440437

441-
#if defined(__linux__)
442-
u32 exec_ms = MIN(
443-
timeout_ms,
444-
((u64)timeout_ms - (timeout.tv_sec * 1000 + timeout.tv_usec / 1000)));
445-
#else
446438
u32 exec_ms = MIN(timeout_ms, (get_cur_time_us() - read_start) / 1000);
447-
#endif
448439

449440
// ensure to report 1 ms has passed (0 is an error)
450441
return exec_ms > 0 ? exec_ms : 1;
@@ -459,14 +450,14 @@ static u32 __attribute__((hot)) read_s32_timed(s32 fd, s32 *buf, u32 timeout_ms,
459450

460451
}
461452

462-
} else if (unlikely(!sret)) {
453+
} else if (unlikely(!pret)) {
463454

464455
*buf = -1;
465456
return timeout_ms + 1;
466457

467-
} else if (unlikely(sret < 0)) {
458+
} else if (unlikely(pret < 0)) {
468459

469-
if (likely(errno == EINTR)) goto restart_select;
460+
if (likely(errno == EINTR)) goto restart_poll;
470461

471462
*buf = -1;
472463
return 0;

src/afl-fuzz-cmplog.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
2525
*/
2626

27-
#include <sys/select.h>
28-
2927
#include "afl-fuzz.h"
3028
#include "cmplog.h"
3129

src/afl-fuzz-sanfuzz.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
/* This file roughly follows afl-fuzz-asanfuzz */
2828

29-
#include <sys/select.h>
30-
3129
#include "afl-fuzz.h"
3230

3331
void sanfuzz_exec_child(afl_forkserver_t *fsrv, char **argv) {

src/afl-showmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ int main(int argc, char **argv_orig, char **envp) {
16131613

16141614
// only reinitialize when it makes sense
16151615
if (map_size < new_map_size ||
1616-
(new_map_size < map_size && map_size - new_map_size > MAP_SIZE)) {
1616+
(new_map_size > map_size && new_map_size - map_size >= MAP_SIZE)) {
16171617

16181618
if (!be_quiet)
16191619
ACTF("Acquired new map size for target: %u bytes\n", new_map_size);
@@ -1719,7 +1719,7 @@ int main(int argc, char **argv_orig, char **envp) {
17191719
} else {
17201720

17211721
if ((coverage_map = (u8 *)malloc(map_size + 64)) == NULL)
1722-
FATAL("could not grab memory");
1722+
FATAL("could not allocate memory");
17231723
edges_only = false;
17241724

17251725
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy