Re: [PATCH] Fix argument checking in sched_setaffinity

From: Andi Kleen
Date: Mon Sep 06 2004 - 08:19:00 EST


On Sat, Sep 04, 2004 at 05:18:30PM -0700, Linus Torvalds wrote:
>
>
> On Sat, 4 Sep 2004, Paul Jackson wrote:
> >
> > How is what Linus left more broken?
>
> It's not. If anything, we should probably remove even more.
>
> I don't see what the problem was with just requiring the right damn size.
> User mode can trivially get the size by asking for it. But if it can't be

I don't think writing a syscall loop is a good idea for this.
The main reason is that when you get an EINVAL for some other
reason you will still blow up your memory until you
hit some arbitary upper size.

Currently this EINVAL is the only instance in this syscall,
but this may change in some future version.

A sysctl may have worked, but it results in a lot of code
bloat in the application to handle it.

> bothered, then Andi's code certainly just made things worse.

I disagree on that. It was not perfect, but with minor fixes
could have been a proper solution. Your current code is even worse than
what was there before my patch.

Alternative would be the sysctl and strict check again. I don't
like it too much because it makes the application more complicated
(i prefer simple interfaces, because complex interfaces tend to
have more bugs)

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