This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: systemtap to trace source of syscall error?


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())
	}

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]