summary refs log tree commit diff stats
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorOwen Anderson <oanderso@google.com>2021-07-01 22:12:55 +0000
committerLaurent Vivier <laurent@vivier.eu>2021-07-12 21:54:46 +0200
commitc093364f4d911c1d59949b122f2d4c290986fff9 (patch)
tree2f936418ccc6218017e4623641241eb7809fa97c /linux-user/main.c
parent4f6a9f84f1d29b61e3ebd3bfd774d9fd5afe60c6 (diff)
downloadfocaccia-qemu-c093364f4d911c1d59949b122f2d4c290986fff9.tar.gz
focaccia-qemu-c093364f4d911c1d59949b122f2d4c290986fff9.zip
fd-trans: Fix race condition on reallocation of the translation table.
The mapping from file-descriptors to translator functions is not guarded
on realloc which may cause invalid function pointers to be read from a
previously deallocated mapping.

Signed-off-by: Owen Anderson <oanderso@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210701221255.107976-1-oanderso@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 2fb3a366a6..37ed50d98e 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -48,6 +48,7 @@
 #include "target_elf.h"
 #include "cpu_loop-common.h"
 #include "crypto/init.h"
+#include "fd-trans.h"
 
 #ifndef AT_FLAGS_PRESERVE_ARGV0
 #define AT_FLAGS_PRESERVE_ARGV0_BIT 0
@@ -829,6 +830,8 @@ int main(int argc, char **argv, char **envp)
     cpu->opaque = ts;
     task_settid(ts);
 
+    fd_trans_init();
+
     ret = loader_exec(execfd, exec_path, target_argv, target_environ, regs,
         info, &bprm);
     if (ret != 0) {