Re: Interesting race condition...

Roger Luethi
2004-08-04T20:46:22Z

On Wed, 04 Aug 2004 13:03:50 -0700, Robert White wrote:
> Using procps version 2.0.7 the inclusion of "e" in the arguments is
> documented to return environment of the process.

Not the environment of somebody else's process, though. But that is
currently possible in mainline, the problem is not with ps but with
the kernel.

> The question of why the original poster was getting the environment when
> only using "ps ax" is interesting. I'd look for PS_PERSONALITY (etc) in

Basically, if anyone reads /proc/pid/cmdline early enough, when
mm->arg_end is still 0, the kernel will blast out the process environment
through that interface. Thus, you get the data of /proc/pid/environ
without the access restrictions of that file. Not good if you happen
to pass sensitive information using environment variables.

Check out the patch I posted earlier in this thread.

Roger