From: Roland McGrath Subject: Re: [PATCH 1/3] setup_arg_pages: diagnose excessive argument size Date: Fri, 10 Sep 2010 02:25:41 -0700 (PDT) Message-ID: <20100910092541.2864A405D5@magilla.sf.frob.com> References: <20100908023549.BFFA8401AF@magilla.sf.frob.com> <20100908115728.GB11762@grsecurity.net> <20100909141534.C948.A69D9226@jp.fujitsu.com> Reply-To: oss-security-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Brad Spengler , Linus Torvalds , Andrew Morton , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, oss-security-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org, Solar Designer , Kees Cook , Al Viro , Oleg Nesterov , Neil Horman , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, pageexec-Y8qEzhMunLyT9ig0jae3mg@public.gmane.org, Brad Spengler , Eugene Teo To: KOSAKI Motohiro Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: In-Reply-To: KOSAKI Motohiro's message of Thursday, 9 September 2010 14:31:18 +0900 <20100909141534.C948.A69D9226-+CUm20s59erQFUHtdCDX3A@public.gmane.org> List-Id: linux-fsdevel.vger.kernel.org > Brad, sorry, I have bad news. glibc sysconf(_SC_ARG_MAX) is implemented > by hard coded RLIMIT_STACK/4 heuristics. That said, at least _now_, we > can't change this even though you disliked. That said, we can't break > userland even though userland library is very crazy. I'm sorry you think it's "very crazy" to implement the required functionality in the only way available. POSIX requires that execve fail with E2BIG when the ARG_MAX limit is exceeded. sysconf has to return the correct actual limit that execve will enforce so that a conforming application knows how much it can safely attempt to use. Since the kernel uses the hard-coded RLIMIT_STACK/4 heuristic and does not expose the true manifest limit any other way, sysconf has to parallel the kernel's calculation. Thanks, Roland