Re: [PATCH 07/10] ptrace: make group stop state visible viaPTRACE_GETSIGINFO
From: Oleg Nesterov
Date: Thu May 19 2011 - 12:29:36 EST
On 05/16, Tejun Heo wrote:
>
> static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info)
> {
> + struct signal_struct *sig;
> unsigned long flags;
> int error;
>
> if (!lock_task_sighand(child, &flags))
> return -ESRCH;
> + sig = child->signal;
>
> error = -EINVAL;
> if (!child->last_siginfo)
> @@ -585,6 +587,23 @@ static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info)
>
> error = 0;
> *info = *child->last_siginfo;
> +
> + /*
> + * If reporting ptrace trap for a seized tracee, enable reporting
> + * of info->si_pt_flags.
> + */
> + if ((child->ptrace & PT_SEIZED) &&
> + (info->si_code & __SI_MASK) == __SI_TRAP) {
> + /*
> + * Report whether group stop is in effect w/ SI_STOPPED and
> + * if so which signal caused it.
> + */
> + if (sig->group_stop_count || sig->flags & SIGNAL_STOP_STOPPED) {
Cosmetic nit, you could declare "struct signal_struct *sig" here, under
if (PT_SEIZED && __SI_TRAP).
I must admit, personally I still dislike this new PTRACE_GETSIGINFO API...
But I can't suggest anything better, so I am not going to argue.
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/