Re: patch to fix set_itimer() behaviour in boundary cases

From: Arjan van de Ven
Date: Sat Jan 15 2005 - 05:01:10 EST


On Sat, 2005-01-15 at 01:36 -0800, William Lee Irwin III wrote:
> Matthias Lang <matthias@xxxxxxxxxxxx> wrote:
> >> The linux implementation of setitimer() doesn't behave quite as
> >> expected. I found several problems:
> >> 1. POSIX says that negative times should cause setitimer() to
> >> return -1 and set errno to EINVAL. In linux, the call succeeds.
> >> 2. POSIX says that time values with usec >= 1000000 should
> >> cause the same behaviour. In linux, the call succeeds.
> >> 3. If large time values are given, linux quietly truncates them
> >> to the maximum time representable in jiffies. On 2.4.4 on PPC,
> >> that's about 248 days. On 2.6.10 on x86, that's about 24 days.
> >> POSIX doesn't really say what to do in this case, but looking at
> >> established practice, i.e. "what BSD does", since the call comes
> >> from BSD, *BSD returns -1 if the time is out of range.
>
> On Sat, Jan 15, 2005 at 01:30:13AM -0800, Andrew Morton wrote:
> > These are things we probably cannot change now. All three are arguably
> > sensible behaviour and do satisfy the principle of least surprise. So
> > there may be apps out there which will break if we "fix" these things.
> > If the kernel version was 2.7.0 then well maybe...
>
> We can easily do a "rolling upgrade" by adding new versions of the
> system calls, giving glibc and apps grace periods to adjust to them,
> and nuking the old versions in a few years.

but for 1: do we care? it is being more tolerant than allowed by a
standard. Those who care can easily add the test in the userspace
wrapper

for 2: we again are more tolerant and dtrt; again. And again userspace
wrapper can impose an additional restriction if it wants

3 is more nasty and needs thinking; we could consider a fix inside the
kernel that actually does wait long enough


I don't see a valid reason to restrict/reject input that is accepted now
and dealt with reasonably because some standard says so (if you design a
new api, following the standard is nice of course). I don't see "doesn't
reject a condition that can reasonable be dealt with" as a good reason
to go double ABI at all.


-
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/