From b7cdbd6c429ca6598f8ace8abebf139a8f81eb5a Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Wed, 24 Jan 2018 08:57:20 +0900 Subject: [PATCH] uti: Enforce mcexec is destroyed and then McKernel process is destroyed --- executer/user/mcexec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 26744714..149f9b24 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -3572,7 +3572,11 @@ int main_loop(struct thread_data_s *my_thread) sig = 0; term = 0; - do_syscall_return(fd, cpu, 0, 0, 0, 0, 0); + /* Enforce the order in which mcexec is destroyed and then + McKernel process is destroyed to prevent + migrated-to-Linux thread from accessing stale memory values. + It is done by not calling do_syscall_return(fd, cpu, 0, 0, 0, 0, 0); + here and making McKernel side wait until release_handler() is called. */ /* Drop executable file */ if ((ret = ioctl(fd, MCEXEC_UP_CLOSE_EXEC)) != 0) {