Changes in fork ?

Brian Gerst bgerst en quark.vpplus.com
Sab Ene 22 18:50:07 CST 2000


Sergey Kubushin wrote:
> 
> Hi, everybody!
> 
> I have a question about fork() (?) behaviour. The problem shows itself as
> truncated lines in ps output on processes that are forked outta daemons
> which use setproctitle() (from sendmail sources) such as sendmail, inetd
> etc. All's fine on 2.2.xx kernels, but I have the following under 2.3.xx :

This is a result of how /proc/pid/cmdline was changed some time back,
and it was actually somewhat of a bug that it actually worked before. 
In the task struct there are pointers called arg_start and arg_end. 
These point to the strings on the user space stack which represent the
argv[] array.  The old code would return memory up to the first null
after arg_end, while the new simply truncates it at arg_end.  Therefore,
this limits what setproctitle() can display to the size of the strings
on the original command line.

I have a patch in the works which will address this issue.  Instead of
reading the strings directly from user space, it will read the pointers
to the strings.  Thus, instead of doing strcpy(argv[0], newtitle) like
setproctitle() currently does, you can do argv[0] = newtitle.  The only
caveat is the increased number of accesses to another process' memory.

--

				Brian Gerst

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



Más información sobre la lista de distribución Ayuda