summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>2016-05-12 18:47:47 +0100
committerhyokeun <hyokeun.jeon@samsung.com>2016-07-27 19:37:38 +0900
commit64a9551924e9f35916a468259a662ca9b867570f (patch)
tree2d14f151cad16ff96d580dd0977e030d62fa8bae
parentbf68b94166e16073286431db3a7e3b6c60c644e8 (diff)
downloadqemu-64a9551924e9f35916a468259a662ca9b867570f.tar.gz
qemu-64a9551924e9f35916a468259a662ca9b867570f.tar.bz2
qemu-64a9551924e9f35916a468259a662ca9b867570f.zip
linux-user: Use safe_syscall for read and write system calls
Restart read() and write() if signals occur before, or during with SA_RESTART Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk> Message-id: 1441497448-32489-15-git-send-email-T.E.Baldwin99@members.leeds.ac.uk [PMM: Update to new safe_syscall() convention of setting errno] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
-rw-r--r--linux-user/syscall.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 59404d9cc..6eeba0f4e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -699,6 +699,9 @@ static type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
return safe_syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6); \
}
+safe_syscall3(ssize_t, read, int, fd, void *, buff, size_t, count)
+safe_syscall3(ssize_t, write, int, fd, const void *, buff, size_t, count)
+
static inline int host_to_target_sock_type(int host_type)
{
int target_type;
@@ -6006,7 +6009,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
else {
if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
goto efault;
- ret = get_errno(read(arg1, p, arg3));
+ ret = get_errno(safe_read(arg1, p, arg3));
if (ret >= 0 &&
fd_trans_host_to_target_data(arg1)) {
ret = fd_trans_host_to_target_data(arg1)(p, ret);
@@ -6017,7 +6020,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
case TARGET_NR_write:
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
goto efault;
- ret = get_errno(write(arg1, p, arg3));
+ ret = get_errno(safe_write(arg1, p, arg3));
unlock_user(p, arg2, 0);
break;
#ifdef TARGET_NR_open