Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp473609imn; Fri, 29 Jul 2022 12:47:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vAUCqHTCrxeC6FZfkp1DR9nqd7EJLCyGer+W4K+bi73dgsXUNrUPbhoCDW5hMI6h+qmrHv X-Received: by 2002:a63:db54:0:b0:419:698f:fce0 with SMTP id x20-20020a63db54000000b00419698ffce0mr4049871pgi.424.1659124029592; Fri, 29 Jul 2022 12:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659124029; cv=none; d=google.com; s=arc-20160816; b=aabYqvJfuAt4qSbnfFM90L6RG46RC5ytbGcgzF/6D3HoE422jfXm5Vp7GKT5H1j423 tEiHqQMSHDQ7G3gAuplYZjRZwq0h4R37JjUODVeecLolsKhULdZWV9ARCmi5xYzA8qrF /P2/8/rKTdZnYwylEnjOejpfAp5Tln3406AfabS/LUuqKSCx605UbYgfadoeq7mJktP2 bnNBPpdN3o2zvQsuMVN1U9NpO2iArmvSnrdVWkxI8Qz5kzqthSE5AW6Szpca5j5Y9ych B7kQ3sKuy9MebWmCwCvDhuAAKiL2wxi0m7b6iIhR9Vx6zOofy2LBqpgCOEPJ6GMbBiDd 38pg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=sNUapoHb5YVt59N4T/2+jVBHjKI9EXIQ2JiPEDN8e+s=; b=jhrzaaLdP01Gsh29Hm1NiYXdSPV4mWE5kPTu5qp1YX6pYCkBbfovNpm0dLzsjiUJPF POX9k0EXFQ2RKH29e4d62XIEBNsND/txvRgZYILn0Neaxh5+Q6dJAiPiS0t81CC9mi/m G86oRlWkCj2GJfxbXps4XKYcvHIRiSDU2TWODkh8tCcq6KM4fAHrs1pYwvHLuodQmZ8G d5QyOLyURd3eXB85mVSd08ODGXRrw7F/lMP6lVK9oPYH8aNE9w2eJaw0MX00IOQkykgm 5IBrjoY6EtEgLpxmQoe2OyJdS80kdZON6zEScUhO8e3E9ASEvMPssEYVsLpDlcPzYpFn m1cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a634453000000b00415c3d1136csi5518125pgk.409.2022.07.29.12.46.54; Fri, 29 Jul 2022 12:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238577AbiG2ToO (ORCPT + 99 others); Fri, 29 Jul 2022 15:44:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237659AbiG2ToM (ORCPT ); Fri, 29 Jul 2022 15:44:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303D978DF4; Fri, 29 Jul 2022 12:44:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEEB4B82958; Fri, 29 Jul 2022 19:44:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27BC0C433D6; Fri, 29 Jul 2022 19:44:08 +0000 (UTC) Date: Fri, 29 Jul 2022 15:43:57 -0400 From: Steven Rostedt To: Song Liu Cc: , , , , , , Andrii Nakryiko Subject: Re: [PATCH bpf-next] bpf: fix test_progs -j error with fentry/fexit tests Message-ID: <20220729154357.12cfea5f@rorschach.local.home> In-Reply-To: <20220729194106.1207472-1-song@kernel.org> References: <20220729194106.1207472-1-song@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Jul 2022 12:41:06 -0700 Song Liu wrote: > Then multiple threads are attaching/detaching fentry/fexit programs to "When multiple threads"? -- Steve > the same trampoline, we may call register_fentry on the same trampoline > twice: register_fentry(), unregister_fentry(), then register_fentry again. > This causes ftrace_set_filter_ip() for the same ip on tr->fops twice, > which leaves duplicated ip in tr->fops. The extra ip is not cleaned up > properly on unregister and thus causes failures with further register in > register_ftrace_direct_multi(): > > register_ftrace_direct_multi() > { > ... > for (i = 0; i < size; i++) { > hlist_for_each_entry(entry, &hash->buckets[i], hlist) { > if (ftrace_find_rec_direct(entry->ip)) > goto out_unlock; > } > } > ... > } > > This can be triggered with parallel fentry/fexit tests with test_progs: > > ./test_progs -t fentry,fexit -j > > Fix this by resetting tr->fops in ftrace_set_filter_ip(), so that there > will never be duplicated entries in tr->fops. >