Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1686274pxb; Thu, 16 Sep 2021 12:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrYhsboGHOKWdjWvBeF5rHteVgsfA5FMVMo+mf/icC36DAqoKjhVS7/b3ltOBDu1qExcP+ X-Received: by 2002:a02:3202:: with SMTP id j2mr5748689jaa.125.1631822318360; Thu, 16 Sep 2021 12:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631822318; cv=none; d=google.com; s=arc-20160816; b=T2IuS3klgSzoVqIl8vQCbNoTBmR9vBBREhfhERr36uIbanccrndLaJCVPRKYyP94vS fOzi23dy4crRg3mgSh33d+q1Go3ap/vzm6CJ3gkhhjQVXR9K7VwIoPECdg6Lnzx1QuIr ONoM7xvhhKgQY8GOAWxojcQ9u7dN++YVwl+LG4jrY/fwrGnF7+zjz8OeQon8SyLISGkY zpNBvvCMHVTPMsFMeRS9i6vFuxz27ViwZUygCYb2/lmiQoJT3nm0JaOcdqbalqQKTGsw EwIkFjMp5ze34XdIecmPb5QTvhTNfD24EDerJMWkUHkY0eQ9eIJkux6dMNNBy4dq6WJQ zdlA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kw7NjloB7idtKWw3i5+ZGONhjXbQAwaXQ1pKiy7jWfI=; b=d5XLd6RF/YWGKOwc+AyfIrSariBu7zXMKPZdD0rjh2lpOqHz8SEeWunqrmkhLcMM8Q GTJThkXvBUxRyxKdYRu1+iW4PnG9U3MPVWAi9VEPvr/CvrUlkBzjD5T/2boHyKZsU+xj MjVu0cAs2pnGNlAu+USuj3uiuklGvRfr/BmGqPxKKYHvjsbwxXHzt9B/qr663OnCIK3I NeY4Rlk0+g8ECuGmhtjeXbwXcHy0QzVwKbjZ0+rPFPt5Rl+lHuOKdcMrvabUbgSkaowm 8626wLcV/fLp7l+jNMsbcwGeOm0tnEvvldSWBhI3JLML8DIO3Hk836ialadL9tjTd/zE xjbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H6zLk3f8; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si3622528ilr.113.2021.09.16.12.58.07; Thu, 16 Sep 2021 12:58:38 -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=@linuxfoundation.org header.s=korg header.b=H6zLk3f8; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240814AbhIPQXz (ORCPT + 99 others); Thu, 16 Sep 2021 12:23:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:53832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240853AbhIPQOc (ORCPT ); Thu, 16 Sep 2021 12:14:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1664761390; Thu, 16 Sep 2021 16:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808637; bh=h6FqXYCR30wR/rITiby2miwzaK5galCFD9iDPMZKP1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6zLk3f88W6+DN1XHG8Rwf4pNQ+/Vn7pCv7CFxSvrW4FmMyOWxiVX9L9epTb7CUb1 HlM1o1mNW76+xyhErdcJK9V6M62cFYxPMp9+bC3gThzTA3kOR+gDH1W2WF4JEQ5YPb PN0lwLJclBFT1s0FY7LWHz5xAPoCm296qNsQWQHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juhee Kang , Andrii Nakryiko , Yonghong Song , Sasha Levin Subject: [PATCH 5.10 166/306] samples: bpf: Fix tracex7 error raised on the missing argument Date: Thu, 16 Sep 2021 17:58:31 +0200 Message-Id: <20210916155759.741118762@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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