From 4905c8e638d93320b94c02f3392dac828f47d198 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Wed, 3 Feb 2021 10:25:16 +0900 Subject: [PATCH] mcexec: propagate error in __NR_gettid handler Change-Id: I0e0f06199970fe839065567dcd5418d017b6ec00 --- executer/user/mcexec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 338d0039..65da7d6e 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -4123,6 +4123,7 @@ int main_loop(struct thread_data_s *my_thread) #endif case __NR_gettid:{ + int rc = 0; /* * Number of TIDs and the remote physical address where TIDs are * expected are passed in arg 4 and 5, respectively. @@ -4134,6 +4135,7 @@ int main_loop(struct thread_data_s *my_thread) int *tids = malloc(sizeof(int) * w.sr.args[4]); if (!tids) { fprintf(stderr, "__NR_gettid(): error allocating TIDs\n"); + rc = -ENOMEM; goto gettid_out; } @@ -4154,13 +4156,14 @@ int main_loop(struct thread_data_s *my_thread) trans.direction = MCEXEC_UP_TRANSFER_TO_REMOTE; if (ioctl(fd, MCEXEC_UP_TRANSFER, &trans) != 0) { + rc = -EFAULT; fprintf(stderr, "__NR_gettid(): error transfering TIDs\n"); } free(tids); } gettid_out: - do_syscall_return(fd, cpu, 0, 0, 0, 0, 0); + do_syscall_return(fd, cpu, rc, 0, 0, 0, 0); break; }