[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 23/38] linux-user: Use safe_syscall for read and w
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL v2 23/38] linux-user: Use safe_syscall for read and write system calls |
Date: |
Fri, 27 May 2016 16:00:14 +0300 |
From: Timothy E Baldwin <address@hidden>
Restart read() and write() if signals occur before, or during with SA_RESTART
Signed-off-by: Timothy Edward Baldwin <address@hidden>
Message-id: address@hidden
[PMM: Update to new safe_syscall() convention of setting errno]
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b6a8ed6..bee1360 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -707,6 +707,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;
@@ -5983,7 +5986,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 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);
@@ -5994,7 +5997,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 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
--
2.1.4
- [Qemu-devel] [PULL v2 05/38] linux-user: Renumber TARGET_QEMU_ESIGRETURN, make it not arch-specific, (continued)
- [Qemu-devel] [PULL v2 05/38] linux-user: Renumber TARGET_QEMU_ESIGRETURN, make it not arch-specific, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 10/38] linux-user: Support for restarting system calls for SPARC targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 16/38] linux-user: Support for restarting system calls for S390 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 11/38] linux-user: Support for restarting system calls for SH4 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 14/38] linux-user: Support for restarting system calls for OpenRISC targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 13/38] linux-user: Support for restarting system calls for UniCore32 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 15/38] linux-user: Support for restarting system calls for M68K targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 12/38] linux-user: Support for restarting system calls for Alpha targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 17/38] linux-user: Support for restarting system calls for CRIS targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 18/38] linux-user: Support for restarting system calls for tilegx targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 23/38] linux-user: Use safe_syscall for read and write system calls,
riku . voipio <=
- [Qemu-devel] [PULL v2 20/38] linux-user: Support for restarting system calls for Microblaze targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise restarting system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 19/38] linux-user: Set r14 on exit from microblaze syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 22/38] linux-user: Provide safe_syscall for fixing races between signals and syscalls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 24/38] linux-user: Use safe_syscall for open and openat system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 25/38] linux-user: Use safe_syscall for wait system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 29/38] linux-user: Handle negative values in timespec conversion, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 26/38] linux-user: Use safe_syscall for execve syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 27/38] linux-user: Use safe_syscall for pselect, select syscalls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 28/38] linux-user: Use safe_syscall for futex syscall, riku . voipio, 2016/05/27