This isn't a kernel problem, it's a problem with "procps". In stat.c
the function parse_stat() reads the command name in with the line:
sscanf(S, "%d %40c", &P->pid, P->cmd);
The "c" format specification does not include the terminating 0x00.
I preceded this line with:
which will give the correct zero-termination.
While we're on the subject of /proc, I've run into a problem with
recent (1.3.29, 1.3.30) kernels and the /proc/self/fd. The /proc/self/fd/*
entries exist, but any attempt to do I/O on them will give an error,
"file not found". The only older kernel I have is 1.2.10, which doesn't
have this problem.