Skip to content

Commit d69f33f

Browse files
Merge pull request #27 from kotee4ko/master
Prevent target from unexpected closing TSL_FD
2 parents 002e473 + c069d3d commit d69f33f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

accel/tcg/cpu-exec.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@
5858
* VARIOUS AUXILIARY STUFF *
5959
***************************/
6060

61-
/* We use one additional file descriptor to relay "needs translation"
62-
messages between the child and the fork server. */
63-
64-
#define TSL_FD (FORKSRV_FD - 1)
65-
6661
/* This is equivalent to afl-as.h: */
6762

6863
static unsigned char

linux-user/syscall.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8381,6 +8381,8 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
83818381
return ret;
83828382
#endif
83838383
case TARGET_NR_close:
8384+
if (unlikely(arg1 == TSL_FD))
8385+
return 0x00;
83848386
fd_trans_unregister(arg1);
83858387
return get_errno(close(arg1));
83868388

qemuafl/common.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@
3737
#include "imported/config.h"
3838
#include "imported/types.h"
3939
#include "imported/cmplog.h"
40-
4140
#include "api.h"
4241

42+
/* We use one additional file descriptor to relay "needs translation"
43+
messages between the child and the fork server. */
44+
45+
#define TSL_FD (FORKSRV_FD - 1)
46+
4347
#define AFL_G2H g2h_untagged
4448

4549
#if defined(TARGET_X86_64)

0 commit comments

Comments
 (0)