But since parents environment variables are copied into childs address
space, I was expecting do_fork to copy some environment related field
too of task_struct.
What fork()->do_fork() does it duplicates address space of a process.
Means the environment variable are inhereited from shell (global) and
never travels to kernel space.
Also If I am not wrong this behaviour is also
governed by whether you have passed CLONE_VM flag to do_fork or not.
So there must be something which checks this flag and does the copy.
What i know is CLONE_VM flag is set on vfork() call only.
It does not determine executing process environment
vairable behaviour.
Thanks