mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	gorcunov@openvz.org, jarod@redhat.com
Subject: Re: [PATCH 2/2] proc: fix PAGE_SIZE limit of /proc/$PID/cmdline
Date: Thu, 28 May 2015 07:57:11 -0400 (EDT)	[thread overview]
Message-ID: <532622376.6805756.1432814231660.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20150527214953.GB12863@p183.telecom.by>





----- Original Message -----
> From: "Alexey Dobriyan" <adobriyan@gmail.com>
> To: akpm@linux-foundation.org
> Cc: linux-kernel@vger.kernel.org, gorcunov@openvz.org, jarod@redhat.com, jstancek@redhat.com
> Sent: Wednesday, 27 May, 2015 11:49:53 PM
> Subject: [PATCH 2/2] proc: fix PAGE_SIZE limit of /proc/$PID/cmdline
> 
> /proc/$PID/cmdline truncates output at PAGE_SIZE. It is easy to see with
> 
> 	$ cat /proc/self/cmdline $(seq 1037) 2>/dev/null
> 
> However, command line size was never limited to PAGE_SIZE but to 128 KB and
> relatively recently limitation was removed altogether.
> 
> People noticed and ask questions:
> http://stackoverflow.com/questions/199130/how-do-i-increase-the-proc-pid-cmdline-4096-byte-limit
> 
> seq file interface is not OK, because it kmalloc's for whole output and
> open + read(, 1) + sleep will pin arbitrary amounts of kernel memory.
> To not do that, limit must be imposed which is incompatible with
> arbitrary sized command lines.
> 
> I apologize for hairy code, but this it direct consequence of command line
> layout in memory and hacks to support things like "init [3]".
> 
> The loops are "unrolled" otherwise it is either macros which hide
> control flow or functions with 7-8 arguments with equal line count.
> 
> There should be real setproctitle(2) or something.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> Tested-by: Jarod Wilson <jarod@redhat.com>
> Acked-by: Jarod Wilson <jarod@redhat.com>
> ---
> 
> 	v5: fix BUG_ON(env_start > env_end)

I can no longer trigger this BUG_ON() with v5 of the patch.

Regards,
Jan

  parent reply	other threads:[~2015-05-28 11:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 21:47 [PATCH 1/2] prctl: more prctl(PR_SET_MM_*) checks Alexey Dobriyan
2015-05-27 21:49 ` [PATCH 2/2] proc: fix PAGE_SIZE limit of /proc/$PID/cmdline Alexey Dobriyan
2015-05-27 22:14   ` Cyrill Gorcunov
2015-05-27 22:29     ` Alexey Dobriyan
2015-05-27 22:48       ` Cyrill Gorcunov
2015-05-27 23:12         ` Alexey Dobriyan
2015-05-28  6:59           ` Cyrill Gorcunov
2015-05-28 11:14             ` Alexey Dobriyan
2015-05-28 11:35               ` Cyrill Gorcunov
2015-05-28 12:00                 ` Cyrill Gorcunov
2015-05-28 11:57   ` Jan Stancek [this message]
2015-05-27 22:02 ` [PATCH 1/2] prctl: more prctl(PR_SET_MM_*) checks Cyrill Gorcunov
2015-05-27 22:12   ` Alexey Dobriyan
2015-05-27 22:20     ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532622376.6805756.1432814231660.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@openvz.org \
    --cc=jarod@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome