A problem of umoven and umovestr in util.c
Cai Fei
caifei at cn.fujitsu.com
Tue Jul 17 02:52:40 UTC 2007
Hi,
I used strace to trace the following program test_accept.c:
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char *argv[])
{
accept(0, (struct sockaddr *)1, (socklen_t *)1);
return 1;
}
$ strace ./test_accept
......
accept(0, 0x1, ptrace: umoven: Input/output error
0x1) = -1 ENOTSOCK (Socket operation on non-socket)
......
If the third param of accept() is invalid, the message "ptrace: umoven:
Input/output error" will outputted. I think users will be confused to
see the message. Users may be more confused even with -o option.
$ strace -o log ./test_accept
ptrace: umoven: Input/output error
Also, the same problem exists in umovestr(). I found it with the following
program test_access.c:
#include <unistd.h>
int main(int argc, char *argv[])
{
access((char *)1, R_OK);
return 1;
}
$ strace ./test_access
......
access(umovestr: Input/output error
0x1, R_OK) = -1 EFAULT (Bad address)
......
I think it will be better if the error messages are not outputted.
If it is right, here is the patch:
Signed-off-by: "Cai Fei" <caifei at cn.fujitsu.com>
--- util.c 2007-07-16 09:21:47.000000000 +0800
+++ util.c.new 2007-07-16 09:23:08.000000000 +0800
@@ -690,7 +690,6 @@ char *laddr;
return 0;
}
/* But if not started, we had a bogus address. */
- perror("ptrace: umoven");
return -1;
}
started = 1;
@@ -705,8 +704,6 @@ char *laddr;
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- if (addr != 0)
- perror("ptrace: umoven");
return -1;
}
started = 1;
@@ -840,7 +837,6 @@ char *laddr;
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- perror("umovestr");
return -1;
}
started = 1;
@@ -858,7 +854,6 @@ char *laddr;
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- perror("umovestr");
return -1;
}
started = 1;
Regards
More information about the Strace-devel
mailing list