systemtap to trace source of syscall error?
Adrien Kunysz
adrien@kunysz.be
Sun Dec 19 18:31:00 GMT 2010
On Sun, Dec 19, 2010 at 06:08:36PM +0000, Richard W.M. Jones wrote:
> Can systemtap be used to find the source (ie. file/line in the kernel)
> where an error is "raised"? I have a system call (utimensat) which
> returns -EINVAL, but I have no idea where the error comes from.
I don't think there is really a generic way to do that with SystemTap.
Actually, looking at the utimensat case specifically, it appears
EINVAL is the default error code:
129 long do_utimes(int dfd, const char __user *filename, struct timespec *times,
130 int flags)
131 {
132 int error = -EINVAL;
133
134 if (times && (!nsec_valid(times[0].tv_nsec) ||
135 !nsec_valid(times[1].tv_nsec))) {
136 goto out;
137 }
138
139 if (flags & ~AT_SYMLINK_NOFOLLOW)
140 goto out;
141
142 if (filename == NULL && dfd != AT_FDCWD) {
[...]
If you have a reliable reproducer, I would suggest divide and
conquering with something like this:
global testnr = 1
probe kernel.function("do_utimes@*.c:139"),
kernel.function("do_utimes@*.c:142"),
[add more checkpoints here as you dig deeper]
{
printf("passed test %d, now at %s\n", testnr++, pp())
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/systemtap/attachments/20101219/f14f70af/attachment.sig>
More information about the Systemtap
mailing list