From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753885AbbE1L5Y (ORCPT ); Thu, 28 May 2015 07:57:24 -0400 Received: from mx5-phx2.redhat.com ([209.132.183.37]:52128 "EHLO mx5-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753356AbbE1L5R (ORCPT ); Thu, 28 May 2015 07:57:17 -0400 Date: Thu, 28 May 2015 07:57:11 -0400 (EDT) From: Jan Stancek To: Alexey Dobriyan Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, gorcunov@openvz.org, jarod@redhat.com Message-ID: <532622376.6805756.1432814231660.JavaMail.zimbra@redhat.com> In-Reply-To: <20150527214953.GB12863@p183.telecom.by> References: <20150527214757.GA12863@p183.telecom.by> <20150527214953.GB12863@p183.telecom.by> Subject: Re: [PATCH 2/2] proc: fix PAGE_SIZE limit of /proc/$PID/cmdline MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.34.26.57] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF31 (Linux)/8.0.6_GA_5922) Thread-Topic: proc: fix PAGE_SIZE limit of /proc/$PID/cmdline Thread-Index: FqbeWDzOPHm5cxpld0PC/AgWiW060w== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > From: "Alexey Dobriyan" > 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 > Tested-by: Jarod Wilson > Acked-by: Jarod Wilson > --- > > v5: fix BUG_ON(env_start > env_end) I can no longer trigger this BUG_ON() with v5 of the patch. Regards, Jan