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 9B8C3C77B75 for ; Tue, 16 May 2023 04:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbjEPEcE (ORCPT ); Tue, 16 May 2023 00:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjEPEcA (ORCPT ); Tue, 16 May 2023 00:32:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D344A3A9D; Mon, 15 May 2023 21:31:59 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 53397622E3; Tue, 16 May 2023 04:31:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F23A2C433D2; Tue, 16 May 2023 04:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684211518; bh=e4YAJmKsuD89fgedecS6L/gt/qymF1Yj4L5b7+rCXs8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tqHQrw0aEtEuGx1eXuk9tcITR9fU9OjaNSphg+HVldMiiiS6fOw/r8e+o1eKPTWFL bvmWKNuX4yGRFSVIzBXBO197YEK+mXJIkgs2XfHE9Ye8SxvxRmZE69pjcZvDJCh3Si CXX5raEHLtUI06ZEdO/Kg3X8o7Pyq62kIAAWUwe76RbDXm2arQ/7rDZke2XnA4xz7K yRwPuZpuAYjfcMhN4EhxbhFzZZ/SPSDvrQgJ6andW7doIvygO1zh+j26pj/WYUQXjI epzXKh+LFDWZDB2gT0CLNRJ7GPH4hgQjWqkrNpYYoUE6cM7DN9KgU4oTkYy1v1jgfv Ku3d9x2uXeWCw== Date: Tue, 16 May 2023 13:31:53 +0900 From: Masami Hiramatsu (Google) To: Steven Rostedt Cc: Yonghong Song , Ze Gao , Jiri Olsa , Song Liu , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Masami Hiramatsu , Ze Gao , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH] bpf: reject blacklisted symbols in kprobe_multi to avoid recursive trap Message-Id: <20230516133153.9627751457e0050159f077ab@kernel.org> In-Reply-To: <20230513001757.75ae0d1b@rorschach.local.home> References: <20230510122045.2259-1-zegao@tencent.com> <6308b8e0-8a54-e574-a312-0a97cfbf810c@meta.com> <20230513001757.75ae0d1b@rorschach.local.home> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 13 May 2023 00:17:57 -0400 Steven Rostedt wrote: > On Fri, 12 May 2023 07:29:02 -0700 > Yonghong Song wrote: > > > A fprobe_blacklist might make sense indeed as fprobe and kprobe are > > quite different... Thanks for working on this. > > Hmm, I think I see the problem: > > fprobe_kprobe_handler() { > kprobe_busy_begin() { > preempt_disable() { > preempt_count_add() { <-- trace > fprobe_kprobe_handler() { > [ wash, rinse, repeat, CRASH!!! ] > > Either the kprobe_busy_begin() needs to use preempt_disable_notrace() > versions, or fprobe_kprobe_handle() needs a > ftrace_test_recursion_trylock() call. Oops, I got it. Is preempt_count_add() tracable? If so, kprobe_busy_begin() should be updated. Thanks, > > -- Steve -- Masami Hiramatsu (Google)