Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp846232rdg; Wed, 11 Oct 2023 07:12:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaMpaBeypdJSMHHT9lYrT5JTy4lOKyQ8MZ/BNAPCG/s46HXxH2u9mCVc8u22RDIXfUvvfS X-Received: by 2002:a17:90a:b102:b0:268:d456:123 with SMTP id z2-20020a17090ab10200b00268d4560123mr17834953pjq.41.1697033529303; Wed, 11 Oct 2023 07:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697033529; cv=none; d=google.com; s=arc-20160816; b=P1ydXpZ/3kPX+PG/m5Rlam1s4AsQKLltRquatkvdApjnfhYtnndMpQkWwuCOI/Z53u qpgaMHiFNKtnu7AgvxbjFZRpbku6aE7o/l9ShyGjg1yIX0KWc9iWhuoCnyIgsCxKwGGU KjzKM0Ausk+HLrHwT/FAc90sFtAU7y7OPQ32pFRpkYG3C4xJR7m/sQpdpDpy35asS0BP zyMJWK3BGLzhoJJw2RTeaR4Xn92gt31cpPO4IQ18JUT7k2MartjjKL4VVSGKkxs+c6j5 KsOfH86X8+FGpLhcDZKY/YJS5aY3gR/v5MKQ0MCeRrcV/HZcfn4ncsBdHke5a8BVz2yK 28RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=EEXYnPhszhtrxRcAa0qWRiMZeIJE5Y+LsmZGqghFh6g=; fh=Uxb8CmDRNETOOABXu/reqwMbtOmB6epPbc1mQgATnvM=; b=I2JOmmxXIcKNS1FgQa/ve7dVElg8TwwwkCmVz8AmAXKhYH/7SnJlLlN6EoaYPoUOYJ P26uC/oHtjbMsiLm/FvNpXBkgWsbXckm+wDVf48lPpM6uFdxDWlZYrOqrDkb3RR8h7UQ z7+P7Ou5xH+woYHli9KvnxOcRhsSGcvIB5sCl8ZiacjxcWkvROCjWQGiDQsyTn3WpfKs jLCAkNtdFCYyB6vVi04KTw1t4uarc8zI+MhY44S2pFfk8j7qF9Z3fHYTuf09ZPoGtINr 4XWmLsgp0SGxUmE3Ndn4PVfdyZJQBFRpkpV13kx+OX5U5cJC1wucUyw47iGwseaWVF30 Fl2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o21-20020a17090ad25500b0027d06e08f9bsi1314742pjw.150.2023.10.11.07.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 07:12:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2C60280D6A32; Wed, 11 Oct 2023 07:12:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232480AbjJKOL6 (ORCPT + 99 others); Wed, 11 Oct 2023 10:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbjJKOL5 (ORCPT ); Wed, 11 Oct 2023 10:11:57 -0400 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2F294; Wed, 11 Oct 2023 07:11:55 -0700 (PDT) Received: from [2601:18c:9101:a8b6:6e0b:84ff:fee2:98bb] (helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qqZw2-0003Dg-2T; Wed, 11 Oct 2023 10:11:38 -0400 Date: Wed, 11 Oct 2023 10:11:34 -0400 From: Rik van Riel To: Alejandro Colomar Cc: linux-man@vger.kernel.org, kernel-team@meta.com, LKML , Eric Biederman , Matthew House Subject: [PATCH v2] execve.2: execve also returns E2BIG if a string is too long Message-ID: <20231011101134.709b8089@imladris.surriel.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: riel@surriel.com X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 07:12:07 -0700 (PDT) X-Spam-Level: ** The execve syscall returns -E2BIG in 3 cases: - The total length of the command line arguments and environment is too large. - An argument or environment string is longer than MAX_ARG_STRLEN. - The full path to the executable exceeds MAX_ARG_STRLEN. Spell out all 3 cases in the -E2BIG section. Discovered by moving a too large commandline parameter to an environment variable, and finding that things still did not work. Examined the code in fs/exec.c to get the details. Signed-off-by: Rik van Riel Suggested-by: Matthew House --- man2/execve.2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man2/execve.2 b/man2/execve.2 index 0d9582492ad1..85c6ec15df3c 100644 --- a/man2/execve.2 +++ b/man2/execve.2 @@ -449,7 +449,8 @@ The total number of bytes in the environment .RI ( envp ) and argument list .RI ( argv ) -is too large. +is too large, an argument or environment string is too long, or +the full path name to the executable is too long. .TP .B EACCES Search permission is denied on a component of the path prefix of -- 2.41.0