Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5818453pxb; Wed, 26 Jan 2022 23:28:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJz00ddNKfbMYzpCcjTqUg8jKEE1jxXLujKnYf2/St4DHjuaMkzjt7Ydbtpt+DdBzgd76sNF X-Received: by 2002:a05:6a00:1acb:: with SMTP id f11mr1787720pfv.28.1643268486260; Wed, 26 Jan 2022 23:28:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643268486; cv=none; d=google.com; s=arc-20160816; b=laVAJu3kgkoFxCkMw9SUmSJun/GpnpJFq7bQQNg4XAAhm//a+5DfIehFalRAsKQIm9 5cMaR7502muO7QVWtfoWuQQmPtK8R26oXL52ahsTAbqRoi0fU0M3dT42dGQrixOCSX+v 9yBtoQoh8ZUbESHg7ZA5opBcs7J2VvYmmM2osJUjshN6ZhN+dMUr+l2BPsHqB4xWPKIc hYpcEHhyFs2UXzivl8K2QCxeKbJeqjRj0n/jA6kd6LChGBVAdrTNkW9tWCIs30rF7iMn ubpQRmxV2017xyKB9aJ3TztWjND6DjVZ32sQKK9pqzEJYd3MVKB9twxM8ovs6gotAPZL accg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=JdLPdQgd0iaP7Yu6mjOaddBUWGpSmxFYtZSh39BG6v0=; b=LR0UAeMBW6j+z85P4QiBt9CoZvpfYpTAdx2A7QezDMZEyFeqaC2qUUWEb8Wlh1lxX0 IZayCu8YGAyqrQCW+HurEa3HvY8Z6VJyC49iqE1ZoALF0IIWUUtXmKEyyyiW9oiF6lKm rEYqu07eqsGoRR9JDkv6Xh8rMWqtlUDgCvQurGfUGxbxTEsAZPaHiK9eeHkFQKzMwY2v ZgWDtWvB9YQAvmwsL1SagEstaFOV/MwPgwZ2ZqkZxYVY496ych5aGaarWaozyIi0XbS4 2siDumsm0qxwNJKj3Zj23iHtfGGqfq1t4GvahhSFClY/u4wwVvN7tK26RlmoL43WM/jq y0DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml10si4381546pjb.129.2022.01.26.23.27.54; Wed, 26 Jan 2022 23:28:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233824AbiA0AV6 (ORCPT + 99 others); Wed, 26 Jan 2022 19:21:58 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:42110 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiA0AV6 (ORCPT ); Wed, 26 Jan 2022 19:21:58 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]:56834) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nCsY0-005wJl-On; Wed, 26 Jan 2022 17:21:56 -0700 Received: from ip68-110-24-146.om.om.cox.net ([68.110.24.146]:49734 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nCsXz-006pY2-KG; Wed, 26 Jan 2022 17:21:56 -0700 From: "Eric W. Biederman" To: Kees Cook Cc: Heikki Kallasjoki , Ariadne Conill , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro References: <20220126043947.10058-1-ariadne@dereferenced.org> <202201252241.7309AE568F@keescook> <39480927-B17F-4573-B335-7FCFD81AB997@chromium.org> <44b4472d-1d50-c43f-dbb1-953532339fb4@dereferenced.org> <202201261545.D955A71E@keescook> Date: Wed, 26 Jan 2022 18:20:50 -0600 In-Reply-To: <202201261545.D955A71E@keescook> (Kees Cook's message of "Wed, 26 Jan 2022 15:57:35 -0800") Message-ID: <8735lauizh.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1nCsXz-006pY2-KG;;;mid=<8735lauizh.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.110.24.146;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18Sz/maQ5hy2KEQvwA/EgujcJDkBMsam3I= X-SA-Exim-Connect-IP: 68.110.24.146 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa05.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG, T_TooManySym_01,T_TooManySym_02,T_TooManySym_03,XMSubLong autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4990] * 1.5 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_03 6+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Kees Cook X-Spam-Relay-Country: X-Spam-Timing: total 604 ms - load_scoreonly_sql: 0.41 (0.1%), signal_user_changed: 14 (2.3%), b_tie_ro: 12 (1.9%), parse: 1.19 (0.2%), extract_message_metadata: 20 (3.3%), get_uri_detail_list: 2.7 (0.4%), tests_pri_-1000: 30 (4.9%), tests_pri_-950: 1.37 (0.2%), tests_pri_-900: 1.07 (0.2%), tests_pri_-90: 173 (28.7%), check_bayes: 170 (28.2%), b_tokenize: 7 (1.2%), b_tok_get_all: 50 (8.3%), b_comp_prob: 3.9 (0.6%), b_tok_touch_all: 105 (17.3%), b_finish: 1.18 (0.2%), tests_pri_0: 350 (57.9%), check_dkim_signature: 0.98 (0.2%), check_dkim_adsp: 3.9 (0.6%), poll_dns_idle: 0.84 (0.1%), tests_pri_10: 2.1 (0.3%), tests_pri_500: 7 (1.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] fs/exec: require argv[0] presence in do_execveat_common() X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kees Cook writes: > On Wed, Jan 26, 2022 at 12:33:39PM +0000, Heikki Kallasjoki wrote: >> On Wed, Jan 26, 2022 at 05:18:58AM -0600, Ariadne Conill wrote: >> > On Tue, 25 Jan 2022, Kees Cook wrote: >> > > Lots of stuff likes to do: >> > > execve(path, NULL, NULL); >> > >> > I looked at these, and these seem to basically be lazily-written test cases >> > which should be fixed. I didn't see any example of real-world applications >> > doing this. As noted in some of the test cases, there are comments like >> > "Solaris doesn't support this," etc. >> >> See also the (small) handful of instances of `execlp(cmd, NULL);` out >> there, which I imagine would start to fail: >> https://codesearch.debian.net/search?q=execlp%3F%5Cs*%5C%28%5B%5E%2C%5D%2B%2C%5Cs*NULL&literal=0 >> >> Two of the hits (ispell, nauty) would seem to be non-test use cases. > > Ah yeah, I've added this to the Issue tracker: > https://github.com/KSPP/linux/issues/176 I just took a slightly deeper look at these. There are two patterns found by that search. - execlp("/proc/self/exec", NULL) Which in both both the proot and care packages is a testt that deliberately loops and checks to see if it can generate "argc == 0". That is the case where changing argc == 0 into { "", NULL } will loop forever. For that test failing to exec the "argc == 0" will cause a test failure but for a security issue that seems a reasonable thing to do to a test. - execlp(MACRO, NULL) The macro happens to contain commas so what looks via inspection will generate an application run with "argc == 0" actually does not. Eric