Skip to contentSkip to conversation

pull-request: bpf 2022-03-29

PATCH Applied Alexei Starovoitov 5 participants 13 messages Mar 29, 2022 – Mar 31, 2022

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

Please consider pulling these changes from:

git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git

Thanks a lot!

Also thanks to reporters, reviewers and testers of commits in this pull-request:

Arnaldo Carvalho de Melo, Dan Carpenter, Jiri Olsa, kernel test robot, KP Singh, Martin KaFai Lau, Masami Hiramatsu, Quentin Monnet, Yonghong Song

----------------------------------------------------------------

The following changes since commit d717e4cae0fe77e10a27e8545a967b8c379873ac:

Merge tag 'net-5.18-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (2022-03-28 17:02:04 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git

for you to fetch changes up to ccaff3d56acc47c257a99b2807b7c78a9467cf09:

selftests/bpf: Fix clang compilation errors (2022-03-28 20:00:11 -0700)

----------------------------------------------------------------
Alexei Starovoitov (3):
Merge branch 'fprobe: Fixes for Sparse and Smatch warnings'
Merge branch 'kprobes: rethook: x86: Replace kretprobe trampoline with rethook' Merge branch 'xsk: another round of fixes'

Andrii Nakryiko (1):
selftests/bpf: fix selftest after random: Urandom_read tracepoint removal

Geliang Tang (1):
bpf: Sync comments for bpf_get_stack

Jiri Olsa (1):
bpftool: Fix generated code in codegen_asserts

Maciej Fijalkowski (2):
ice: xsk: Stop Rx processing when ntc catches ntu
ice: xsk: Fix indexing in ice_tx_xsk_pool()

Magnus Karlsson (2):
xsk: Do not write NULL in SW ring at allocation failure
ice: xsk: Eliminate unnecessary loop iteration

Masami Hiramatsu (5):
fprobe: Fix smatch type mismatch warning
fprobe: Fix sparse warning for acccessing __rcu ftrace_hash
kprobes: Use rethook for kretprobe if possible x86,rethook,kprobes: Replace kretprobe with rethook on x86 x86,kprobes: Fix optprobe trampoline to generate complete pt_regs

Milan Landaverde (1):
bpf/bpftool: Add unprivileged_bpf_disabled check against value of 2

Peter Zijlstra (1):
x86,rethook: Fix arch_rethook_trampoline() to generate a complete pt_regs

Yonghong Song (1):
selftests/bpf: Fix clang compilation errors

Yuntao Wang (1):
bpf: Fix maximum permitted number of arguments check

 arch/Kconfig                                       |   8 +-
 arch/x86/Kconfig                                   |   1 +
 arch/x86/include/asm/unwind.h                      |  23 ++--
 arch/x86/kernel/Makefile                           |   1 +
 arch/x86/kernel/kprobes/common.h                   |   1 +
 arch/x86/kernel/kprobes/core.c                     | 107 -----------------
 arch/x86/kernel/kprobes/opt.c                      |  25 ++--
 arch/x86/kernel/rethook.c                          | 127 +++++++++++++++++++++
 arch/x86/kernel/unwind_orc.c                       |  10 +-
 drivers/net/ethernet/intel/ice/ice.h               |   2 +-
 drivers/net/ethernet/intel/ice/ice_xsk.c           |   5 +-
 include/linux/kprobes.h                            |  51 ++++++++-
 kernel/Makefile                                    |   1 +
 kernel/bpf/btf.c                                   |   2 +-
 kernel/kprobes.c                                   | 124 ++++++++++++++++----
 kernel/trace/fprobe.c                              |   8 +-
 kernel/trace/trace_kprobe.c                        |   4 +-
 net/xdp/xsk_buff_pool.c                            |   8 +-
 tools/bpf/bpftool/feature.c                        |   5 +-
 tools/bpf/bpftool/gen.c                            |   2 +-
 tools/include/uapi/linux/bpf.h                     |   8 +-
 .../selftests/bpf/prog_tests/get_stack_raw_tp.c    |   3 -
 .../selftests/bpf/progs/test_stacktrace_build_id.c |  12 +-
 tools/testing/selftests/bpf/test_lpm_map.c         |   3 +-
 24 files changed, 354 insertions(+), 187 deletions(-)
 create mode 100644 arch/x86/kernel/rethook.c
maintainer
#1 lore raw
Quoted 7 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

Quoted 7 lines

The main changes are:

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Looks like this should be a WRITE_ONCE() ?

And the __user annotations in bpf_trace.c are still not right, first arg of kprobe_multi_resolve_syms() should __user:

kernel/trace/bpf_trace.c:2370:34: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2370:34: expected void const [noderef] __user *from
kernel/trace/bpf_trace.c:2370:34: got void const *usyms
kernel/trace/bpf_trace.c:2376:51: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2376:51: expected char const [noderef] __user *src
kernel/trace/bpf_trace.c:2376:51: got char const *
kernel/trace/bpf_trace.c:2443:49: warning: incorrect type in argument 1 (different address spaces)
kernel/trace/bpf_trace.c:2443:49: expected void const *usyms
kernel/trace/bpf_trace.c:2443:49: got void [noderef] __user *[assigned] usyms

How do you wanna proceed?

#2 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 4 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

Quoted 8 lines

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Quoted 12 lines

And the __user annotations in bpf_trace.c are still not right, first arg of kprobe_multi_resolve_syms() should __user:

kernel/trace/bpf_trace.c:2370:34: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2370:34: expected void const [noderef] __user *from
kernel/trace/bpf_trace.c:2370:34: got void const *usyms
kernel/trace/bpf_trace.c:2376:51: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2376:51: expected char const [noderef] __user *src
kernel/trace/bpf_trace.c:2376:51: got char const *
kernel/trace/bpf_trace.c:2443:49: warning: incorrect type in argument 1 (different address spaces)
kernel/trace/bpf_trace.c:2443:49: expected void const *usyms
kernel/trace/bpf_trace.c:2443:49: got void [noderef] __user *[assigned] usyms

This one is known. Still waiting for the fix from Jiri.

Quoted 1 line

How do you wanna proceed?

If they both are old I would proceed.
I don't consider sparse warnings as a blocker in general.

maintainer
#3 lore raw
Quoted 13 lines · On Tue, 29 Mar 2022 18:51:22 -0700 Alexei Starovoitov wrote:
Quoted 12 lines · Jakub Kicinski
Quoted 11 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Erm, you're right. No idea how the build bot can generate a warning that's present on both source and target branch :S I'll look into that while the my local build runs...

maintainer
#4 lore raw
In reply to Alexei Starovoitov
Quoted 34 lines · On Tue, 29 Mar 2022 18:51:22 -0700 Alexei Starovoitov…
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 11 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Quoted 3 lines
Quoted 1 line

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Yeah, I think we should make this rcu pointer (and read side must use rcu_dereference()) because this rh->handler becomes the key to disable this rethook.
Let me fix that.

Thanks,

Signature · 1 line
Masami Hiramatsu <[email protected]>
maintainer
#5 lore raw
Quoted 37 lines · On Wed, 30 Mar 2022 13:52:17 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 34 lines · On Tue, 29 Mar 2022 18:51:22 -0700 Alexei Starovoitov…
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 11 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Yeah, I think we should make this rcu pointer (and read side must use rcu_dereference()) because this rh->handler becomes the key to disable this rethook.
Let me fix that.

Sorry, please ignore this. Since the handler pointed by rh->handler never be removed (unless removed by modules, but this will not happen while the rethook is running), YES, WRITE_ONCE() is enough.
Please add below.

From 92c9c784458f03900823360981812220ce3c7bf3 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <[email protected]>
Date: Wed, 30 Mar 2022 18:13:42 +0900
Subject: [PATCH] rethook: Fix to use WRITE_ONCE() for rethook::handler

Since the function pointered by rethook::handler never be removed when the rethook is alive, it doesn't need to use rcu_assign_pointer() to update it. Just use WRITE_ONCE().

---
 kernel/trace/rethook.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/rethook.c +1 -1
index ab463a4d2b23..b56833700d23 100644
@@ -65,7 +65,7 @@ static void rethook_free_rcu(struct rcu_head *head)
  */
 void rethook_free(struct rethook *rh)
 {
-	rcu_assign_pointer(rh->handler, NULL);
+	WRITE_ONCE(rh->handler, NULL);
 
 	call_rcu(&rh->rcu, rethook_free_rcu);
 }
Signature · 3 lines
2.25.1
-- 
Masami Hiramatsu <[email protected]>
#6 lore raw
Quoted 59 lines · Masami Hiramatsu
Quoted 37 lines · On Wed, 30 Mar 2022 13:52:17 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 34 lines · On Tue, 29 Mar 2022 18:51:22 -0700 Alexei Starovoitov…
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 11 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Yeah, I think we should make this rcu pointer (and read side must use rcu_dereference()) because this rh->handler becomes the key to disable this rethook.
Let me fix that.

Sorry, please ignore this. Since the handler pointed by rh->handler never be removed (unless removed by modules, but this will not happen while the rethook is running), YES, WRITE_ONCE() is enough.
Please add below.

From 92c9c784458f03900823360981812220ce3c7bf3 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <[email protected]>
Date: Wed, 30 Mar 2022 18:13:42 +0900
Subject: [PATCH] rethook: Fix to use WRITE_ONCE() for rethook::handler

Quoted 6 lines

Since the function pointered by rethook::handler never be removed when the rethook is alive, it doesn't need to use rcu_assign_pointer() to update it. Just use WRITE_ONCE().

Could you please send it as a proper patch so it registers in patchwork?

Quoted 21 lines
---
 kernel/trace/rethook.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/rethook.c +1 -2
index ab463a4d2b23..b56833700d23 100644
@@ -65,7 +65,7 @@ static void rethook_free_rcu(struct rcu_head *head)
  */
 void rethook_free(struct rethook *rh)
 {
-       rcu_assign_pointer(rh->handler, NULL);
+       WRITE_ONCE(rh->handler, NULL);
 
        call_rcu(&rh->rcu, rethook_free_rcu);
 }
--

2.25.1
--
Masami Hiramatsu <[email protected]>

maintainer
#7 lore raw

PATCH 1/1 rethook: Fix to use WRITE_ONCE() for rethook::handler

Since the function pointered by rethook::handler never be removed when the rethook is alive, it doesn't need to use rcu_assign_pointer() to update it. Just use WRITE_ONCE().

---
 kernel/trace/rethook.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/rethook.c +1 -1
index ab463a4d2b23..b56833700d23 100644
@@ -65,7 +65,7 @@ static void rethook_free_rcu(struct rcu_head *head)
  */
 void rethook_free(struct rethook *rh)
 {
-	rcu_assign_pointer(rh->handler, NULL);
+	WRITE_ONCE(rh->handler, NULL);
 
 	call_rcu(&rh->rcu, rethook_free_rcu);
 }
#8 lore raw

Re: [PATCH bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler

This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:

Quoted 8 lines · On Thu, 31 Mar 2022 10:11:17 +0900 you wrote:

Since the function pointered by rethook::handler never be removed when the rethook is alive, it doesn't need to use rcu_assign_pointer() to update it. Just use WRITE_ONCE().

[...]

Here is the summary with links:
- [bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler

    https://git.kernel.org/bpf/bpf/c/a2fb49833cad

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer
#9 lore raw
In reply to Alexei Starovoitov
Quoted 60 lines · On Wed, 30 Mar 2022 08:09:59 -0700 Alexei Starovoitov…
Quoted 59 lines · Masami Hiramatsu
Quoted 37 lines · On Wed, 30 Mar 2022 13:52:17 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 34 lines · On Tue, 29 Mar 2022 18:51:22 -0700 Alexei Starovoitov…
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 11 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Yeah, I think we should make this rcu pointer (and read side must use rcu_dereference()) because this rh->handler becomes the key to disable this rethook.
Let me fix that.

Sorry, please ignore this. Since the handler pointed by rh->handler never be removed (unless removed by modules, but this will not happen while the rethook is running), YES, WRITE_ONCE() is enough.
Please add below.

From 92c9c784458f03900823360981812220ce3c7bf3 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <[email protected]>
Date: Wed, 30 Mar 2022 18:13:42 +0900
Subject: [PATCH] rethook: Fix to use WRITE_ONCE() for rethook::handler

Quoted 8 lines
Quoted 6 lines

Since the function pointered by rethook::handler never be removed when the rethook is alive, it doesn't need to use rcu_assign_pointer() to update it. Just use WRITE_ONCE().

Could you please send it as a proper patch so it registers in patchwork?

Sure, I sent the patch. BTW, I marked it as "bpf" instead of "bpf-next", was that OK? (It seems bpf-next was not updated yet)

Thank you,

Quoted 22 lines
Quoted 22 lines
---
 kernel/trace/rethook.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/rethook.c +1 -2
index ab463a4d2b23..b56833700d23 100644
@@ -65,7 +65,7 @@ static void rethook_free_rcu(struct rcu_head *head)
  */
 void rethook_free(struct rethook *rh)
 {
-       rcu_assign_pointer(rh->handler, NULL);
+       WRITE_ONCE(rh->handler, NULL);
 
        call_rcu(&rh->rcu, rethook_free_rcu);
 }
--

2.25.1
--
Masami Hiramatsu <[email protected]>

Signature · 1 line
Masami Hiramatsu <[email protected]>
#10 lore raw
In reply to Alexei Starovoitov
Quoted 51 lines · Alexei Starovoitov
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 4 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

Quoted 8 lines

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Quoted 12 lines

And the __user annotations in bpf_trace.c are still not right, first arg of kprobe_multi_resolve_syms() should __user:

kernel/trace/bpf_trace.c:2370:34: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2370:34: expected void const [noderef] __user *from
kernel/trace/bpf_trace.c:2370:34: got void const *usyms
kernel/trace/bpf_trace.c:2376:51: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2376:51: expected char const [noderef] __user *src
kernel/trace/bpf_trace.c:2376:51: got char const *
kernel/trace/bpf_trace.c:2443:49: warning: incorrect type in argument 1 (different address spaces)
kernel/trace/bpf_trace.c:2443:49: expected void const *usyms
kernel/trace/bpf_trace.c:2443:49: got void [noderef] __user *[assigned] usyms

Quoted 1 line

This one is known. Still waiting for the fix from Jiri.

right, I replied that for some reason I can't see these warnings with 'make C=2' and latest sparse.. how do you run that?

if patch below fixes it for you, I can send formal patch quickly

jirka

---

kernel/trace/bpf_trace.c +2 -2
index d8553f46caa2..7fa2ebc07f60 100644
@@ -2349,11 +2349,11 @@ kprobe_multi_link_handler(struct fprobe *fp, unsigned long entry_ip,
 }
 
 static int
-kprobe_multi_resolve_syms(const void __user *usyms, u32 cnt,
+kprobe_multi_resolve_syms(const void *usyms, u32 cnt,
 			  unsigned long *addrs)
 {
 	unsigned long addr, size;
-	const char __user **syms;
+	const char **syms;
 	int err = -ENOMEM;
 	unsigned int i;
 	char *func;
#11 lore raw
Quoted 52 lines · Jiri Olsa
Quoted 51 lines · Alexei Starovoitov
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 29 Mar 2022 16:49:24 -0700 Alexei Starovoitov wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

Quoted 8 lines
Quoted 5 lines

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

There are some new sparse warnings here that look semi-legit. As in harmless but not erroneous.

Both are new warnings and not due to these patches, right?

Quoted 4 lines

kernel/trace/rethook.c:68:9: error: incompatible types in comparison expression (different address spaces):
kernel/trace/rethook.c:68:9: void ( [noderef] __rcu * )( ... )
kernel/trace/rethook.c:68:9: void ( * )( ... )

Quoted 8 lines

66 void rethook_free(struct rethook *rh)
67 {
68 rcu_assign_pointer(rh->handler, NULL);
69
70 call_rcu(&rh->rcu, rethook_free_rcu);
71 }

Looks like this should be a WRITE_ONCE() ?

Masami, please take a look.

Quoted 12 lines

And the __user annotations in bpf_trace.c are still not right, first arg of kprobe_multi_resolve_syms() should __user:

kernel/trace/bpf_trace.c:2370:34: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2370:34: expected void const [noderef] __user *from
kernel/trace/bpf_trace.c:2370:34: got void const *usyms
kernel/trace/bpf_trace.c:2376:51: warning: incorrect type in argument 2 (different address spaces)
kernel/trace/bpf_trace.c:2376:51: expected char const [noderef] __user *src
kernel/trace/bpf_trace.c:2376:51: got char const *
kernel/trace/bpf_trace.c:2443:49: warning: incorrect type in argument 1 (different address spaces)
kernel/trace/bpf_trace.c:2443:49: expected void const *usyms
kernel/trace/bpf_trace.c:2443:49: got void [noderef] __user *[assigned] usyms

Quoted 6 lines
Quoted 1 line

This one is known. Still waiting for the fix from Jiri.

right, I replied that for some reason I can't see these warnings with 'make C=2' and latest sparse.. how do you run that?

if patch below fixes it for you, I can send formal patch quickly

ok, I was on top of bpf-next/master where it's still reverted, I can hit that on bpf/master, I'll send the fix

jirka

#12 lore raw
In reply to Alexei Starovoitov
This pull request was applied to bpf/bpf.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This pull request was applied to bpf/bpf.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 29 Mar 2022 16:49:24 -0700 you wrote:

Hi David, hi Jakub,

The following pull-request contains BPF updates for your *net* tree.

We've added 16 non-merge commits during the last 1 day(s) which contain a total of 24 files changed, 354 insertions(+), 187 deletions(-).

[...]

Here is the summary with links:
- pull-request: bpf 2022-03-29

    https://git.kernel.org/bpf/bpf/c/77c9387c0c5b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html