Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3107040pxk; Mon, 7 Sep 2020 03:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXxqLbkQg9Tt+1omnk8PuSDCkjcMQZDaKfY+QkLNGd9KEjbjQMMPDAF6Vxnmr7NHm3X45j X-Received: by 2002:a17:906:7088:: with SMTP id b8mr20112663ejk.27.1599474517424; Mon, 07 Sep 2020 03:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599474517; cv=none; d=google.com; s=arc-20160816; b=U2A2cBqyk+YZEtldFEhwURU8QeQIExh31Kf5d3dB3Q68nHuqxfbKZucq76AQPaOvci UCoWix3z3thd09wasecgYCH2PPs22Hi/YcLGydWXgDPEToc3ByQJ664K75xNHCU8AM6B nK6K5qRPQD9yf7hFPL920Ffvdq5J0UsrFNcq5N+sO+pctap+q4+kdsYeAPTn5B58F7uP G+CU77Oo6GQtZhzWqNSV0Iv+vhH34t4YJsq53irBZzYA+KXbTNcdvE7mzO9+3unl49uw h60jTJ6E5EzfsZnL4tdAXOs3fK2zfKb1V4TvNbAVaLFE2C5TqLvfH+rVvT5kF334U61c sgBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wKD6lSZD26VeoWy8eR09bLV3w2hONb5BWGb0VSFI3c0=; b=XvasWiBdCNAIJnotTquIoAt4E7sBd05UtU5W+bNNjOmTXQu06X+2bK+J96xfAYNHwp sV8XYr6MRMAS9tyPGCkhsFFrp7/doxM8fqgOTA8SqgN2Tsax7/QNLIbKrSW2z9rf47wi 9/5Gl+aI90iX3lNq1mZwAEy6k90xN+8PkdpLE/YrkBSAV1/dcb7/hnti3qQPM23O5p0I tbGyNkenrAih81yZlrPVlWqRL/OerKNjybId3mcmnZ/tofS21MKZ9hOOxMs+TgR0e/3S F3XMnhf/emXPhSDsRTOKhqJ8rTd6Gu7q/N3bPA1DBsdYRfwGNMh9wTA5yhgDe63ELOO7 4cXw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay26si8973059edb.269.2020.09.07.03.28.15; Mon, 07 Sep 2020 03:28:37 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728853AbgIGK1s (ORCPT + 99 others); Mon, 7 Sep 2020 06:27:48 -0400 Received: from foss.arm.com ([217.140.110.172]:60084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728186AbgIGK10 (ORCPT ); Mon, 7 Sep 2020 06:27:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CFFFF106F; Mon, 7 Sep 2020 03:27:20 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7EAE33F66E; Mon, 7 Sep 2020 03:27:19 -0700 (PDT) Date: Mon, 7 Sep 2020 11:27:17 +0100 From: Dave Martin To: Boyan Karatotev Cc: Shuah Khan , boian4o1@gmail.com, Catalin Marinas , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, amit.kachhap@arm.com, vincenzo.frascino@arm.com, Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/4] kselftests/arm64: add PAuth test for whether exec() changes keys Message-ID: <20200907102717.GM6642@arm.com> References: <20200828131606.7946-1-boyan.karatotev@arm.com> <20200828131606.7946-4-boyan.karatotev@arm.com> <20200902170052.GJ6642@arm.com> <70e207ea-f7c2-2c9d-e868-3ba3b6451c6f@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70e207ea-f7c2-2c9d-e868-3ba3b6451c6f@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 03, 2020 at 11:20:25AM +0100, Boyan Karatotev wrote: > On 02/09/2020 18:00, Dave Martin wrote: > > On Fri, Aug 28, 2020 at 02:16:05PM +0100, Boyan Karatotev wrote: > >> Kernel documentation states that it will change PAuth keys on exec() calls. > >> > >> Verify that all keys are correctly switched to new ones. > >> > >> Cc: Shuah Khan > >> Cc: Catalin Marinas > >> Cc: Will Deacon > >> Signed-off-by: Boyan Karatotev > >> --- [...] > >> diff --git a/tools/testing/selftests/arm64/pauth/pac.c b/tools/testing/selftests/arm64/pauth/pac.c > >> index cdbffa8bf61e..16dea47b11c7 100644 > >> --- a/tools/testing/selftests/arm64/pauth/pac.c > >> +++ b/tools/testing/selftests/arm64/pauth/pac.c [...] > >> +int exec_sign_all(struct signatures *signed_vals, size_t val) > >> +{ > > > > Could popen(3) be used here? > > > > Fork-and-exec is notoriously fiddly, so it's preferable to use a library > > function to do it where applicable.I would love to, but the worker needs a bidirectional channel and popen > only gives a unidirectional stream. Ah, fair point. Would it help if you created an additional pipe before calling popen()? May not be worth it, though. For one thing, wiring that extra pipe to stdin or stdout in the child process would require some extra work... Cheers ---Dave