Q: PTRACE_ATTACH && -EINTR

From: Oleg Nesterov
Date: Mon Jun 08 2009 - 12:16:37 EST


I just realized that ->cred_exec_mutex added a user-visible change
which may confuse user-space.

ptrace_attach:

retval = mutex_lock_interruptible(&task->cred_exec_mutex);
if (retval < 0)
goto out;

This doesn't look good, we return -EINTR. Suppose that strace tries to
attach to all sub-threads and ptrace(PTRACE_ATTACH) returns -EINTR just
because the already traced thread sends SIGCHLD. Or tracer's sub-thread
does recalc_sigpending_and_wake().

I think we should at least do

retval = -ERESTARTSYS;
if (mutex_lock_interruptible(&task->cred_exec_mutex))
goto out;

Or even -ERESTARTNOINTR ? Or just mutex_lock() ?

Or ignore this problem since nobody complained?

Oleg.

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