On Fri, Apr 23, 2010 at 11:06:17AM +0200, casper....@sun.com wrote:
> 
> >> There is only one way when the kernel knows and can
> >> inspect the 
> >> environment: during evecve.
> >
> >Alright. Appears to be simply placing ptrs on the userstack, as an array,
> >using the stk_putptr() method (based on sulword store).  I can try to do that
> >in reverse.
> 
> Correct.  (It first copies the environment vector so a the time of
> execve there is a point where the kernel has all the environment strings)
> 
> >
> >> After execve, the process is at liberty to change the
> >> memory where the 
> >> environment was copied.
> >
> >So it _can_ be somewhere else? _Will_ be somewhere else?  Since 'u_envp'
> is not-NULL, I would assume it still points to something valid, since the
> >user process 'probably' would not go 'that low' in the stack during normal
> >situations?
> 
> Valid, but not necessarily pointing to your environment.
> 
> >
> >Since /proc (as "ps") can pull out the environment from processes, I would
> >assume it exists somewhere, and I can get at it.
> 
> It may be wrong too; I believe it uses the same pointer.

It looks up _environ, and uses that if it is found.  pr_envp is only used
if the lookup fails.

Cheers,
- jonathan

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to