* Re: [PATCH] bpf: mark get_entry_ip as __maybe_unused
[not found] <20221103150303.974028-1-rabenstein@cs.fau.de>
@ 2022-11-03 15:32 ` Jonas Rabenstein
2022-11-04 23:03 ` Daniel Borkmann
2022-11-07 8:56 ` Greg KH
0 siblings, 2 replies; 6+ messages in thread
From: Jonas Rabenstein @ 2022-11-03 15:32 UTC (permalink / raw)
To: stable
Cc: Jiri Olsa, Song Liu, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Steven Rostedt,
Masami Hiramatsu, bpf, linux-kernel
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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpf: mark get_entry_ip as __maybe_unused
2022-11-03 15:32 ` [PATCH] bpf: mark get_entry_ip as __maybe_unused Jonas Rabenstein
@ 2022-11-04 23:03 ` Daniel Borkmann
2022-11-07 8:56 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2022-11-04 23:03 UTC (permalink / raw)
To: Jonas Rabenstein, stable
Cc: Jiri Olsa, Song Liu, Alexei Starovoitov, Andrii Nakryiko,
Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh,
Stanislav Fomichev, Hao Luo, Steven Rostedt, Masami Hiramatsu,
bpf, linux-kernel, gregkh
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
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpf: mark get_entry_ip as __maybe_unused
2022-11-03 15:32 ` [PATCH] bpf: mark get_entry_ip as __maybe_unused Jonas Rabenstein
2022-11-04 23:03 ` Daniel Borkmann
@ 2022-11-07 8:56 ` Greg KH
2022-11-07 9:29 ` Greg KH
1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-11-07 8:56 UTC (permalink / raw)
To: Jonas Rabenstein
Cc: stable, Jiri Olsa, Song Liu, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Steven Rostedt,
Masami Hiramatsu, bpf, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpf: mark get_entry_ip as __maybe_unused
2022-11-07 8:56 ` Greg KH
@ 2022-11-07 9:29 ` Greg KH
2022-11-07 9:48 ` Jonas Rabenstein
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-11-07 9:29 UTC (permalink / raw)
To: Jonas Rabenstein
Cc: stable, Jiri Olsa, Song Liu, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Steven Rostedt,
Masami Hiramatsu, bpf, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpf: mark get_entry_ip as __maybe_unused
2022-11-07 9:29 ` Greg KH
@ 2022-11-07 9:48 ` Jonas Rabenstein
2022-11-07 9:51 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Jonas Rabenstein @ 2022-11-07 9:48 UTC (permalink / raw)
To: Greg KH
Cc: stable, Jiri Olsa, Song Liu, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Steven Rostedt,
Masami Hiramatsu, bpf, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpf: mark get_entry_ip as __maybe_unused
2022-11-07 9:48 ` Jonas Rabenstein
@ 2022-11-07 9:51 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2022-11-07 9:51 UTC (permalink / raw)
To: Jonas Rabenstein
Cc: stable, Jiri Olsa, Song Liu, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Steven Rostedt,
Masami Hiramatsu, bpf, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-07 9:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221103150303.974028-1-rabenstein@cs.fau.de>
2022-11-03 15:32 ` [PATCH] bpf: mark get_entry_ip as __maybe_unused Jonas Rabenstein
2022-11-04 23:03 ` Daniel Borkmann
2022-11-07 8:56 ` Greg KH
2022-11-07 9:29 ` Greg KH
2022-11-07 9:48 ` Jonas Rabenstein
2022-11-07 9:51 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox