Re: [RFC 12/12][PATCH] SCHED_DEADLINE: modified sched_*_ex API

From: Raistlin
Date: Wed Jan 13 2010 - 05:33:17 EST


On Tue, 2009-12-29 at 13:15 +0100, Peter Zijlstra wrote:
> > if (!param_ex || pid < 0)
> > return -EINVAL;
> > + if (len < sizeof(struct sched_param_ex))
> > + return -EINVAL;
> >
> > read_lock(&tasklist_lock);
> > p = find_process_by_pid(pid);
> > @@ -6837,7 +6844,7 @@ SYSCALL_DEFINE2(sched_getparam_ex, pid_t, pid,
> > /*
> > * This one might sleep, we cannot do it with a spinlock held ...
> > */
> > - retval = copy_to_user(param_ex, &lp, sizeof(*param_ex)) ? -EFAULT : 0;
> > + retval = copy_to_user(param_ex, &lp, len) ? -EFAULT : 0;
> >
> > return retval;
> >
>
> I think this doesn't even do what it claims to do, namely provide a
> flexible ABI, since you fail the operation when there is not enough room
> provided. Hence, when we grow the struct an older program that was
> compiled against the smaller one will become an insta-fail.
>
> What this should do is deal with smaller structs by ensuring the tail is
> 0 and simply copying out the head.
>
Yep... As said in the previous mail I wanted to do so, and I'll do it
now that I see how odd was what I wrote! :-P

> New bits in the flags field are also an interesting challenge.
>
Right... I think that a (partial?) solution could be to properly choose
default values for newcomer flags, could that be right?

Thanks and regards,
Dario

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)

http://blog.linux.it/raistlin / raistlin@xxxxxxxxx /
dario.faggioli@xxxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part