Skip to content

Commit

Permalink
Fix Exit Ordering (#166)
Browse files Browse the repository at this point in the history
* change exit status ordering

* comments
  • Loading branch information
rennergade committed May 8, 2024
1 parent fc9d61f commit 2843925
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/trusted/service_runtime/nacl_syscall_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,20 +406,20 @@ int32_t NaClSysExit(struct NaClAppThread *natp, int status) {
NaClExitThreadGroup(natp);
}

#ifdef TRACING
long long starttime = gettimens();
#endif
#ifdef TRACING
long long starttime = gettimens();
#endif

lind_exit(status, nap->cage_id);
NaClLog(1, "Exit syscall handler: %d\n", status);
(void)NaClReportExitStatus(nap, NACL_ABI_W_EXITCODE(status, 0)); // need to report here first so we add exited process as a zombie for wait
lind_exit(status, nap->cage_id); // before lind_exit sends SIGCHLD

#ifdef TRACING
long long endtime = gettimens();
long long totaltime = endtime - starttime;
NaClStraceExit(nap->cage_id, status, totaltime);
#endif

NaClLog(1, "Exit syscall handler: %d\n", status);
(void)NaClReportExitStatus(nap, NACL_ABI_W_EXITCODE(status, 0));
NaClAppThreadTeardown(natp);

/* NOTREACHED */
Expand Down

0 comments on commit 2843925

Please sign in to comment.