Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2026511pxb; Wed, 2 Feb 2022 19:16:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzD9gE0bwAwaDpKnkFShx03UoCUd6tlUf5SgovpKiyJDRGWhkngUpIbuJI/GC0PmvTxXrv8 X-Received: by 2002:a17:902:bf0a:: with SMTP id bi10mr34077752plb.164.1643858187058; Wed, 02 Feb 2022 19:16:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643858187; cv=none; d=google.com; s=arc-20160816; b=wpqpnE58QfB1E4I7NlZFvHsafnPHBo7I4UJvg6gFtuaNt5QQdsODllSYd3o2RdGxKv MbxZtLSrhGDL5pd3uGh/Q91qHWRv2aEruqa1wNQfVVHIyzfPukjwq6KevHGmdMhiOmbB 2RpeksGQsPm7YyI4QWfbe2PyYoAe+PwXH19rKUrGa8BTvzXslFrtiBf2VBtob2qZwo2Y xE6GJfyimr46bkSIixqeL3uOavFkiQTnb0vpbGfsDFbrJ/qXLnhsjh8lWYyDcZczTRnC t32rk8cI9xRAq2ybB9h+pDXERw1wydLPPee1f+RsZsRSBr097oY5nZPQ/tVehfhVeKTs lH7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BKIYOgXf5K4p+GGgd7bYl/PT9+/8mk3LDQ6uvOqdAPQ=; b=iSrAOeUnOmfIREMXK5FiOJjutkQMHU6OuWit7yy4QNmV8nRBqWBgz9+fq3aNRsHszS 20duA6UVlIglMdoijUHlqzY1GEDy3MlbkkTbx9um8VZxi6ZaFPc3FqzvdKPwPlo3e+gh nG84opfBrXe34BLSgW5FDdC+ahx3+WiRCgmPbLDncJRArR/Jx2/+0uwrm9mKc1w5nN6c IUCdG5XDJ9JflCk80Qs2rDD4TC6podxNiIkVEv1uYONKJHafbbovepmjmDt48ByyeaHx hW7pH0qT5R2ZVAAi49QcE1kWO2+m37DKCuGZUvYUVyEhYSDZ9Fm75SOhu9M818rpA1kV KkaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q24wxtDg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i186si11012801pge.146.2022.02.02.19.16.15; Wed, 02 Feb 2022 19:16:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q24wxtDg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241130AbiBBPNv (ORCPT + 99 others); Wed, 2 Feb 2022 10:13:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345460AbiBBPNs (ORCPT ); Wed, 2 Feb 2022 10:13:48 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC0EC061748; Wed, 2 Feb 2022 07:13:43 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id m14so38733541wrg.12; Wed, 02 Feb 2022 07:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BKIYOgXf5K4p+GGgd7bYl/PT9+/8mk3LDQ6uvOqdAPQ=; b=q24wxtDg1Lcpl/X9SUx1BRm7NJXN+PWquOa3p+uAr9iubItg/s5Ykr/V1KU6qmBo+e IzwrM9WFixv/SDWs0I6aw8Yef9mIfh5X2orRJgqax7ThEcKjM4MJ1qZV0P5j/6Z+qM4g mSRkqTWlBqKmH15192c59yK4a9QuNLSKdmIjl8hdhDu0Smc+OyAgvUbNwUk1wlHykNjv WX/SPiKncYps/GVKZJnsia10vd3SN7rOgOkG0xwz7OX0mkmxAwdtWcFyFyaDMCoWdwqg 9R1VSBwMLpr/QQFz5l5ztOGCzqG9JbOvOebztCcx0JS9SQHpkC8cnmae4iyQdqMwin9j 25GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BKIYOgXf5K4p+GGgd7bYl/PT9+/8mk3LDQ6uvOqdAPQ=; b=hNyyvX2IlcUWF/o3QkgPqPS6iL5jDbScfpyv+4+9Q+72MZoclE5GRVFY/rJQk8krrB qO/xQA5wOchFmU9fApbbHiF2UQ5pNgkBp2AGMdjscCA4eG5yP6q6g+lb5/dC+RRAiFfG sTmP/ui+p/Dk47q9LsFgzMf5WNxokL/16MbUiA9fN1twsWEAD7lamyla5UxqXWPH0Qzw hjzFBw4TAed0N5hFws40BFveHK6+sDy9hQCm3PYP086Fl/tU0qrlxBhQpcEHGbztjdMB Q+c0BZSfU95MdRPtJRRuSIqg1/qXn+tnlPomk46FtM3qGoj1wU6RM4JyBIDDqF5jBFIx 9dFg== X-Gm-Message-State: AOAM531FW02MEP49xpQzy8SNX4UibZYhvCpa5OZ/4o6h3HqGxPsX1k8I UwKTPJjzIfh9T+d4n0QlJw== X-Received: by 2002:adf:f344:: with SMTP id e4mr26779144wrp.362.1643814821893; Wed, 02 Feb 2022 07:13:41 -0800 (PST) Received: from localhost.localdomain ([46.53.252.48]) by smtp.gmail.com with ESMTPSA id m187sm4905052wme.25.2022.02.02.07.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 07:13:41 -0800 (PST) Date: Wed, 2 Feb 2022 18:13:39 +0300 From: Alexey Dobriyan To: Kees Cook Cc: Eric Biederman , Shuah Khan , linux-kselftest@vger.kernel.org, Ariadne Conill , Michael Kerrisk , Matthew Wilcox , Christian Brauner , Rich Felker , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] selftests/exec: Avoid future NULL argv execve warning Message-ID: References: <20220201000807.2453486-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220201000807.2453486-1-keescook@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 31, 2022 at 04:08:07PM -0800, Kees Cook wrote: > Build actual argv for launching recursion test to avoid future warning > about using an empty argv in execve(). > --- a/tools/testing/selftests/exec/recursion-depth.c > +++ b/tools/testing/selftests/exec/recursion-depth.c > @@ -24,8 +24,14 @@ > #include > #include > > +#define FILENAME "/tmp/1" > +#define HASHBANG "#!" FILENAME "\n" > + > int main(void) > { > + char * const argv[] = { FILENAME, NULL }; > + int rv; Can we move out of -Wdeclaration-after-statement mentality in tests at least? > - int rv = execve(FILENAME, NULL, NULL); > + rv = execve(FILENAME, argv, NULL); int rv = execve(FILENAME, (char*[]){FILENAME, NULL}, NULL); is cleaner (and modern)! > if (rv == -1 && errno == ELOOP) { > return 0; > }