Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5628282pxj; Wed, 23 Jun 2021 05:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrqsKNfWc6PVUHeB6ZVdpvGjCJvK3UVzzzA2T/YnP9wfXYOkkoD4Vaf77wOOoCcU814mus X-Received: by 2002:a05:6402:27d1:: with SMTP id c17mr6785331ede.17.1624452222284; Wed, 23 Jun 2021 05:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624452222; cv=none; d=google.com; s=arc-20160816; b=NvodCHTwIVu6iCP/x3KttAf2EyNAOIfGNxh46zx/v8DYi3d3Zb68mok0VNTjpBFoEe RMwng3FQ765PmDXU1DBZy+tvPmZkK7Ex8+M0pJber0AyIkN2jezM3tjuD5dqTVT966gx VadT2OtLwK/t4kbZrR+h1V5t/1bDe3uk45BfDIJ4Bfx0c+tdcQFil6hbNgRaSaWw5tNM iGnmD8nbFJRMpeOaT1t+3dtAtYJ9qTuei/qejkNbeB4V6hLIs0MkXKbEShBpdHOAODcb hUNJJx6t6uTppdQRJN0TXR1yMLuHltS/HJnJiwaCWRfiZ7Vj7StUp2Bw1QsyxQmssWj6 HmFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=amAmQMVzwhdxsN6aziwSUmtKEnDf1bATAX7wcFlz16E=; b=c1pIe5FewootlA2fFY9goXJixQ6Op0qurIj5UsM7/ZnwGbj/O2GhYWwjNbz4R0Q3Gu Jh3WWpr/ZDTAEm3vdqzM+htyZ8kN6ab/M7z0PYkCCdAOJC6OsbnG2rwuBuDinO93wJ7/ e1yNhVUcu+kE7yHmTrvtj/7mvlTDv18MigWPmUcXkPoPuhTioGRl7f8Ts3F8wLE2oIJe uQBz6+vMo7lXLNE6Y0t1b6jFzvbs+vmxhh0NxlFPT1rgetqp2NhdvRfPP3PCYA6bt2Po wvgFYoqlVheVAmuyFjiWQyVkfWU2U2pgSo+i8Ci2YDXgT+/9WzKx0533oBTWoQC2G+Y3 zrwA== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 25si16696220eji.549.2021.06.23.05.43.18; Wed, 23 Jun 2021 05:43:42 -0700 (PDT) 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbhFWMmX (ORCPT + 99 others); Wed, 23 Jun 2021 08:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbhFWMmU (ORCPT ); Wed, 23 Jun 2021 08:42:20 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96294C061574; Wed, 23 Jun 2021 05:40:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 555951F436DA Subject: Re: [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL To: Kees Cook , Shuah Khan Cc: stable@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210619025834.2505201-1-keescook@chromium.org> From: Guillaume Tucker Message-ID: Date: Wed, 23 Jun 2021 13:39:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210619025834.2505201-1-keescook@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/06/2021 03:58, Kees Cook wrote: > Some environments do not set $SHELL when running tests. There's no need > to use $SHELL here anyway, so just replace it with hard-coded path > instead. Additionally avoid using bash-isms in the command, so that > regular /bin/sh can be used. > > Suggested-by: Guillaume Tucker > Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets") > Cc: stable@vger.kernel.org > Signed-off-by: Kees Cook Tested-by: "kernelci.org bot" Sample staging results with this patch applied on top of next-20210622: https://staging.kernelci.org/test/plan/id/60d2dbdc3cfb88da0924bf41/ Full log: https://storage.staging.kernelci.org/kernelci/staging-next/staging-next-20210623.0/x86_64/x86_64_defconfig+x86-chromebook+kselftest/clang-13/lab-collabora/kselftest-lkdtm-asus-C523NA-A20057-coral.html This was tested using Debian Buster with the default shell being "dash", which doesn't support Bash-specific features. Thanks, Guillaume > --- > tools/testing/selftests/lkdtm/run.sh | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh > index bb7a1775307b..0f9f22ac004b 100755 > --- a/tools/testing/selftests/lkdtm/run.sh > +++ b/tools/testing/selftests/lkdtm/run.sh > @@ -78,8 +78,9 @@ dmesg > "$DMESG" > > # Most shells yell about signals and we're expecting the "cat" process > # to usually be killed by the kernel. So we have to run it in a sub-shell > -# and silence errors. > -($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true > +# to avoid terminating this script. Leave stderr alone, just in case > +# something _else_ happens. > +(/bin/sh -c '(echo '"$test"') | cat >'"$TRIGGER") || true > > # Record and dump the results > dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true >