[PATCH] Fix umove/umoven return value
Ben Noordhuis
info at bnoordhuis.nl
Tue Feb 26 01:46:17 UTC 2013
umoven() uses process_vm_readv() when available but it returns the
return value of that syscall, which is the number of bytes copied,
while its callers expect it to simply return zero on success.
It was causing syscalls that take a user-space argument to print
the abbreviated version, e.g.:
epoll_ctl(5, EPOLL_CTL_ADD, 10, {...})
Instead of:
epoll_ctl(5, EPOLL_CTL_ADD, 10, {EPOLLIN, {u32=10, u64=10}})
* util.c (umoven): Fix return value.
Signed-off-by: Ben Noordhuis <info at bnoordhuis.nl>
---
util.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/util.c b/util.c
index 405670e..af73f09 100644
--- a/util.c
+++ b/util.c
@@ -800,6 +800,8 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)
remote, 1,
/*flags:*/ 0
);
+ if (r == len)
+ return 0;
if (r < 0) {
if (errno == ENOSYS)
process_vm_readv_not_supported = 1;
@@ -807,11 +809,8 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)
/* EINVAL or ESRCH could be seen if process is gone,
* all the rest is strange and should be reported. */
perror_msg("%s", "process_vm_readv");
- goto vm_readv_didnt_work;
}
- return r;
}
- vm_readv_didnt_work:
started = 0;
if (addr & (sizeof(long) - 1)) {
--
1.7.9.5
More information about the Strace-devel
mailing list