Re: [PATCH 1/5] Split wait_noreap_copyout()

From: Vitaly Mayatskikh
Date: Thu May 21 2009 - 10:36:07 EST


At Thu, 21 May 2009 16:12:50 +0200, Oleg Nesterov wrote:

> Roland thinks that "-EFAULT -> success" change is acceptable, and I think
> the same. So, to me the best option is just change the changelog of this
> patch and that is all.
>
> Or. We can make a trivial patch which adds the behavior change first:
>
> Changelog: always accept the NULL infop, because it is not
> possible to understand the current behaviour ;)
>
> User-visible change! needs Acks!
>
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1126,24 +1126,26 @@ static int eligible_child(struct wait_op
> static int wait_noreap_copyout(struct wait_opts *wo, struct task_struct *p,
> pid_t pid, uid_t uid, int why, int status)
> {
> - struct siginfo __user *infop;
> int retval = wo->wo_rusage
> ? getrusage(p, RUSAGE_BOTH, wo->wo_rusage) : 0;
> -
> put_task_struct(p);
> - infop = wo->wo_info;
> - if (!retval)
> - retval = put_user(SIGCHLD, &infop->si_signo);
> - if (!retval)
> - retval = put_user(0, &infop->si_errno);
> - if (!retval)
> - retval = put_user((short)why, &infop->si_code);
> - if (!retval)
> - retval = put_user(pid, &infop->si_pid);
> - if (!retval)
> - retval = put_user(uid, &infop->si_uid);
> - if (!retval)
> - retval = put_user(status, &infop->si_status);
> +
> + if (wo->wo_info) {
> + struct siginfo __user *infop = wo->wo_info;
> +
> + if (!retval)
> + retval = put_user(SIGCHLD, &infop->si_signo);
> + if (!retval)
> + retval = put_user(0, &infop->si_errno);
> + if (!retval)
> + retval = put_user((short)why, &infop->si_code);
> + if (!retval)
> + retval = put_user(pid, &infop->si_pid);
> + if (!retval)
> + retval = put_user(uid, &infop->si_uid);
> + if (!retval)
> + retval = put_user(status, &infop->si_status);
> + }
> if (!retval)
> retval = pid;
> return retval;
>
> And then redo Vitaly's patches on top of this change.
>
> What do you and Vitaly think?

I like your idea.

--
wbr, Vitaly
--
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/