logo       

Re: RFC: linux backdoor prevention: msg#00055

Subject: Re: RFC: linux backdoor prevention
On Monday 10 November 2003 15:39, Matthew Wilcox wrote:
> On Mon, Nov 10, 2003 at 02:46:37PM +0100, Duncan Sands wrote:
> > > > The first step would to create a tools that find statemenst like
> > > > if ( (A=b)<0 ). I have played with a grep pipeline and found only
> > > > a few lines of code. perhaps somebody can make a tool that will show
> > > > automaticly such kind of code.
> >
> > What is wrong with "if ( (A=b)< 0)"?  Did you find any incorrect uses of
> > this kind of construct in the kernel?  By the way, this is just a
> > specific example of a more common situation: statements with side
> > effects.
>
> It's doing two things in one statement.  That's not conducive to readable
> code.  Look:
>
>       A = b;
>       if (A < 0)
>
> can be read faster than
>
>       if ((A = b) < 0)

Readability is in the eye of the beholder.  For example, often this kind of 
construction:

        if ( (A = result_of_some_call) < 0)
                barf;

amounts to:

try {
        A = result_of_some_call;
} catch (badness: A < 0) { barf; }

(sorry, I forget what the C++/java or
whatever syntax is - I hope you get
the idea).

Personally my brain parses that just fine.  Now it may be that statements with
side-effects are to be avoided (in fact I agree with that in most cases), but
in this case people seem to be talking about instituting a heavy policy with
little benefit.  In fact, the reason I piped up in the first place was that 
IMHIO (I = instant),
people are talking about doing the massive job of going through the kernel,
changing all these constructions, pissing off all the people who liked
it the way it was, continuously monitoring to check that no new examples
go in etc, in short something completely impractical.  Wouldn't it be
much saner to (for example), change uid to an opaque type that can
only be accessed through helper functions (set_uid, get_uid etc), so
evil changes stick out like a sore thumb?

Duncan.


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/


<Prev in Thread] Current Thread [Next in Thread>