linux/fs/proc
Linus Torvalds 5ab8271899 fs/proc: simplify and clarify get_mm_cmdline() function
We have some very odd semantics for reading the command line through
/proc, because we allow people to rewrite their own command line pretty
much at will, and things get positively funky when you extend your
command line past the point that used to be the end of the command line,
and is now in the environment variable area.

But our weird semantics doesn't mean that we should write weird and
complex code to handle them.

So re-write get_mm_cmdline() to be much simpler, and much more explicit
about what it is actually doing and why.  And avoid the extra check for
"is there a NUL character at the end of the command line where I expect
one to be", by simply making the NUL character handling be part of the
normal "once you hit the end of the command line, stop at the first NUL
character" logic.

It's quite possible that we should stop the crazy "walk into
environment" entirely, but happily it's not really the usual case.

NOTE! We tried to really simplify and limit our odd cmdline parsing some
time ago, but people complained.  See commit c2c0bb4462 ("proc: fix
PAGE_SIZE limit of /proc/$PID/cmdline") for details about why we have
this complexity.

Cc: Tejun Heo <tj@kernel.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-05-17 15:35:02 -07:00
..
array.c proc: replace seq_printf by seq_put_smth to speed up /proc/pid/status 2018-04-11 10:28:33 -07:00
base.c fs/proc: simplify and clarify get_mm_cmdline() function 2018-05-17 15:35:02 -07:00
cmdline.c proc: faster /proc/cmdline 2018-04-11 10:28:34 -07:00
consoles.c fs/proc/consoles.c: use seq_putc() in show_console_dev() 2018-02-06 18:32:44 -08:00
cpuinfo.c x86 / CPU: Always show current CPU frequency in /proc/cpuinfo 2017-11-15 19:46:50 +01:00
devices.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fd.c proc: use %u for pid printing and slightly less stack 2018-02-06 18:32:43 -08:00
fd.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
generic.c proc: revalidate misc dentries 2018-04-13 17:10:27 -07:00
inode.c proc: move "struct proc_dir_entry" into kmem cache 2018-04-11 10:28:34 -07:00
internal.h proc: use slower rb_first() 2018-04-11 10:28:34 -07:00
interrupts.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig fs, proc: add help for CONFIG_PROC_CHILDREN 2015-07-17 16:39:52 -07:00
kcore.c proc/kcore: don't bounds check against address 0 2018-05-11 17:28:45 -07:00
kmsg.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
loadavg.c proc: fix /proc/loadavg regression 2018-04-20 17:18:36 -07:00
Makefile proc: : uninline name_to_int() 2017-11-17 16:10:00 -08:00
meminfo.c proc: add seq_put_decimal_ull_width to speed up /proc/pid/smaps 2018-04-11 10:28:33 -07:00
namespaces.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nommu.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
page.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
proc_net.c proc: use slower rb_first() 2018-04-11 10:28:34 -07:00
proc_sysctl.c fs/proc/proc_sysctl.c: fix typo in sysctl_check_table_array() 2018-04-11 10:28:38 -07:00
proc_tty.c TTY/Serial patches for 4.15-rc1 2017-11-13 21:05:31 -08:00
root.c proc: use slower rb_first() 2018-04-11 10:28:34 -07:00
self.c fs/proc: use __ro_after_init 2018-02-06 18:32:43 -08:00
softirqs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stat.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
task_mmu.c mm, pagemap: fix swap offset value for PMD migration entry 2018-04-20 17:18:35 -07:00
task_nommu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
thread_self.c fs/proc: use __ro_after_init 2018-02-06 18:32:43 -08:00
uptime.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
util.c proc: use do-while in name_to_int() 2017-11-17 16:10:00 -08:00
version.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmcore.c fs/proc/vmcore.c: simpler /proc/vmcore cleanup 2018-02-06 18:32:43 -08:00