diff mbox series

[1/8] bpf: Add missing annotations for __bpf_prog_enter() and __bpf_prog_exit()

Message ID 20200311010908.42366-2-jbi.octave@gmail.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series Lock warning cleanups | expand

Commit Message

Jules Irenge March 11, 2020, 1:09 a.m. UTC
Sparse reports a warning at __bpf_prog_enter() and __bpf_prog_exit()

warning: context imbalance in __bpf_prog_enter() - wrong count at exit
warning: context imbalance in __bpf_prog_exit() - unexpected unlock

The root cause is the missing annotation at __bpf_prog_enter()
and __bpf_prog_exit()

Add the missing __acquires(RCU) annotation
Add the missing __releases(RCU) annotation

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/bpf/trampoline.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel Borkmann March 13, 2020, 7:49 p.m. UTC | #1
On 3/11/20 2:09 AM, Jules Irenge wrote:
> Sparse reports a warning at __bpf_prog_enter() and __bpf_prog_exit()
> 
> warning: context imbalance in __bpf_prog_enter() - wrong count at exit
> warning: context imbalance in __bpf_prog_exit() - unexpected unlock
> 
> The root cause is the missing annotation at __bpf_prog_enter()
> and __bpf_prog_exit()
> 
> Add the missing __acquires(RCU) annotation
> Add the missing __releases(RCU) annotation
> 
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>

Applied this one to bpf-next, thanks!
diff mbox series

Patch

diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 6b264a92064b..09bce10ad1cc 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -374,6 +374,7 @@  void bpf_trampoline_put(struct bpf_trampoline *tr)
  * call __bpf_prog_exit
  */
 u64 notrace __bpf_prog_enter(void)
+	__acquires(RCU)
 {
 	u64 start = 0;
 
@@ -385,6 +386,7 @@  u64 notrace __bpf_prog_enter(void)
 }
 
 void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start)
+	__releases(RCU)
 {
 	struct bpf_prog_stats *stats;