Bug: Tracing recursive system calls

Nate Eldredge (nate@cartsys.com)
Mon, 07 Jun 1999 16:12:41 -0700


There is a minor bug with system-call tracing. Some system calls call
functions in the kernel which make their own system calls (kernel_thread
is an example). If the process is being traced, these recursive calls
are also traced. This confuses strace, since it (reasonably, IMHO)
expects syscall entrances and exits to happen in strict succession.

You can reproduce the problem by stracing a system call which, for
instance, tries to load a module. i.e. open() of a device whose module
is not loaded.

I don't think user-space debuggers should need to know about the
internals of the kernel, and so there is no reason to keep this.

One possible fix would be to add a test in
arch/i386/kernel/ptrace.c:syscall_trace (and similarly for other arches)
to see if the syscall was made from kernel mode. If so, the parent
should not be notified.

If someone will suggest a good way to detect kernel mode, I can submit a
patch.

I'd appreciate it if replies could be cc'ed to me. Thanks,

-- 

Nate Eldredge nate@cartsys.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/