Message ID | 20221103150303.974028-1-rabenstein@cs.fau.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp592183wru; Thu, 3 Nov 2022 08:12:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qsLMFAfolwXKdeBiB2Uc8I+wN3SdfU2ALAhKugUYFRgvOzKr20B1nARsyCvWUnzn1O8v6 X-Received: by 2002:a17:906:7212:b0:7ad:bd4b:c41f with SMTP id m18-20020a170906721200b007adbd4bc41fmr26112703ejk.659.1667488351124; Thu, 03 Nov 2022 08:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667488351; cv=none; d=google.com; s=arc-20160816; b=mMvO6L7WvlDQFNmQ+yDXHzFK+2UraQVyOnTxLVzaM/NOOdrbUVPNuKWf6vifuOZ3BJ GbPJPIlHvaruVsa4+gRCGaR5wF0ozp+d2mQ3kgARQ6Ou9PGBw8uuCG7A5rYe2lo4oy05 s3ty0KK/uQCMhv6U9G9c1ys5w/G6sWMaQA5UBbfkC+2E/2OWpawrpk+VYNowUqEIad7Q 4AfRRVLdcatxodOdz+7lk3BoTGFXjz+CIcMh1m0npE59nlr9PO5LSM96XIRqi5U9q0rn j2AIQ9JTI2oeCNI0cDmbT6pjXxpeIS2OjvsEE4XwWtlCJ+oTkbyxHKcIdLbHifms+UHQ igkg== 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 :message-id:date:subject:cc:to:from; bh=5OCJ/Vz1ywptO4t5UzbUakHxue5584YJ41H1cxSQ9lY=; b=MsjLsc9A/YKic3JZ56MaeX+wvo6fhfpnvqJcBM8678xNUh+dPc9ZUeW2xjoJnwq2ZC bu681H/JnsD6Xhqqegtoj3i193Kxcdox2pWerPstI2HTrNknN2TGR/LMFzHrZHCgGHWw dxm7hWsHCP1PzNcJaAds/ZhQx67KShueg+JvVxK5mrkmlgYjbiDW3pJ+h4KWolH6h+yO 7CXY1IQYPaoS+hDdhWDQCzptNsgilF1GMOs6yonZ3HXZwdpNFWqTOKsUhtuS/35Gwo4y JGImeI6qdeXpHvMjEq3z21fuR+NGMFPqhM9SpJKkQCUbggiTqnVigcebiY54rj95v5O7 Im/Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fe12-20020a056402390c00b004619253a760si1367900edb.312.2022.11.03.08.12.05; Thu, 03 Nov 2022 08:12:31 -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 S232136AbiKCPLM (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 11:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231866AbiKCPKk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 11:10:40 -0400 X-Greylist: delayed 378 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 03 Nov 2022 08:09:48 PDT Received: from mx-rz-1.rrze.uni-erlangen.de (mx-rz-1.rrze.uni-erlangen.de [IPv6:2001:638:a000:1025::14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00E6310FC5; Thu, 3 Nov 2022 08:09:48 -0700 (PDT) Received: from mx-rz-smart.rrze.uni-erlangen.de (mx-rz-smart.rrze.uni-erlangen.de [IPv6:2001:638:a000:1025::1e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mx-rz-1.rrze.uni-erlangen.de (Postfix) with ESMTPS id 4N36TC5rTFz8svY; Thu, 3 Nov 2022 16:03:27 +0100 (CET) Authentication-Results: mx-rz-1.rrze.uni-erlangen.de; dkim=none; dkim-atps=neutral X-Virus-Scanned: amavisd-new at boeck5.rrze.uni-erlangen.de (RRZE) X-RRZE-Flag: Not-Spam X-RRZE-Submit-IP: 10.188.34.179 Received: from uni-erlangen.de (i4laptop28.informatik.uni-erlangen.de [10.188.34.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: U2FsdGVkX18CxjfIGbKY7LqpaFakzBHDNDrAmmghoCk=) by smtp-auth.uni-erlangen.de (Postfix) with ESMTPSA id 4N36T92D2Lz8sgp; Thu, 3 Nov 2022 16:03:25 +0100 (CET) From: Jonas Rabenstein <rabenstein@cs.fau.de> To: Jiri Olsa <jolsa@kernel.org> Cc: Jonas Rabenstein <rabenstein@cs.fau.de>, Song Liu <song@kernel.org>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev>, Yonghong Song <yhs@fb.com>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>, Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] bpf: mark get_entry_ip as __maybe_unused Date: Thu, 3 Nov 2022 16:03:03 +0100 Message-Id: <20221103150303.974028-1-rabenstein@cs.fau.de> X-Mailer: git-send-email 2.37.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748488265195823507?= X-GMAIL-MSGID: =?utf-8?q?1748488265195823507?= |
Series |
bpf: mark get_entry_ip as __maybe_unused
|
|
Commit Message
Jonas Rabenstein
Nov. 3, 2022, 3:03 p.m. UTC
Commit c09eb2e578eb1668bbc ("bpf: Adjust kprobe_multi entry_ip
for CONFIG_X86_KERNEL_IBT") introduced the get_entry_ip() function.
Depending on CONFIG_X86_KERNEL_IBT it is a static function or only
a macro definition. The only user of this symbol so far is in
kprobe_multi_link_handler() if CONFIG_FPROBE is enabled.
If CONFIG_FROBE is not set, the symbol is not used and - depending
on CONFIG_X86_KERNEL_IBT - a warning for get_entry_ip() is emitted.
To solve this, the function should be marked as __maybe_unused.
Signed-off-by: Jonas Rabenstein <rabenstein@cs.fau.de>
---
kernel/trace/bpf_trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi again, after sending this out, I noticed this is only a problem in the stable versions (starting from v6.0.3), as c09eb2e578eb1668bbc has been applied (as 03f148c159a250dd454) but not 0e253f7e558a3e250902 ("bpf: Return value in kprobe get_func_ip only for entry address") which makes always use of get_entry_ip. I therefore think, 0e253f7e558a3e250902 needs to be added to the stable v6.0 series as well as otherwise it can't be compiled with -Werror if CONFIG_X6_KERNEL_IBT is set but CONFIG_FPROBE isn't. - Jonas On Thu, Nov 03, 2022 at 04:03:03PM +0100, Jonas Rabenstein wrote: > Commit c09eb2e578eb1668bbc ("bpf: Adjust kprobe_multi entry_ip > for CONFIG_X86_KERNEL_IBT") introduced the get_entry_ip() function. > Depending on CONFIG_X86_KERNEL_IBT it is a static function or only > a macro definition. The only user of this symbol so far is in > kprobe_multi_link_handler() if CONFIG_FPROBE is enabled. > If CONFIG_FROBE is not set, the symbol is not used and - depending > on CONFIG_X86_KERNEL_IBT - a warning for get_entry_ip() is emitted. > To solve this, the function should be marked as __maybe_unused. > > Signed-off-by: Jonas Rabenstein <rabenstein@cs.fau.de> > --- > kernel/trace/bpf_trace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index f2d8d070d024..19131aae0bc3 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -1032,7 +1032,7 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { > }; > > #ifdef CONFIG_X86_KERNEL_IBT > -static unsigned long get_entry_ip(unsigned long fentry_ip) > +static unsigned long __maybe_unused get_entry_ip(unsigned long fentry_ip) > { > u32 instr; > > -- > 2.37.4 >
On 11/3/22 4:32 PM, Jonas Rabenstein wrote: > Hi again, > after sending this out, I noticed this is only a problem in the stable > versions (starting from v6.0.3), as c09eb2e578eb1668bbc has been applied (as > 03f148c159a250dd454) but not 0e253f7e558a3e250902 ("bpf: Return value in kprobe > get_func_ip only for entry address") which makes always use of get_entry_ip. > I therefore think, 0e253f7e558a3e250902 needs to be added to the stable v6.0 > series as well as otherwise it can't be compiled with -Werror if > CONFIG_X6_KERNEL_IBT is set but CONFIG_FPROBE isn't. Thanks for the info, Jonas. Added Greg wrt stable cherry-pick. > On Thu, Nov 03, 2022 at 04:03:03PM +0100, Jonas Rabenstein wrote: >> Commit c09eb2e578eb1668bbc ("bpf: Adjust kprobe_multi entry_ip >> for CONFIG_X86_KERNEL_IBT") introduced the get_entry_ip() function. >> Depending on CONFIG_X86_KERNEL_IBT it is a static function or only >> a macro definition. The only user of this symbol so far is in >> kprobe_multi_link_handler() if CONFIG_FPROBE is enabled. >> If CONFIG_FROBE is not set, the symbol is not used and - depending >> on CONFIG_X86_KERNEL_IBT - a warning for get_entry_ip() is emitted. >> To solve this, the function should be marked as __maybe_unused. >> >> Signed-off-by: Jonas Rabenstein <rabenstein@cs.fau.de> >> --- >> kernel/trace/bpf_trace.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c >> index f2d8d070d024..19131aae0bc3 100644 >> --- a/kernel/trace/bpf_trace.c >> +++ b/kernel/trace/bpf_trace.c >> @@ -1032,7 +1032,7 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { >> }; >> >> #ifdef CONFIG_X86_KERNEL_IBT >> -static unsigned long get_entry_ip(unsigned long fentry_ip) >> +static unsigned long __maybe_unused get_entry_ip(unsigned long fentry_ip) >> { >> u32 instr; >> >> -- >> 2.37.4 >>
On Thu, Nov 03, 2022 at 04:32:47PM +0100, Jonas Rabenstein wrote: > Hi again, > after sending this out, I noticed this is only a problem in the stable > versions (starting from v6.0.3), as c09eb2e578eb1668bbc has been applied (as > 03f148c159a250dd454) but not 0e253f7e558a3e250902 ("bpf: Return value in kprobe > get_func_ip only for entry address") which makes always use of get_entry_ip. > I therefore think, 0e253f7e558a3e250902 needs to be added to the stable v6.0 > series as well as otherwise it can't be compiled with -Werror if > CONFIG_X6_KERNEL_IBT is set but CONFIG_FPROBE isn't. Ok, now queued up, thanks. greg k-h
On Mon, Nov 07, 2022 at 09:56:42AM +0100, Greg KH wrote: > On Thu, Nov 03, 2022 at 04:32:47PM +0100, Jonas Rabenstein wrote: > > Hi again, > > after sending this out, I noticed this is only a problem in the stable > > versions (starting from v6.0.3), as c09eb2e578eb1668bbc has been applied (as > > 03f148c159a250dd454) but not 0e253f7e558a3e250902 ("bpf: Return value in kprobe > > get_func_ip only for entry address") which makes always use of get_entry_ip. > > I therefore think, 0e253f7e558a3e250902 needs to be added to the stable v6.0 > > series as well as otherwise it can't be compiled with -Werror if > > CONFIG_X6_KERNEL_IBT is set but CONFIG_FPROBE isn't. > > Ok, now queued up, thanks. Oops, this breaks the build, now dropping. greg k-h
On Mon, Nov 07, 2022 at 10:29:55AM +0100, Greg KH wrote: > On Mon, Nov 07, 2022 at 09:56:42AM +0100, Greg KH wrote: > > On Thu, Nov 03, 2022 at 04:32:47PM +0100, Jonas Rabenstein wrote: > > > Hi again, > > > after sending this out, I noticed this is only a problem in the stable > > > versions (starting from v6.0.3), as c09eb2e578eb1668bbc has been applied (as > > > 03f148c159a250dd454) but not 0e253f7e558a3e250902 ("bpf: Return value in kprobe > > > get_func_ip only for entry address") which makes always use of get_entry_ip. > > > I therefore think, 0e253f7e558a3e250902 needs to be added to the stable v6.0 > > > series as well as otherwise it can't be compiled with -Werror if > > > CONFIG_X6_KERNEL_IBT is set but CONFIG_FPROBE isn't. > > > > Ok, now queued up, thanks. > > Oops, this breaks the build, now dropping. Sorry, 0e253f7e558a3e250902 ("bpf: Return value in kprobe get_func_ip only for entry address") uses the macro KPROBE_FLAG_ON_FUNC_ENTRY that was introduced in bf7a87f1075f67c286f7 ("kprobes: Add new KPROBE_FLAG_ON_FUNC_ENTRY kprobe flag"). Applying those on top of v6.0.7 fixes the original compilation problem (CONFIG_X6_KERNEL_IBT but !CONFIG_FPROBE) and should not break anything - jonas > > greg k-h
On Mon, Nov 07, 2022 at 10:48:49AM +0100, Jonas Rabenstein wrote: > On Mon, Nov 07, 2022 at 10:29:55AM +0100, Greg KH wrote: > > On Mon, Nov 07, 2022 at 09:56:42AM +0100, Greg KH wrote: > > > On Thu, Nov 03, 2022 at 04:32:47PM +0100, Jonas Rabenstein wrote: > > > > Hi again, > > > > after sending this out, I noticed this is only a problem in the stable > > > > versions (starting from v6.0.3), as c09eb2e578eb1668bbc has been applied (as > > > > 03f148c159a250dd454) but not 0e253f7e558a3e250902 ("bpf: Return value in kprobe > > > > get_func_ip only for entry address") which makes always use of get_entry_ip. > > > > I therefore think, 0e253f7e558a3e250902 needs to be added to the stable v6.0 > > > > series as well as otherwise it can't be compiled with -Werror if > > > > CONFIG_X6_KERNEL_IBT is set but CONFIG_FPROBE isn't. > > > > > > Ok, now queued up, thanks. > > > > Oops, this breaks the build, now dropping. > Sorry, 0e253f7e558a3e250902 ("bpf: Return value in kprobe get_func_ip only for > entry address") uses the macro KPROBE_FLAG_ON_FUNC_ENTRY that was introduced > in bf7a87f1075f67c286f7 ("kprobes: Add new KPROBE_FLAG_ON_FUNC_ENTRY kprobe > flag"). Applying those on top of v6.0.7 fixes the original compilation problem > (CONFIG_X6_KERNEL_IBT but !CONFIG_FPROBE) and should not break anything Please submit a set of backports that you have verified works properly so that I know it is correct. thanks, greg k-h
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index f2d8d070d024..19131aae0bc3 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1032,7 +1032,7 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { }; #ifdef CONFIG_X86_KERNEL_IBT -static unsigned long get_entry_ip(unsigned long fentry_ip) +static unsigned long __maybe_unused get_entry_ip(unsigned long fentry_ip) { u32 instr;