]> git.hungrycats.org Git - linux/commit
[PATCH] /proc/PID/cmdline truncates arguments early
authorOlaf Kirch <okir@suse.de>
Tue, 24 Aug 2004 04:42:57 +0000 (21:42 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 24 Aug 2004 04:42:57 +0000 (21:42 -0700)
commitf1a77e519e855566d291e0aa41558b50f66928f2
tree6da611bc073bba1007a237c480de5b5260d2c640
parent41202280dbec2bbb2661c8fcac87728435c082ef
[PATCH] /proc/PID/cmdline truncates arguments early

We received a bug report that /proc/PID/cmdline only shows argv[0] if the
total length of all arguments exceeds PAGE_SIZE.  The problem is that
proc_pid_cmdline checks for the presence of a NUL byte at the end of the
args list, and assumes that the application did a setproctitle if there's
any other character.

OTOH proc_pid_cmdline will read just the first PAGE_SIZE worth of arguments
at most, and if you have more arguments, it's quite likely that there won't
be a NUL byte at offset PAGE_SIZE-1.

The attached patch fixes this.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/proc/base.c