Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbdF3Gai (ORCPT ); Fri, 30 Jun 2017 02:30:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33938 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751494AbdF3Gah (ORCPT ); Fri, 30 Jun 2017 02:30:37 -0400 From: Anshuman Khandual Subject: Question regarding MAX_ARG_STRLEN with execve() To: Linux Kernel Mailing List Cc: Ingo Molnar , Alexander Viro Date: Fri, 30 Jun 2017 11:59:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17063006-0040-0000-0000-00000338C6F5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17063006-0041-0000-0000-00000CB3C9F7 Message-Id: <8138c533-dae2-6a6a-fabd-d090b72d4d99@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-30_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706300104 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 962 Lines: 33 Hello, execve() system call should support argument length of MAX_ARG_STRLEN (PAGE_SIZE * 32). On 64K page size systems, we are not able to pass 32 * PAGE_SIZE arguments into the execve() system call because of the following reasons. * struct linux_binprm's vma starts with a size of PAGE_SIZE vma->vm_end = STACK_TOP_MAX; vma->vm_start = vma->vm_end - PAGE_SIZE; * The VMA expands as much depending upon the argument size. So for 32 * PAGE_SIZE argument, it becomes 33 * PAGE_SIZE. * 33 * PAGE_SIZE with 64K pages fails the following test in get_arg_page() function. 33 * PAGE_SIZE is more than 2MB (8 MB /4) with 64K page size. if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) * Right now RLIMIT_STACK is hard coded 8MB which does not take PAGE_SIZE into account. Wondering what should be the solution for this problem ? * Change the default stack size from 8MB ? * Change the ratio test from 1/4th ? Thoughts ? Regards Anshuman