Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp354955pxj; Thu, 24 Jun 2021 00:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybkt2Yu/eWs84MGbUGGfYqJFgzUBqU2UyLQpk2AGT1ShStas5g27W5Mhdnn/gtbthvw228 X-Received: by 2002:a17:906:1982:: with SMTP id g2mr3962025ejd.184.1624519369996; Thu, 24 Jun 2021 00:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624519369; cv=none; d=google.com; s=arc-20160816; b=ttPG1EQOzw30+yvAhtBK4XnWtbaxiIXl/d61Qhz7tR9CLzRRnmfjh2bm7t/nfmwzl/ C+YaJ4mDLTO0QYoJDnO0EMmBbp84zarAtpgr+b9eRxbjJl7OtCqTuZUlQaNtOKJbFFN5 hsHXkDqPu8sZOuS7XhitsCpBPF6bzAfmoY9TbnBf3+iRN+3rJd+JqU5s7CD7AVXOrXsU XvXsIvTBpi9/q148F/OtlbalYvPeFBznVwExaKTpaMSZF38jsvLdEAJychJnpDOwFvEq 2+UdDnV3v7gc7orMP4k1fOA0sNKNlyFvdQDVFcQW68IuSJ+KgZ9wo+D0wliWgrgpvXuo kL2Q== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=JHnvYOrKkJshQMWtx423bV/CsbBVbjgtnVVSeEluyrA=; b=SbNtG6GTwJLLYq8ZLCvAMpt77Jz3LfgS3sdHTsMTMGUy3irzPQRRdXEfeyKMATDMCZ wdBuCfjRJufTpdoug0QuUL3OoUdFegRWdvjhf+LK5VZuuxJJeXX4iqt2m2L9KIGkfEFF ypDJ9ZihKJ/pnhMfyKNf/AXWphp3BuZZxYIwvSYZRy78K8rcJNzWFkkcrZOFoUdEYEny GDEFnT9T8SA9z0YUCiZBqHDShlciGY1q5RdQIZFH170Kq0Ffz9ffIaSqee5XzldYSLSF 6uDtHUsumgmkUBIkmn0Lng6s2RNQpKruOuFLTH3HX2KaH7LZAKOiaTy17xmpizr+dnEb Oi1A== 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=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si2168283ejj.516.2021.06.24.00.22.26; Thu, 24 Jun 2021 00:22:49 -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=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbhFXHXi convert rfc822-to-8bit (ORCPT + 99 others); Thu, 24 Jun 2021 03:23:38 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:48775 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbhFXHXh (ORCPT ); Thu, 24 Jun 2021 03:23:37 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mtapsc-5-gGbqqVa_MamySoR60Cs1mA-1; Thu, 24 Jun 2021 08:21:16 +0100 X-MC-Unique: gGbqqVa_MamySoR60Cs1mA-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Jun 2021 08:21:15 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.018; Thu, 24 Jun 2021 08:21:15 +0100 From: David Laight To: 'Kees Cook' CC: 'Guillaume Tucker' , Shuah Khan , "stable@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL Thread-Topic: [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL Thread-Index: AQHXaCznpjkpNTpwjEW+kA8o/GdKZashmKhggAAdGgCAABKuUIAAWbwAgACepjA= Date: Thu, 24 Jun 2021 07:21:15 +0000 Message-ID: References: <20210619025834.2505201-1-keescook@chromium.org> <42f26361db6f481e980ac349bf0079ef@AcuMS.aculab.com> <202106230917.FE2F587@keescook> <76a575d1364a47458d27c76c65b673b6@AcuMS.aculab.com> <202106231231.9B858B95A@keescook> In-Reply-To: <202106231231.9B858B95A@keescook> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook > Sent: 23 June 2021 23:47 > > On Wed, Jun 23, 2021 at 04:27:47PM +0000, David Laight wrote: ... > > You can probably even do: > > > > echo "$test" | /bin/sh -c cat >$TRIGGER || true > > > > (moving the redirect to the outer shell). > > Actually, it looks like the "write" is already happening in the exec'd > process, so this can just be: > > echo "$test" | cat >$TRIGGER || true > > But it still can't be: > > echo "$test" >$TRIGGER > > which is what I had over-engineered a solution to. :) That one fails because echo is the shell builtin. But: /bin/echo "$test" >$TRIGGER should be fine. Quite where the original came from I not sure I want to find out. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)