From patchwork Tue Aug 30 17:27:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Marchevsky X-Patchwork-Id: 12959627 X-Patchwork-Delegate: bpf@iogearbox.net 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 AEEF8ECAAA1 for ; Tue, 30 Aug 2022 17:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbiH3Rgb (ORCPT ); Tue, 30 Aug 2022 13:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231866AbiH3RgG (ORCPT ); Tue, 30 Aug 2022 13:36:06 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7209163B4E for ; Tue, 30 Aug 2022 10:32:44 -0700 (PDT) Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27UG2Hxw010065 for ; Tue, 30 Aug 2022 10:31:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=wCvW/O2CjKKP6QQJwp4qzYhnTiB7xx+PP49P3exZYb4=; b=NfWlK1DnShkPY12VbZ/NH/TpGkThXP1L57RR5Xhj31jZsJig9639sSOmDRGYF8tod1Xj P9DZ7/qbe4myaRGBL8NCNGqObftMRJlDqE5PxrlTazxVVOJ2d2hGx/AnadXdZow4W5V5 350bLDvYXOeTOS5Y3cBA6gXnsYeYupvW9Sk= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3j94gye2dm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 30 Aug 2022 10:31:23 -0700 Received: from twshared25017.14.frc2.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 10:31:22 -0700 Received: by devbig077.ldc1.facebook.com (Postfix, from userid 158236) id CB421CAD07AA; Tue, 30 Aug 2022 10:28:10 -0700 (PDT) From: Dave Marchevsky To: CC: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Kernel Team , Dave Marchevsky Subject: [RFCv2 PATCH bpf-next 18/18] selftests/bpf: Rbtree static lock verification test changes Date: Tue, 30 Aug 2022 10:27:59 -0700 Message-ID: <20220830172759.4069786-19-davemarchevsky@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220830172759.4069786-1-davemarchevsky@fb.com> References: <20220830172759.4069786-1-davemarchevsky@fb.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: POZU6oMc1vCgKr2HIJO73IdMlppZflSi X-Proofpoint-GUID: POZU6oMc1vCgKr2HIJO73IdMlppZflSi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-30_10,2022-08-30_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net X-Patchwork-State: RFC These are test chagnes corresponding to commit "bpf: Check rbtree lock held during verification". They should be squashed with other test changes, but are left unsquashed as part of RFCv2 to ease tossing them piecemeal if associated functionality is dropped. Signed-off-by: Dave Marchevsky --- .../selftests/bpf/prog_tests/rbtree_map.c | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/rbtree_map.c b/tools/testing/selftests/bpf/prog_tests/rbtree_map.c index 7634a2d93f0b..07bc2780854c 100644 --- a/tools/testing/selftests/bpf/prog_tests/rbtree_map.c +++ b/tools/testing/selftests/bpf/prog_tests/rbtree_map.c @@ -19,6 +19,7 @@ static struct { {"rb_node__two_alloc_one_add", "Unreleased reference id=2 alloc_insn=3"}, {"rb_node__remove_no_free", "Unreleased reference id=6 alloc_insn=26"}, {"rb_tree__add_wrong_type", "rbtree: R2 is of type task_struct but node_data is expected"}, + {"add_node__no_lock", "lock associated with rbtree is not held"}, {"rb_tree__conditional_release_helper_usage", "R2 type=ptr_cond_rel_ expected=ptr_"}, }; @@ -96,37 +97,6 @@ void test_rbtree_map_alloc_node__size_too_small(void) rbtree_map_fail__destroy(skel); } -void test_rbtree_map_add_node__no_lock(void) -{ - struct rbtree_map_fail *skel; - struct bpf_program *prog; - struct bpf_link *link; - int err; - - skel = rbtree_map_fail__open(); - if (!ASSERT_OK_PTR(skel, "rbtree_map_fail__open")) - goto cleanup; - - prog = skel->progs.add_node__no_lock; - bpf_program__set_autoload(prog, true); - - err = rbtree_map_fail__load(skel); - if (!ASSERT_OK(err, "unexpected load fail")) - goto cleanup; - - link = bpf_program__attach(skel->progs.add_node__no_lock); - if (!ASSERT_OK_PTR(link, "link")) - goto cleanup; - - syscall(SYS_getpgid); - - ASSERT_EQ(skel->bss->no_lock_add__fail, 1, "alloc_fail"); - - bpf_link__destroy(link); -cleanup: - rbtree_map_fail__destroy(skel); -} - void test_rbtree_map_prog_load_fail(void) { int i;