Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp162930rwd; Mon, 15 May 2023 22:19:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xyxN43lqCTQLnCWwDnT/FJvDmCH9KU9oSkvLsHPhWGXwcmBMT+VS8sJEYBZfwNDNDHZC5 X-Received: by 2002:a17:902:a583:b0:1aa:f818:7a23 with SMTP id az3-20020a170902a58300b001aaf8187a23mr37977053plb.27.1684214373578; Mon, 15 May 2023 22:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684214373; cv=none; d=google.com; s=arc-20160816; b=PRGqgVB0swVhOYlb4iWbqsy+NPx6EctGABqO6/afufwfvJGp8u1mGaYM4K7FfrM0lv 2brLJgybijnQBN/XqGjTSsJW5iRiD5BgC/5XJCMSCue58t+QY1/BpeaWKEYNuiZ21rzQ n5wZIB0iA1TcRulBu8N0ryYmsxLL3z8My/oW6pc5yLHM5wdK2t4/wNk78++kZ+WQmSwi LvW+VBwUyUkEaRl3f/qp3doFpVWULi1WRW6faI7IBIDHclDJc3CAN/iGXJJo2eKv9gr/ baZCrSwYJjIOJaHzdacJLmWFVpTSF49bjBbWFAPgcomc86LvCAVY1YbNXfzF+2fWqLrZ Kn2A== 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 :dkim-signature; bh=FqXuzfPPfNPi8dknhQvqrBqRenr+iD7bwWzmb83XdCI=; b=RTG0YtgK6PGsodzMBc+i+ggykB3tyV+tUJ8ne9ZoRA8vpO3lOqHcp0BI15kSBp8Frg CGI9iZPlOkcQplx5/TwSDobHoELp4eJ0/3vxqtwVAuw1XBbSV9svzv1op4v0yotat+nU AZjnA7g2fh67bGpjc8Poes0SVbR2ohoPcSvATUsdPsC+o3E/PzsjSVrYpzA1etpBLR8Q spzvPGQv5xUu5vIdNQcpe/l9b7D3dCau53c7lAX6O5VySFNHi8S3vRCA17Ll3CESiZ+L VhWIuDbH07X+T52WGX4Nw22/BfftIZ54jNQbk2wU2AGJIZCbkjoXhHfrfGAnFv5jNX8g Sx2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y2iQpsFI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a170902ec8f00b001ac8daed841si19288396plg.646.2023.05.15.22.19.13; Mon, 15 May 2023 22:19:33 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y2iQpsFI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbjEPFKg (ORCPT + 99 others); Tue, 16 May 2023 01:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjEPFKe (ORCPT ); Tue, 16 May 2023 01:10:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1779173A; Mon, 15 May 2023 22:10:33 -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 735406298D; Tue, 16 May 2023 05:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B7F8C433EF; Tue, 16 May 2023 05:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684213832; bh=u8Y2f4n10KnprdRg9KnWZid4H6uSUjozETMEXBKEsbY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Y2iQpsFIET1oRKmwR8Jo+fs/oUtNa1g3ar6V/YM9cpNrB3twVL8Vn4xNBd0JN0aVs 53vqNLhRsiFc8EI6xwZuTZzJqmwJQ8XG20/K7ZfPnncSaORAND10oAcO8I9oRu1qeg kwQXLVgZRRwRfGNJXBY+xMLY2mZ0LWZnCFIF7BvOBy/duUaJx4KPpLdf1Gnd9foN0T pl5X+7mfqNzx+GgKP0n6h/O4rnBdyFMV04iJLaHSrUM5LDTnhI7IoTNue4nPlLjfEO 2NkAt6bV6sb+ujrfQmBI51PVh3UGMJP2XbIav1KiXHZAT4WvF9UlS2MxzNBn3rPi+f 5wqtxb/KTjSkA== Date: Tue, 16 May 2023 14:10:28 +0900 From: Masami Hiramatsu (Google) To: Masami Hiramatsu (Google) Cc: Steven Rostedt , 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 , 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: <20230516141028.d3a9cb541bf1b7ef0deb79c3@kernel.org> In-Reply-To: <20230516133153.9627751457e0050159f077ab@kernel.org> References: <20230510122045.2259-1-zegao@tencent.com> <6308b8e0-8a54-e574-a312-0a97cfbf810c@meta.com> <20230513001757.75ae0d1b@rorschach.local.home> <20230516133153.9627751457e0050159f077ab@kernel.org> 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 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tue, 16 May 2023 13:31:53 +0900 Masami Hiramatsu (Google) wrote: > 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. OK, preempt_count_add() is NOKPROBE_SYMBOL() so kprobe_busy_begin() should be safe. The problem is in fprobe_kprobe_handler() then. Thanks! > > Thanks, > > > > > -- Steve > > > -- > Masami Hiramatsu (Google) -- Masami Hiramatsu (Google)