Re: Command-line anomoly V2.3.35

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Jan 05 2000 - 13:42:10 EST


On Wed, 5 Jan 2000, Brian Gerst wrote:

> "Richard B. Johnson" wrote:
> >
> > Many programs have counted on being able to overwrite command-line
> > arguments so that other information shows in `ps`. Linux Version 2.3.35
> > now prevents that from working. Is this a new <security feature> or
> > is it related to the kernel command-line bug already reported?
>
> Looks like a race condition to me... the child could be scheduled before
> the parent and run before argv[0] is changed. Move the strcpy to before
> the fork and that should fix it.

Well even if it fixed it, it could not work in most applications.
Here is a typical application (like inetd).

        parent { Command line has whatever }
        fd = accept();
        switch(fork())
        {
        case 0: // Child
             getpeername();
             ***** Put client IP-Address on command line *****
             do_stuff();
             exit();
        case -1: //bad
        default:
               //parent Command line not changed
        }

   So, the forked children from the server all have the client's IP
   address so `ps` shows who is connected. This technique has worked
   for years. Now, I don't know if you are "supposed" to do this
   kind of thing, but that's how it's been done, and now it's broken.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.35 on an i686 machine (400.59 BogoMips).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:04 EST