aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2015-07-17 19:24:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-17 19:39:54 -0400
commit3581d458c39bc5e58ceeeaf51796625bc978d2eb (patch)
tree4a996d189d715782dc31a2c7ad7e12de32b7de77 /fs
parentc9d120b0b2b5069cb2ae62f8eac0cef31c8544be (diff)
/proc/$PID/cmdline: fixup empty ARGV case
/proc/*/cmdline code checks if it should look at ENVP area by checking last byte of ARGV area: rv = access_remote_vm(mm, arg_end - 1, &c, 1, 0); if (rv <= 0) goto out_free_page; If ARGV is somehow made empty (by doing execve(..., NULL, ...) or manually setting ->arg_start and ->arg_end to equal values), the decision will be based on byte which doesn't even belong to ARGV/ENVP. So, quickly check if ARGV area is empty and report 0 to match previous behaviour. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/base.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 87782e874b6a..aa50d1ac28fc 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -243,6 +243,11 @@ static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf,
243 len1 = arg_end - arg_start; 243 len1 = arg_end - arg_start;
244 len2 = env_end - env_start; 244 len2 = env_end - env_start;
245 245
246 /* Empty ARGV. */
247 if (len1 == 0) {
248 rv = 0;
249 goto out_free_page;
250 }
246 /* 251 /*
247 * Inherently racy -- command line shares address space 252 * Inherently racy -- command line shares address space
248 * with code and data. 253 * with code and data.