From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68E62C433FE for ; Thu, 19 May 2022 00:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231201AbiESAEi (ORCPT ); Wed, 18 May 2022 20:04:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231428AbiESAEa (ORCPT ); Wed, 18 May 2022 20:04:30 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1972569CF7; Wed, 18 May 2022 17:04:29 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id p74so520025iod.8; Wed, 18 May 2022 17:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jyWLC75GTM+OTHBExj7bBZUgP6zoR7HVZUA3rF/6LlI=; b=ppAayLSgcNevwTq4JdA4LlNNtyQpBQ0oT0MQUE7It1ss0AUS9RKTpPTQOa7CF4rSjd Ejuf3FywE0soKmdyplCOwow6Mu9fakjkhDX/VlY/hpCxMNp5XnSVUoLUIpMIpvaAej1N hHt6cmBDsRe2qUZO/d1wmEXqtliGj8n1XfY1PXSTF5sG+dUl2EXLel1S/scILOEVu4m+ sGkGRtwMJdSe8X3ZtJK4JPNmqorzkc3cIsqQQrgUFd6rN65m0svo64FjUZQeShMdO36R pZI9MPxL4fqpd2P9rnSq81iX5X1dSl6kUhOPTQDE6eDkAQKf0lFTIpeQO+s8Z/YCFEMn eGvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jyWLC75GTM+OTHBExj7bBZUgP6zoR7HVZUA3rF/6LlI=; b=VI/hFrbFyGxt4IrLM6bUxnkfjQxzQ4XnEXtHglgXKf94GS+cKwgAOZ1DLIPu9ZxRdw LofAfkmlXFyCv+JGhUSahLikn2PjviWgcqYIZqwaFLaV+BAUYTM5+LxTuvqcZOaByDcN tiIfJiISePpZlDqIdm77x5kzx/rLvB0zBogzkiCuKD7xTBvbkx3Zv2rtP6oQo0qNT4Kh chm95ixEgMMownZB5VfZ/RaB49DnjtijCqWvLBPlHu6F1Sfni4hiu+Miq7iK5bU1yw1O yMuNN59MShnGOAsn8EiiW81WfSWR/cBcSa6DK1fHVOCvRgTQFTkamwJF6U0Ea1MweiLa RUBA== X-Gm-Message-State: AOAM532RbdVoHhxh5fO7xsT24A8uO6Ls3F3SKHlOYdevHSGkFb9TRPmp FGKw+k0vUxf5PW2CZrg1H672Stcv8KaGjPd/o8u0j3BlDEw= X-Google-Smtp-Source: ABdhPJxuxwX+Xic8wOUNmzSxm9GLSXsVqqKfAcXWhsKGK/I6cqAIOtENm9E/PsbarQNFvm0zvAgR99uHvCvTmfkJGgk= X-Received: by 2002:a05:6638:468e:b0:32b:fe5f:d73f with SMTP id bq14-20020a056638468e00b0032bfe5fd73fmr1209492jab.234.1652918668509; Wed, 18 May 2022 17:04:28 -0700 (PDT) MIME-Version: 1.0 References: <20220515063120.526063-1-ytcoode@gmail.com> In-Reply-To: <20220515063120.526063-1-ytcoode@gmail.com> From: Andrii Nakryiko Date: Wed, 18 May 2022 17:04:16 -0700 Message-ID: Subject: Re: [PATCH bpf-next] selftests/bpf: Add missing trampoline program type to trampoline_count test To: Yuntao Wang Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Yucong Sun , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Kui-Feng Lee , Jiri Olsa , Networking , bpf , open list , "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 14, 2022 at 11:31 PM Yuntao Wang wrote: > > Currently the trampoline_count test doesn't include any fmod_ret bpf > programs, fix it to make the test cover all possible trampoline program > types. > > Since fmod_ret bpf programs can't be attached to __set_task_comm function, > as it's neither whitelisted for error injection nor a security hook, change > it to bpf_modify_return_test. > > This patch also does some other cleanups such as removing duplicate code, > dropping inconsistent comments, etc. > > Signed-off-by: Yuntao Wang > --- > include/linux/bpf.h | 2 +- > .../bpf/prog_tests/trampoline_count.c | 121 ++++++------------ > .../bpf/progs/test_trampoline_count.c | 16 ++- > 3 files changed, 47 insertions(+), 92 deletions(-) > [...] > > /* with E2BIG error */ > - ASSERT_EQ(err, -E2BIG, "proper error check"); > + ASSERT_EQ(libbpf_get_error(link), -E2BIG, "E2BIG"); > ASSERT_EQ(link, NULL, "ptr_is_null"); > > - /* and finaly execute the probe */ > - if (CHECK_FAIL(prctl(PR_GET_NAME, comm, 0L, 0L, 0L))) > - goto cleanup_extra; > - CHECK_FAIL(test_task_rename()); we stopped testing that kernel function actually can be called properly, why don't you do bpf_prog_test_run() here to trigger bpf_modify_return_test in kernel? > - CHECK_FAIL(prctl(PR_SET_NAME, comm, 0L, 0L, 0L)); > - > -cleanup_extra: > - bpf_object__close(obj); > cleanup: > - if (i >= MAX_TRAMP_PROGS) > - i = MAX_TRAMP_PROGS - 1; > for (; i >= 0; i--) { > - bpf_link__destroy(inst[i].link_fentry); > - bpf_link__destroy(inst[i].link_fexit); > + bpf_link__destroy(inst[i].link); > bpf_object__close(inst[i].obj); > } > } [...]