[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/34] linux-user: Use safe_syscall for read and wri
From: |
Timothy E Baldwin |
Subject: |
[Qemu-devel] [PATCH 14/34] linux-user: Use safe_syscall for read and write system calls |
Date: |
Sun, 6 Sep 2015 00:57:08 +0100 |
Restart read() and write() if signals occur before, or during with SA_RESTART
Signed-off-by: Timothy Edward Baldwin <address@hidden>
---
linux-user/syscall.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b9ad7b6..c213588 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -706,6 +706,10 @@ static type safe_##name (type1 arg1, type2 arg2, type3
arg3, type4 arg4, \
#endif
+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;
@@ -5747,14 +5751,14 @@ 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 = safe_read(arg1, p, arg3);
unlock_user(p, arg2, ret);
}
break;
case TARGET_NR_write:
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
goto efault;
- ret = get_errno(write(arg1, p, arg3));
+ ret = safe_write(arg1, p, arg3);
unlock_user(p, arg2, 0);
break;
case TARGET_NR_open:
--
2.1.4
- Re: [Qemu-devel] [PATCH 19/34] linux-user: Restart fork() if signals pending, (continued)
- [Qemu-devel] [PATCH 15/34] linux-user: Remove redundant get_errno() calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 17/34] linux-user: Use safe_syscall for wait system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 21/34] linux-user: Remove redundant gdb_queuesig(), Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 07/34] linux-user: Support for restarting system calls for PPC targets, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 14/34] linux-user: Use safe_syscall for read and write system calls,
Timothy E Baldwin <=
- [Qemu-devel] [PATCH 16/34] linux-user: Use safe_syscall for open and openat system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 08/34] linux-user: Support for restarting system calls for SPARC targets, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 20/34] linux-user: Remove redundant default action check in queue_signal(), Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 26/34] linux-user: Restart kill() if signal pending, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 25/34] linux-user: Restart exit() if signal pending, Timothy E Baldwin, 2015/09/05