Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: Add missing annotations for __bpf_prog_enter() and __bpf_prog_exit()

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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200311010908.42366-2-jbi.octave@gmail.com

authored by

Jules Irenge and committed by
Daniel Borkmann
dcce11d5 5996a587

+2
+2
kernel/bpf/trampoline.c
··· 352 352 * call __bpf_prog_exit 353 353 */ 354 354 u64 notrace __bpf_prog_enter(void) 355 + __acquires(RCU) 355 356 { 356 357 u64 start = 0; 357 358 ··· 364 363 } 365 364 366 365 void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start) 366 + __releases(RCU) 367 367 { 368 368 struct bpf_prog_stats *stats; 369 369