Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp446998pxb; Thu, 9 Sep 2021 04:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdAbJ5Gb4bjZoq/shJVRWnjT5BqLUovbYpFlRmI3/5djt952BzMkaqSBwvkEboHlDAgnbe X-Received: by 2002:a6b:2b97:: with SMTP id r145mr2202991ior.193.1631188115753; Thu, 09 Sep 2021 04:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188115; cv=none; d=google.com; s=arc-20160816; b=pFhuooBG9qNU+6krFWw4LR8cJyTWsHWiBbH4WhZ2Nm7XbShFJQekgIL1eTiyVkuumL qcpP4MytUxkVnpbHMB2QMcpnzvrD/wuTmTpxVSMrXMvRyTLDNamihX/b5YxrykgXQnlv SiojiG6hwwn6vs/MMxVuo1J4oylaXY/Mibd5SE7xK3RcsX4u50EXtMjQJtlbw8iCWI4K HMZGPC0mM9DaYxloUzngn1uRh3Pk6nDRYtS1rkx+aukrG4axLSVZNLdK41DXScXNupbR ccZcwRFLnBJwIOIu+N9yTFUHeOaknhKx3H/15VwOD1PS8Y1hYQ4ZFnVCnK7A/AbkxdnP lExw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kw7NjloB7idtKWw3i5+ZGONhjXbQAwaXQ1pKiy7jWfI=; b=fQb6fpf4yGfytsA8gKnZUDDNxaolbYrWDdiZT+U1sIW485zvX+N3U6vLO/u79+Zw/N xdjcJuEiPUMX2O4CKJc5ZWeqwE9TA2Dkjz5mayXIHovB3V6fyiz0KI2D//TnqPDW0DlM K5llYdrALvQPSM9ND3gDwYhc4HnwfPvegU7IPCO+FwMPsV+Hj9FEW8AwhyNRpbl58ced qdguVnmWNjjHWXh2nKCMssBqeBOhBrexyQg3/DI3qauGjMwDO1GLYoEkjMYFxfTYVnml nLOsXWvizC4uM7sY+zh5rWtlClge1sW7k36TmQ+iRLVG0rj3dne30M93HF2va/JPrkXj iiQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tdu25mCX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si1687181jae.125.2021.09.09.04.48.24; Thu, 09 Sep 2021 04:48:35 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tdu25mCX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240885AbhIILs0 (ORCPT + 99 others); Thu, 9 Sep 2021 07:48:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:46380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238112AbhIILqV (ORCPT ); Thu, 9 Sep 2021 07:46:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 47B7D61214; Thu, 9 Sep 2021 11:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187775; bh=h6FqXYCR30wR/rITiby2miwzaK5galCFD9iDPMZKP1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdu25mCXm/nq/YbIdoGRsY32W22s/6ejNjewYeopEGxdxKudCe1FkAr13knIc4wac OCkX6SEQxjUWru3ezbvZtCaJMVjSAL/iT0YVmUpVL3betjDTOoRcTVB3PcBGXWeF6A rht7Eb3QvfVLldX+HT+LWspR8WZ7dbbJ+dCdy0SJerQW9fse1OknazCdM/NrMHCuzL i7YOfaRBz1INedw2knOwVQTFy9w4L+DqiTxFP4opJ/RPKdzjbhSSFGrqvxr/6rsheR u+oaD7z8ydPTe6BwqnDrbiJFTe9cp9AmecZhDxRCck3Wfdsz1iu1BNA0uepnnWrGTD Uo81U/LQ3bcwQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Juhee Kang , Andrii Nakryiko , Yonghong Song , Sasha Levin , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 085/252] samples: bpf: Fix tracex7 error raised on the missing argument Date: Thu, 9 Sep 2021 07:38:19 -0400 Message-Id: <20210909114106.141462-85-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juhee Kang [ Upstream commit 7d07006f05922b95518be403f08ef8437b67aa32 ] The current behavior of 'tracex7' doesn't consist with other bpf samples tracex{1..6}. Other samples do not require any argument to run with, but tracex7 should be run with btrfs device argument. (it should be executed with test_override_return.sh) Currently, tracex7 doesn't have any description about how to run this program and raises an unexpected error. And this result might be confusing since users might not have a hunch about how to run this program. // Current behavior # ./tracex7 sh: 1: Syntax error: word unexpected (expecting ")") // Fixed behavior # ./tracex7 ERROR: Run with the btrfs device argument! In order to fix this error, this commit adds logic to report a message and exit when running this program with a missing argument. Additionally in test_override_return.sh, there is a problem with multiple directory(tmpmnt) creation. So in this commit adds a line with removing the directory with every execution. Signed-off-by: Juhee Kang Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20210727041056.23455-1-claudiajkang@gmail.com Signed-off-by: Sasha Levin --- samples/bpf/test_override_return.sh | 1 + samples/bpf/tracex7_user.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/samples/bpf/test_override_return.sh b/samples/bpf/test_override_return.sh index e68b9ee6814b..35db26f736b9 100755 --- a/samples/bpf/test_override_return.sh +++ b/samples/bpf/test_override_return.sh @@ -1,5 +1,6 @@ #!/bin/bash +rm -r tmpmnt rm -f testfile.img dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 DEVICE=$(losetup --show -f testfile.img) diff --git a/samples/bpf/tracex7_user.c b/samples/bpf/tracex7_user.c index fdcd6580dd73..8be7ce18d3ba 100644 --- a/samples/bpf/tracex7_user.c +++ b/samples/bpf/tracex7_user.c @@ -14,6 +14,11 @@ int main(int argc, char **argv) int ret = 0; FILE *f; + if (!argv[1]) { + fprintf(stderr, "ERROR: Run with the btrfs device argument!\n"); + return 0; + } + snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); obj = bpf_object__open_file(filename, NULL); if (libbpf_get_error(obj)) { -- 2.30.2