Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1558133pxb; Thu, 16 Sep 2021 09:52:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynL6spwBOHIn6MXP4YOmldImLApR6W/pE715iHOQ66D3WABrymjTHSeNkU7JNV3aInxPMx X-Received: by 2002:a02:11c1:: with SMTP id 184mr5225126jaf.70.1631811171253; Thu, 16 Sep 2021 09:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631811171; cv=none; d=google.com; s=arc-20160816; b=Y65B/VsRrRUIBNskHm3OTiYbynfiH30goIbSExYVhOqV07FRE8oilupnFyQBSatxFA TlbwsSbIh14vF5qK3S0iuFviUWmKTVb74pTRXuigIi0rdcHG+0rJiu4hGPyf652rBIBu gCuzNCbDXAVoxprL2d7V1FtTkTvSYHkHXmOU6yiHnfyjJ+ug3tgewCk2SnJlWk+8eCfs vIUdSOMeKwY7fKc+1LkzxVwyPcL3YHIGss0SEpx+iLJO3keOBmGO00iGN5DQFX3iLLgf SZaM01v1P5V8e3bLGHtB4Ji6Vqi43BWnHG/RKrwEd0q9n8iPRxRUz9GRMGqqJ5GVZ9o3 A88A== 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=dcKWbWeTV6T586aT284Y1nhron1B1RfnUVYetGAwGMIgqtx9tBw8n1e9axB4fwSDf0 rcr60LezDXBnsmWtPQnZiKwO5D530SRJefPgKKPDqBY6YGI+kkalnlo4Loa0BmpLGrKH 2inQ4VEvXS4PbaCvJhj++rg0hqnFQOjPUE/zpOnxQkG9wW+g4S3cbApzWeNZ5r6Nm8Zk 9hdo5ZtneginLAV1nZ/KS2aMxjMxjGc/1I1CStXs1v9bb2chWKa4Yj38kA+zf/rmchB9 B/2odiw+DCdeW9IRXIVIFQ+REQPmtuSzx0E9CSxvJFnQyfgw+5vINoVIfB/TQEgnK97m RwsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yh2y0XkX; 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 h25si3165883ioj.39.2021.09.16.09.52.33; Thu, 16 Sep 2021 09:52:51 -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=yh2y0XkX; 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 S243020AbhIPQwD (ORCPT + 99 others); Thu, 16 Sep 2021 12:52:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:57378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344655AbhIPQqa (ORCPT ); Thu, 16 Sep 2021 12:46:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D074061504; Thu, 16 Sep 2021 16:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809588; bh=h6FqXYCR30wR/rITiby2miwzaK5galCFD9iDPMZKP1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yh2y0XkXByvIw4+HTgzSV5UJmMqWxEiqWaJB6BspiAkyfqkN4/mT80pgLBjUzhpHy AQ0m5W835e0txOSEWzQhBjfkUV4n7eafLSRPdDNdwEi80kSs0Muo63nh6/Q6BvBe3o Nk+xYP1st4Q0F/nG7x4kkI1VELhgxpgznDeZXol0= 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.13 208/380] samples: bpf: Fix tracex7 error raised on the missing argument Date: Thu, 16 Sep 2021 17:59:25 +0200 Message-Id: <20210916155811.147482109@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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