From patchwork Tue Feb 20 03:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5qKm6b6Z6JGj?= X-Patchwork-Id: 203403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp177808dyc; Mon, 19 Feb 2024 19:53:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVItvDUt+l5G7XZYqW8LFm/dUl0xR7gPsbmtc0he+3jw6w1Nf7aq9rIEgBytd5QcjPNcfoyyk28N6jA7FyULkqlRBusPw== X-Google-Smtp-Source: AGHT+IEh7goBsCYhg5JL3JMsDSnD/xupfLjE1svw40FQNeuD9mXj9WM5m10O7MUqo2eXS7PuRfjV X-Received: by 2002:a05:6871:587:b0:21e:6e02:2793 with SMTP id u7-20020a056871058700b0021e6e022793mr12516591oan.47.1708401232842; Mon, 19 Feb 2024 19:53:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708401232; cv=pass; d=google.com; s=arc-20160816; b=BbiiJOwUjJ/vsNYHZ9qWc3hX4trwZy3ov25lozmn2PFx7KNvUtAUHP5wUGixK8Bhz9 0QfUuWRVbekSSzdWaN1bt1zdJmBADAkO3icLGaxqZ4Etxq12BHgH36ceCx1fQPeiA8YB aXQdx3Gq58222MdBSgcQEPiGKNOrutly6IPGv3qUqUKzork/paU8FKGtX0mpdGICzrae Ep3w9ANQ1swBZ56iXudEJEP92CK+ra3mE3eWzdlQFpYHXsGPbtm8Y3/SnDIv+0jDkMg5 EsQh421EBrKvU9+BCU4ZhxL5QnJZ/azvEVYcSR+jvgndzKjQAymLL2kAP781WiU05Htc PkyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XIatRLdxp59gkCuXn1TM1+7Ffjtt7PxZsUax3x716A4=; fh=qCvwKa6A1Oj2egHzTwnCZrp8p+oOdCfv+GDLSm8uiZ4=; b=PCEyQLCSBv7FY+PH+EUZ5RCNoCdLKD7wAxwlMf6XyC3J7vhsz1dBafWUl2QdQ13lq1 AHoNsNQiEQlK9ReWBjw+gqy/JvDdRHHKA9OtQrcP5ZCVWBGuyyPfhR3N/WAEzs9EFgIo 46IQUF+4+Bn63KNCcEfBbcqXoYtMNaNRqXiGIfaQCz+N/xtLGd4o5qjNTRqLKwmQFkCY ukKVNM2tcLSqHBYU+9+MNkbMf/hYGaUVattj6XzzDixi2EmFJE/P8Pc4qzidsMjIqdAI oo50I0AJSxEdAJrilWOVv8DVDLOa288snHVNJZ+HwHFyfD9U+JG2vvjqv1q7uEGvvgyQ yA5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kIuiB9lI; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-72294-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72294-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a27-20020a630b5b000000b005d692a181d9si5514029pgl.340.2024.02.19.19.53.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 19:53:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72294-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kIuiB9lI; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-72294-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72294-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 72B58B2286D for ; Tue, 20 Feb 2024 03:52:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6494958AAB; Tue, 20 Feb 2024 03:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="kIuiB9lI" Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0B9F5823B for ; Tue, 20 Feb 2024 03:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708401098; cv=none; b=XCQTMjWSitffbw4Pb9J3ZpSlZvXhrr+Qbeg9Sxt3FFnQC14VyGyPOWxpWIct2/lfL1MnbTEElkghAK0fooG43sdWmOPylskV/9qmP0tOnARkF2ff58TlqKZ9kRTr+Kt703YP8uto9Ll+2wem9+ZqyElabhbVD8/b6CZFPzeDLPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708401098; c=relaxed/simple; bh=C3elKZgirtX7W4quQAT+pcAU39WJO4TotIfoaieEyx0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FKr1kqQpWVbQXzAT4NL2WdX0LnIa/06xBiusTM/qBOQcLzq60ro4VZonP3EJGOQdW8+Bi2fhIAMhdIn/eP3gpbEpzQxfi6GDABWa1GMZeS+aX+hIiiH92UhO3Rk+N32o4JmwyOATLaERfDLZNx0XuCyMHvi2EVdg4aj1GqShWLc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=kIuiB9lI; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c03d6e5e56so5188419b6e.1 for ; Mon, 19 Feb 2024 19:51:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1708401096; x=1709005896; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XIatRLdxp59gkCuXn1TM1+7Ffjtt7PxZsUax3x716A4=; b=kIuiB9lIdHcAmrh7dG0Vq56nvrYZrneaKgR4OHzLsAQPDFu3vxmqzAxcnPso9PebQz n/CzyF6z2BalvIVT/7AWV48xhbKfvu9t3pCRnXEaet61okgalvSpI2ORv/FGVHiRzeLz +P0zujx+U6xiWpDy3w7WV8dAccKJ6UDcTWA28AVokRLkqrWuyQrvMC0a0tTKXjkKZCPB KPSnVeQmN6DoLSIkeRQQ13v08S1W+TTujUK0b9O2jD7RXJ4Lj8ulpD60JI24uQ1FCikU Xwbv3WsoPFD47cAgraO6uB90i7nk/FmEyKIO3UsY8an/awj9QzVOgq1nfneA077E2/4F QqOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708401096; x=1709005896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XIatRLdxp59gkCuXn1TM1+7Ffjtt7PxZsUax3x716A4=; b=LbOH9qvkIxxO7hLwoJsgqux1E5nNQ4CYA709roGHVXAFex+cNq/aEn2is8r7E4ifes +TtNBAiNxLAPEpPVc+n6HjqLrIwpxiymQIPmavaRKxD0lSZ0r8pybO7gCE00UJs1/Auu PhJjjaOu91XORZ4MvWzf3rY5dfLvt9f4NpaTUZ4dWsgDat59S84z3rdsSL8DblMlX8wC 0JW62WeeiqCwrzOHsVXL8e9QTdIQC3Zr02tW72mkB+PVeHIePSLoj2EV9GaoviVM5PdE 5hh9opUQ7UMBrBhB3+snZ3HViNsQdFRWT2+DJvaqD6bmCdFrwydj76qr7PTWYd+9pZWo Ubwg== X-Forwarded-Encrypted: i=1; AJvYcCV23RJbMnzuVweQ/OwaMcU4YDy0XAiHSQ62hfqALRqdYuQYJdThRk0FNJl5WxergtxDKoopaabsK+jVkW23UZvOBs8bKYyk57HguQj0 X-Gm-Message-State: AOJu0YwRsbSaRBIPcXVhy/qKW9LPZWy30kEuyV+f4xRBQxs98bIKMy4t +2p6UyiizBS911pWMgj5bVuhEMaCtcqdGmu5YF11neq0L0XDJwgEgpB/ZJD/zvI= X-Received: by 2002:a05:6808:1646:b0:3c1:3427:fef3 with SMTP id az6-20020a056808164600b003c13427fef3mr18759661oib.48.1708401095822; Mon, 19 Feb 2024 19:51:35 -0800 (PST) Received: from localhost.localdomain ([43.129.25.208]) by smtp.gmail.com with ESMTPSA id jz7-20020a170903430700b001d94678a76csm5131723plb.117.2024.02.19.19.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 19:51:35 -0800 (PST) From: Menglong Dong To: andrii@kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, shuah@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, thinker.li@gmail.com, dongmenglong.8@bytedance.com, zhoufeng.zf@bytedance.com, davemarchevsky@fb.com, dxu@dxuuu.xyz, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH bpf-next 5/5] selftests/bpf: add test cases for multiple attach of tracing program Date: Tue, 20 Feb 2024 11:51:05 +0800 Message-Id: <20240220035105.34626-6-dongmenglong.8@bytedance.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240220035105.34626-1-dongmenglong.8@bytedance.com> References: <20240220035105.34626-1-dongmenglong.8@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791388531051778605 X-GMAIL-MSGID: 1791388531051778605 In this commit, we add the testcases for multiple attaching of tracing, include FENTRY, FEXIT, MODIFY_RETURN. Signed-off-by: Menglong Dong --- .../selftests/bpf/bpf_testmod/bpf_testmod.c | 49 ++++++ .../bpf/prog_tests/tracing_multi_attach.c | 155 ++++++++++++++++++ .../selftests/bpf/progs/tracing_multi_test.c | 72 ++++++++ 3 files changed, 276 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/tracing_multi_attach.c create mode 100644 tools/testing/selftests/bpf/progs/tracing_multi_test.c diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c index 66787e99ba1b..237eeb7daa07 100644 --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c @@ -98,12 +98,61 @@ bpf_testmod_test_struct_arg_8(u64 a, void *b, short c, int d, void *e, return bpf_testmod_test_struct_arg_result; } +noinline int +bpf_testmod_test_struct_arg_9(struct bpf_testmod_struct_arg_2 a, + struct bpf_testmod_struct_arg_1 b) { + bpf_testmod_test_struct_arg_result = a.a + a.b + b.a; + return bpf_testmod_test_struct_arg_result; +} + +noinline int +bpf_testmod_test_struct_arg_10(int a, struct bpf_testmod_struct_arg_2 b) { + bpf_testmod_test_struct_arg_result = a + b.a + b.b; + return bpf_testmod_test_struct_arg_result; +} + +noinline struct bpf_testmod_struct_arg_2 * +bpf_testmod_test_struct_arg_11(int a, struct bpf_testmod_struct_arg_2 b, int c) { + bpf_testmod_test_struct_arg_result = a + b.a + b.b + c; + return (void *)bpf_testmod_test_struct_arg_result; +} + +noinline int +bpf_testmod_test_struct_arg_12(int a, struct bpf_testmod_struct_arg_2 b, int *c) { + bpf_testmod_test_struct_arg_result = a + b.a + b.b + *c; + return bpf_testmod_test_struct_arg_result; +} + noinline int bpf_testmod_test_arg_ptr_to_struct(struct bpf_testmod_struct_arg_1 *a) { bpf_testmod_test_struct_arg_result = a->a; return bpf_testmod_test_struct_arg_result; } +noinline int +bpf_testmod_test_arg_ptr_1(struct bpf_testmod_struct_arg_1 *a) { + bpf_testmod_test_struct_arg_result = a->a; + return bpf_testmod_test_struct_arg_result; +} + +noinline int +bpf_testmod_test_arg_ptr_2(struct bpf_testmod_struct_arg_2 *a) { + bpf_testmod_test_struct_arg_result = a->a + a->b; + return bpf_testmod_test_struct_arg_result; +} + +noinline int +bpf_testmod_test_arg_ptr_3(int a, struct bpf_testmod_struct_arg_2 *b) { + bpf_testmod_test_struct_arg_result = a + b->a + b->b; + return bpf_testmod_test_struct_arg_result; +} + +noinline int +bpf_testmod_test_arg_ptr_4(struct bpf_testmod_struct_arg_2 *a, int b) { + bpf_testmod_test_struct_arg_result = a->a + a->b + b; + return bpf_testmod_test_struct_arg_result; +} + __bpf_kfunc void bpf_testmod_test_mod_kfunc(int i) { diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_multi_attach.c b/tools/testing/selftests/bpf/prog_tests/tracing_multi_attach.c new file mode 100644 index 000000000000..6162d41cca9e --- /dev/null +++ b/tools/testing/selftests/bpf/prog_tests/tracing_multi_attach.c @@ -0,0 +1,155 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2024 Bytedance. */ + +#include +#include "tracing_multi_test.skel.h" + +struct test_item { + char *prog; + char *target; + int attach_type; + bool success; + int link_fd; +}; + +static struct test_item test_items[] = { + { + .prog = "fentry_test1", .target = "bpf_testmod_test_struct_arg_9", + .attach_type = BPF_TRACE_FENTRY, .success = true, + }, + { + .prog = "fentry_test1", .target = "bpf_testmod_test_struct_arg_1", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test1", .target = "bpf_testmod_test_struct_arg_2", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test1", .target = "bpf_testmod_test_arg_ptr_2", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test2", .target = "bpf_testmod_test_struct_arg_2", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test2", .target = "bpf_testmod_test_struct_arg_10", + .attach_type = BPF_TRACE_FENTRY, .success = true, + }, + { + .prog = "fentry_test2", .target = "bpf_testmod_test_struct_arg_9", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test2", .target = "bpf_testmod_test_arg_ptr_3", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test3", .target = "bpf_testmod_test_arg_ptr_3", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fentry_test3", .target = "bpf_testmod_test_arg_ptr_4", + .attach_type = BPF_TRACE_FENTRY, .success = true, + }, + { + .prog = "fentry_test4", .target = "bpf_testmod_test_struct_arg_4", + .attach_type = BPF_TRACE_FENTRY, .success = true, + }, + { + .prog = "fentry_test4", .target = "bpf_testmod_test_struct_arg_2", + .attach_type = BPF_TRACE_FENTRY, .success = true, + }, + { + .prog = "fentry_test4", .target = "bpf_testmod_test_struct_arg_12", + .attach_type = BPF_TRACE_FENTRY, .success = false, + }, + { + .prog = "fexit_test1", .target = "bpf_testmod_test_struct_arg_2", + .attach_type = BPF_TRACE_FEXIT, .success = true, + }, + { + .prog = "fexit_test1", .target = "bpf_testmod_test_struct_arg_3", + .attach_type = BPF_TRACE_FEXIT, .success = true, + }, + { + .prog = "fexit_test1", .target = "bpf_testmod_test_struct_arg_4", + .attach_type = BPF_TRACE_FEXIT, .success = false, + }, + { + .prog = "fexit_test2", .target = "bpf_testmod_test_struct_arg_10", + .attach_type = BPF_TRACE_FEXIT, .success = false, + }, + { + .prog = "fexit_test2", .target = "bpf_testmod_test_struct_arg_11", + .attach_type = BPF_TRACE_FEXIT, .success = false, + }, + { + .prog = "fexit_test2", .target = "bpf_testmod_test_struct_arg_12", + .attach_type = BPF_TRACE_FEXIT, .success = true, + }, + { + .prog = "fmod_ret_test1", .target = "bpf_modify_return_test2", + .attach_type = BPF_MODIFY_RETURN, .success = true, + }, +}; + +static int do_test_item(struct tracing_multi_test *skel, struct test_item *item) +{ + LIBBPF_OPTS(bpf_link_create_opts, link_opts); + struct bpf_program *prog; + int err, btf_fd = 0, btf_type_id; + + err = libbpf_find_kernel_btf_id(item->target, item->attach_type, + &btf_fd, &btf_type_id); + if (!ASSERT_OK(err, "find_vmlinux_btf_id")) + return -1; + + link_opts.target_btf_id = btf_type_id; + prog = bpf_object__find_program_by_name(skel->obj, item->prog); + if (!ASSERT_OK_PTR(prog, "find_program_by_name")) + return -1; + + err = bpf_link_create(bpf_program__fd(prog), btf_fd, item->attach_type, + &link_opts); + item->link_fd = err; + if (item->success) { + if (!ASSERT_GE(err, 0, "link_create")) + return -1; + } else { + if (!ASSERT_LT(err, 0, "link_create")) + return -1; + } + + return 0; +} + +void test_tracing_multi_attach(void) +{ + struct tracing_multi_test *skel; + int i = 0, err, fd; + + skel = tracing_multi_test__open_and_load(); + if (!ASSERT_OK_PTR(skel, "tracing_multi_test__open_and_load")) + return; + + err = tracing_multi_test__attach(skel); + if (!ASSERT_OK(err, "tracing_multi_test__attach")) + goto destroy_skel; + + for (; i < ARRAY_SIZE(test_items); i++) { + if (do_test_item(skel, &test_items[i])) + break; + } + + for (i = 0; i < ARRAY_SIZE(test_items); i++) { + fd = test_items[i].link_fd; + if (fd >= 0) + close(fd); + } + + tracing_multi_test__detach(skel); +destroy_skel: + tracing_multi_test__destroy(skel); +} diff --git a/tools/testing/selftests/bpf/progs/tracing_multi_test.c b/tools/testing/selftests/bpf/progs/tracing_multi_test.c new file mode 100644 index 000000000000..f1ca8b64ed16 --- /dev/null +++ b/tools/testing/selftests/bpf/progs/tracing_multi_test.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2024 ByteDance */ +#include +#include +#include + +char _license[] SEC("license") = "GPL"; + +struct bpf_testmod_struct_arg_1 { + int a; +}; +struct bpf_testmod_struct_arg_2 { + long a; + long b; +}; + +__u64 fentry_test1_result = 0; +SEC("fentry/bpf_testmod_test_struct_arg_1") +int BPF_PROG2(fentry_test1, struct bpf_testmod_struct_arg_2, a) +{ + fentry_test1_result = a.a + a.b; + return 0; +} + +__u64 fentry_test2_result = 0; +SEC("fentry/bpf_testmod_test_struct_arg_2") +int BPF_PROG2(fentry_test2, int, a, struct bpf_testmod_struct_arg_2, b) +{ + fentry_test2_result = a + b.a + b.b; + return 0; +} + +__u64 fentry_test3_result = 0; +SEC("fentry/bpf_testmod_test_arg_ptr_2") +int BPF_PROG(fentry_test3, struct bpf_testmod_struct_arg_2 *a) +{ + fentry_test3_result = a->a + a->b; + return 0; +} + +__u64 fentry_test4_result = 0; +SEC("fentry/bpf_testmod_test_struct_arg_1") +int BPF_PROG2(fentry_test4, struct bpf_testmod_struct_arg_2, a, int, b, + int, c) +{ + fentry_test3_result = c; + return 0; +} + +__u64 fexit_test1_result = 0; +SEC("fexit/bpf_testmod_test_struct_arg_1") +int BPF_PROG2(fexit_test1, struct bpf_testmod_struct_arg_2, a, int, b, + int, c, int, retval) +{ + fexit_test1_result = retval; + return 0; +} + +__u64 fexit_test2_result = 0; +SEC("fexit/bpf_testmod_test_struct_arg_2") +int BPF_PROG2(fexit_test2, int, a, struct bpf_testmod_struct_arg_2, b, + int, c, int, retval) +{ + fexit_test2_result = a + b.a + b.b + retval; + return 0; +} + +SEC("fmod_ret/bpf_modify_return_test") +int BPF_PROG(fmod_ret_test1, int a, int *b) +{ + return 0; +}