From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id A9BD5394443E for ; Tue, 13 Apr 2021 12:13:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A9BD5394443E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=whitebox@nefkom.net Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4FKPdX48QWz1qwB5; Tue, 13 Apr 2021 14:13:20 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4FKPdX3j9Gz1sP6f; Tue, 13 Apr 2021 14:13:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 1NNHhqkWCLbg; Tue, 13 Apr 2021 14:13:19 +0200 (CEST) X-Auth-Info: I+YFqz0GC5CsLrVZbhmdP9dXX5PyRt9b3K1QqAdzlGph0uyKAlf+eFh1IhflnMq4 Received: from igel.home (ppp-46-244-161-206.dynamic.mnet-online.de [46.244.161.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 13 Apr 2021 14:13:19 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 2267A2C36B4; Tue, 13 Apr 2021 14:13:19 +0200 (CEST) From: Andreas Schwab To: Michal Nazarewicz Cc: Adhemerval Zanella , libc-alpha@sourceware.org Subject: Re: [PATCH] linux: sysconf: limit _SC_MAX_ARG to 6 MiB [BZ #25305] References: <20210407151058.1176364-1-mina86@mina86.com> <46c3ea60-7a57-14f7-92f9-e915e3b12dae@linaro.org> X-Yow: .. Once upon a time, four AMPHIBIOUS HOG CALLERS attacked a family of DEFENSELESS, SENSITIVE COIN COLLECTORS and brought DOWN their PROPERTY VALUES!! Date: Tue, 13 Apr 2021 14:13:19 +0200 In-Reply-To: (Michal Nazarewicz's message of "Mon, 12 Apr 2021 23:31:19 +0200") Message-ID: <87im4qe61s.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 12:13:23 -0000 On Apr 12 2021, Michal Nazarewicz wrote: >> On 07/04/2021 12:10, Michal Nazarewicz wrote: >>> Since Linux 4.13, kernel limits the maximum command line arguments >>> length to 6 MiB.¹ Normally the limit is still quarter of the maximum >>> stack size but if that limit exceeds 6 MiB it’s clamped down. > > On Mon, Apr 12 2021, Adhemerval Zanella wrote: >> Patch look good to me, thanks. >> >> Reviewed=by: Adhemerval Zanella >> >>> --- >>> sysdeps/unix/sysv/linux/sysconf.c | 5 ++++- >>> 1 file changed, 4 insertions(+), 1 deletion(-) >>> >>> diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c >>> index 366fcef01e..bd711795c7 100644 >>> --- a/sysdeps/unix/sysv/linux/sysconf.c >>> +++ b/sysdeps/unix/sysv/linux/sysconf.c >>> @@ -55,7 +55,10 @@ __sysconf (int name) >>> struct rlimit rlimit; >>> /* Use getrlimit to get the stack limit. */ >>> if (__getrlimit (RLIMIT_STACK, &rlimit) == 0) >>> - return MAX (legacy_ARG_MAX, rlimit.rlim_cur / 4); >>> + { >>> + const long int limit = MAX (legacy_ARG_MAX, rlimit.rlim_cur / 4); >>> + return MIN (limit, 6 << 10 << 10); >> >> I think it a bit easier to read with the value expanded (6291456). > > I’d rather go with ‘6 * 1024 * 1024’ if shifts aren’t readable. In addition, I'd give it a symbolic name with a comment. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."