Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp28391pxm; Fri, 4 Mar 2022 15:15:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJybzhAWV12Ynhbh1eycpGNmKDzf8o8t8hlrdjfq8YhGiC5Csvr8ZXtSJRHUuA8Wz3MUH9PZ X-Received: by 2002:a17:906:57c1:b0:6d6:da73:e9c0 with SMTP id u1-20020a17090657c100b006d6da73e9c0mr844464ejr.45.1646435735411; Fri, 04 Mar 2022 15:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646435735; cv=none; d=google.com; s=arc-20160816; b=FHdBlHRqBz5Oj4gtSKSyR9qIRPA2lVI8rDnThRV26aQayRkGBrvlCF1865ugfMrTEL 7+wZscE6ISWp9nA7U5ZxzOaPmBW5eIQE2M9rCAIRdsYBFJs7DFI1lQ5QAc/dMzVYywh9 q1wZ+bGhCTgHSuWy9pM/iQ5uHxgfYmbN3//R0cJIRqZFj7rDLbQFu51j4in1MRcHm5tF mfxbVLSc+XINS48TkgwV1AZZo97su7ptUCfHx76zDpfoK2RIbhKpXm+XLZR5OPK8qLum dJefOj6lo1whgsl+R0D3mkcg5+vLUpbB4H0RE4ihXgLeLnW1JIYNYUi6x37yqgK3MZF8 REwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VAvKzeYnxXBW8o7T9AcJhCsgopHLVla6a/Nzr9AT0sQ=; b=egOtEZIfcrbP+Ry9wRulSXcgPkT8tBf6rcc6gbLuVcrRpQ1NCf1yC51P6Wu9DfU35a PO5QFLTqxIA5aNK0CnGg+cKtVluRLLTR3lSRUHRFa66DAUfnOHvd10H6UAAde7xkY1DD /It2H8YccblHbCexQj88tYku6150s7cHSvX/fsUD42V/uNIqiRLy6MonBdXC95Tppszk EwDyvtxiNzSnMBkaCGCvoeYlFdPjYKL+p1OBQrP4c0NZcFSD2oeku4r1ISwpgzZcKqJj jY1Dr1Tx/3FF1j6deh/Yr+seGIRnIsFuO7jGfA1DVzSEHOJGBY9egkQ//EbzegD0iKQt usHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DSU8iX5x; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg34-20020a170907a42200b006dabf3e1880si1980567ejc.942.2022.03.04.15.15.13; Fri, 04 Mar 2022 15:15:35 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=DSU8iX5x; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbiCDXMI (ORCPT + 99 others); Fri, 4 Mar 2022 18:12:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiCDXME (ORCPT ); Fri, 4 Mar 2022 18:12:04 -0500 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A09A827B8E0; Fri, 4 Mar 2022 15:11:16 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id c18so11194094ioc.6; Fri, 04 Mar 2022 15:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VAvKzeYnxXBW8o7T9AcJhCsgopHLVla6a/Nzr9AT0sQ=; b=DSU8iX5xO0fY1YHgI4wc5SlCNf2hoeUUW3Rrjp2nw4clDE7sahe9htPmcgIlbeEyjW OrTIYnfCLrJMGiNx75G0QF6f5cHxx//Xp6oS5TP6PgwFhdyv20P4u5XmQ+iHtGYH0B5w Pj/rGw10j22x9BYvyBazT7x7sr3Go3xWDJ+6gwxCafYnz58sZALTrme2Yb6Ff+Q/MxxN /hRyoPFpgBH1bNdvgYzYF1QDEi/x5Nu7n744jOtIFa0ItYpFXKiPHFG8DqJWdYmDSQ5l qMHjGda6cy/MQIlfwyTuLeqMKxiVph91yt9frf6xjR/AQuR+AvvVsB75FJPfaPQp3XP9 t/Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VAvKzeYnxXBW8o7T9AcJhCsgopHLVla6a/Nzr9AT0sQ=; b=oJ5tzpWHqURF6XY1LNv6T/iogDycf/VDed7OzNPGFRd0UAGRETSDMzUKHPRov9iPra gT1HfXoq6jYtaYuEXWMNRmS2GnoshV3Xn7lAz8TQZM+yrpPoC5WMCVOKKKmmvFSrvJbD GPlIvoPZsSlmFUHXy6W+yadbxzShGbUcgbNFg/M00gjb1cn08Q5o1wEAgPI3X/dh7Jpk tp3855SpuosJKA960sw/82vHt2COtpzlS5Jn2Yge0QANjFoe1Er3uMF8c5Lbba6Qytjo X7MuOeIsLl7p28utyiyYu+tcNXbdTz+6cBi0HVbFsJSL88DquEkvzvfHDQwZe6diBw0W 6j8Q== X-Gm-Message-State: AOAM531ZsU4P5Z+ASilEyPXfgv09lzH9d2crkDn59HMRYsfukF2OAiFY 1GfbckIDCKUP3gDn7UpHvnrDGWI/i4PxF04xfJRDYIA0h48= X-Received: by 2002:a05:6638:382:b0:30e:3e2e:3227 with SMTP id y2-20020a056638038200b0030e3e2e3227mr764583jap.234.1646435476096; Fri, 04 Mar 2022 15:11:16 -0800 (PST) MIME-Version: 1.0 References: <20220222170600.611515-1-jolsa@kernel.org> <20220222170600.611515-4-jolsa@kernel.org> In-Reply-To: <20220222170600.611515-4-jolsa@kernel.org> From: Andrii Nakryiko Date: Fri, 4 Mar 2022 15:11:05 -0800 Message-ID: Subject: Re: [PATCH 03/10] bpf: Add bpf_get_func_ip kprobe helper for multi kprobe link To: Jiri Olsa Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , Networking , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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, Feb 22, 2022 at 9:06 AM Jiri Olsa wrote: > > Adding support to call bpf_get_func_ip helper from kprobe > programs attached by multi kprobe link. > > Signed-off-by: Jiri Olsa > --- LGTM. Acked-by: Andrii Nakryiko > kernel/trace/bpf_trace.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index df3771bfd6e5..64891b7b0885 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -1037,6 +1037,18 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_kprobe = { > .arg1_type = ARG_PTR_TO_CTX, > }; > > +BPF_CALL_1(bpf_get_func_ip_kprobe_multi, struct pt_regs *, regs) > +{ > + return instruction_pointer(regs); > +} > + > +static const struct bpf_func_proto bpf_get_func_ip_proto_kprobe_multi = { > + .func = bpf_get_func_ip_kprobe_multi, > + .gpl_only = false, > + .ret_type = RET_INTEGER, > + .arg1_type = ARG_PTR_TO_CTX, > +}; > + > BPF_CALL_1(bpf_get_attach_cookie_trace, void *, ctx) > { > struct bpf_trace_run_ctx *run_ctx; > @@ -1280,7 +1292,9 @@ kprobe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) > return &bpf_override_return_proto; > #endif > case BPF_FUNC_get_func_ip: > - return &bpf_get_func_ip_proto_kprobe; > + return prog->expected_attach_type == BPF_TRACE_KPROBE_MULTI ? > + &bpf_get_func_ip_proto_kprobe_multi : > + &bpf_get_func_ip_proto_kprobe; > case BPF_FUNC_get_attach_cookie: > return &bpf_get_attach_cookie_proto_trace; > default: > -- > 2.35.1 >