Q: ptrace_signal() && PTRACE_SETSIGINFO (Was: SIGSTOP && ptrace)

From: Oleg Nesterov
Date: Thu Apr 23 2009 - 11:20:33 EST


ptrace_signal:

signr = current->exit_code;

/* Update the siginfo structure if the signal has
changed. If the debugger wanted something
specific in the siginfo structure then it should
have updated *info via PTRACE_SETSIGINFO. */

Yes. PTRACE_SETSIGINFO can change *info if debugger wants something
special. But then we do:

if (signr != info->si_signo) {
info->si_signo = signr;
info->si_errno = 0;
info->si_code = SI_USER;
info->si_pid = task_pid_vnr(current->parent);
info->si_uid = task_uid(current->parent);
}

Why? If the tracer changes ->exit_code it should know what it does.
Why do we reset *info?

But the real question, how can PTRACE_SETSIGINFO change ->si_signo
(for example, for do_signal_stop(si_signo)) if this in fact is not
allowed?

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/