From c093364f4d911c1d59949b122f2d4c290986fff9 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 1 Jul 2021 22:12:55 +0000 Subject: 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 Reviewed-by: Laurent Vivier Message-Id: <20210701221255.107976-1-oanderso@google.com> Signed-off-by: Laurent Vivier --- linux-user/main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux-user/main.c') 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) { -- cgit v1.2.3