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 1F53FC54EE9 for ; Sun, 25 Sep 2022 05:43:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbiIYFnC (ORCPT ); Sun, 25 Sep 2022 01:43:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbiIYFnB (ORCPT ); Sun, 25 Sep 2022 01:43:01 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57ED7371AB for ; Sat, 24 Sep 2022 22:42:58 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 7E83932002FB; Sun, 25 Sep 2022 01:42:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 25 Sep 2022 01:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1664084574; x= 1664170974; bh=gYryFmyVF7gCXfKNyj9KELei4TL2jsft5OoKQKaEgW4=; b=l J9GwGxrZ8ouTR1IZvV3X7qYo8BRn/UNopck6lyzHxSMivwp63hlvCjZk2S0n01iR PCZNUdpYcYaQtQxVrvi9KDt0e1qsAhcve8ZFDfdBwPTaE7iPLaFEiGxBHfTTSqQj epu2MiC6mFULC/ku1CKa+iOWk0gF0tDB6X+z51nVVhuZ/fxZqLExVxe7pege6/0v 5As3RiNAsbpf1CQ9vZL4ExWxFW4CRuzcISL3DLU3LAB54mDyyPLyYHEft+1xqeYl wG3lycShp/PRbn4kMrvoiOkMCUJuY7PHee+wLS269AKxLkBZhMFptBDP9aeuD6Na nE4bxrpCIJbl8CUbbF1eQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefledgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeforghr thihnhgrshcurfhumhhpuhhtihhsuceomheslhgrmhgsuggrrdhltheqnecuggftrfgrth htvghrnhepvdevledtteevfeehleetteelvdehteegjefhvdefgfdukeejfeefffeigeeh veetnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmsehlrghmsggurgdrlhht X-ME-Proxy: Feedback-ID: i215944fb:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 25 Sep 2022 01:42:50 -0400 (EDT) Message-ID: <0e1742f8-06ea-1c69-d245-e3202a751f42@lambda.lt> Date: Sun, 25 Sep 2022 07:42:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCHv4 bpf-next 5/6] bpf: Return value in kprobe get_func_ip only for entry address Content-Language: en-US To: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , "Masami Hiramatsu (Google)" , Peter Zijlstra References: <20220922210320.1076658-1-jolsa@kernel.org> <20220922210320.1076658-6-jolsa@kernel.org> From: Martynas Pumputis In-Reply-To: <20220922210320.1076658-6-jolsa@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 9/22/22 23:03, Jiri Olsa wrote: > Changing return value of kprobe's version of bpf_get_func_ip > to return zero if the attach address is not on the function's > entry point. > > For kprobes attached in the middle of the function we can't easily > get to the function address especially now with the CONFIG_X86_KERNEL_IBT > support. > > If user cares about current IP for kprobes attached within the > function body, they can get it with PT_REGS_IP(ctx). > > Suggested-by: Andrii Nakryiko > Signed-off-by: Jiri Olsa Tested the patches with "pwru --filter-func='.*skb.*' --filter-dst-ip=1.1.1.1" from [1] - the symbol name resolution works, thanks! Without your patches: SKB CPU PROCESS FUNC 0xffff8989c159b4e8 0 [curl] 0xffffffffbbb06164 0xffff8989c223f000 0 [curl] 0xffffffffbbb07534 0xffff8989c223f000 0 [curl] 0xffffffffbbb04934 0xffff8989c223f000 0 [curl] skb_release_data 0xffff8989c223f000 0 [curl] kfree_skbmem 0xffff8989c159b4e8 0 [curl] 0xffffffffbbb00db4 [..] With patches: SKB CPU PROCESS FUNC 0xffffa4564159b4e8 0 [curl] validate_xmit_skb_list 0xffffa4564159b4e8 0 [curl] netif_skb_features 0xffffa4564159b4e8 0 [curl] skb_network_protocol 0xffffa4564159b4e8 0 [curl] skb_csum_hwoffload_help 0xffffa4564159b4e8 0 [curl] skb_checksum_help 0xffffa4564159b4e8 0 [curl] skb_ensure_writable 0xffffa4564159b4e8 0 [curl] skb_to_sgvec [..] [1]: https://github.com/cilium/pwru/tree/test-ibt-kernel-fix Acked-by: Martynas Pumputis > --- > kernel/trace/bpf_trace.c | 5 ++++- > tools/testing/selftests/bpf/progs/get_func_ip_test.c | 4 ++-- > 2 files changed, 6 insertions(+), 3 deletions(-) [..]