mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH] proc: fix PAGE_SIZE limit of /proc/$PID/cmdline
Date: Tue, 24 Mar 2015 14:42:25 -0700	[thread overview]
Message-ID: <20150324144225.d1483f70d508c02876efd5b4@linux-foundation.org> (raw)
In-Reply-To: <20150320175147.GA2127@p183.telecom.by>

On Fri, 20 Mar 2015 20:51:47 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:

> /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.
> 
> 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.
>
> ...
>
> fs/proc/base.c |  203 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 194 insertions(+), 9 deletions(-)
>

I'm desperately trying to think of a reason to not merge this patch :(

I haven't seen anyone complain about the PAGE_SIZE limit - can't we
pretend we didn't notice?  Or tell 'em to switch to powerpc so they
get 64k!

  reply	other threads:[~2015-03-24 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 17:51 Alexey Dobriyan
2015-03-24 21:42 ` Andrew Morton [this message]
2015-03-25 11:29   ` Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2015-02-28 14:53 Alexey Dobriyan

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=20150324144225.d1483f70d508c02876efd5b4@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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