[prev in list] [next in list] [prev in thread] [next in thread]
List: strace
Subject: strace bug patch 4.4.98
From: "Th. Steudten" <steudten () gmx ! ch>
Date: 2003-09-21 11:50:23
[Download RAW message or body]
Hello
OVERVIEW:
strace gives "umovestr: I/O error" same on stderr like the output, if
you donīt use the -o option. First i thought the systemcall failed, but
then i saw, it comes from the strace itself.
In the functions umove(n) and umovestr the ptrace() calls
can fail for some reasons. 2 cases are catched if started is value 1.
This is not the case here. The addr value is zero, so the EIO
errno is returned from ptrace().
FIX:
1. Catch the error of ptrace() in umovestr and umove if addr is NULL.
2. Give more output for perror() to see it comes from the strace programm.
3. OPEN: The started value is 0 if the function is enterd, but the first
catch of ptrace-error tests this value - why??
PATCH:
--- strace-4.4.98/util.c.orig 2003-09-21 12:35:24.000000000 +0200
+++ strace-4.4.98/util.c 2003-09-21 13:20:50.000000000 +0200
@@ -599,7 +599,9 @@
return 0;
}
/* But if not started, we had a bogus address. */
- perror("ptrace: umoven");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
started = 1;
@@ -615,7 +617,11 @@
return 0;
}
if (addr != 0)
- perror("ptrace: umoven");
+ {
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
+ }
return -1;
}
started = 1;
@@ -640,7 +646,9 @@
errno = 0;
u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0);
if (errno) {
- perror("umoven");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven1: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
memcpy(laddr, &u.x[n], m = MIN(sizeof(long) - n, len));
@@ -650,7 +658,9 @@
errno = 0;
u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0);
if (errno) {
- perror("umoven");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven2: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
memcpy(laddr, u.x, m = MIN(sizeof(long), len));
@@ -749,7 +759,9 @@
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- perror("umovestr");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umovestr1: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
started = 1;
@@ -767,7 +779,12 @@
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- perror("umovestr");
+ if (addr != 0)
+ {
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umovestr2: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
+ }
return -1;
}
started = 1;
["strace-4.4.98-perror.patch" (text/plain)]
--- strace-4.4.98/util.c.orig 2003-09-21 12:35:24.000000000 +0200
+++ strace-4.4.98/util.c 2003-09-21 13:20:50.000000000 +0200
@@ -599,7 +599,9 @@
return 0;
}
/* But if not started, we had a bogus address. */
- perror("ptrace: umoven");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
started = 1;
@@ -615,7 +617,11 @@
return 0;
}
if (addr != 0)
- perror("ptrace: umoven");
+ {
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
+ }
return -1;
}
started = 1;
@@ -640,7 +646,9 @@
errno = 0;
u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0);
if (errno) {
- perror("umoven");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven1: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
memcpy(laddr, &u.x[n], m = MIN(sizeof(long) - n, len));
@@ -650,7 +658,9 @@
errno = 0;
u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0);
if (errno) {
- perror("umoven");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umoven2: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
memcpy(laddr, u.x, m = MIN(sizeof(long), len));
@@ -749,7 +759,9 @@
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- perror("umovestr");
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umovestr1: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
return -1;
}
started = 1;
@@ -767,7 +779,12 @@
/* Ran into 'end of memory' - stupid "printpath" */
return 0;
}
- perror("umovestr");
+ if (addr != 0)
+ {
+ char buf[128];
+ snprintf(buf,sizeof(buf),"umovestr2: ptrace(PTRACE_PEEKDATA,%d,%lx,0)",pid,addr);
+ perror(buf);
+ }
return -1;
}
started = 1;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic