bpf: Convert queue_stack map to rqspinlock
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Thu, 10 Apr 2025 15:31:42 +0000 (08:31 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 10 Apr 2025 19:51:10 +0000 (12:51 -0700)
commit2f41503d647629cfafea42cf6f827e4139536703
treea358232751e16230b804094cfeb38b43ec5411d7
parent92b90f780d056a28f3c751c2dfbcd9540c7ae28a
bpf: Convert queue_stack map to rqspinlock

Replace all usage of raw_spinlock_t in queue_stack_maps.c with
rqspinlock. This is a map type with a set of open syzbot reports
reproducing possible deadlocks. Prior attempt to fix the issues
was at [0], but was dropped in favor of this approach.

Make sure we return the -EBUSY error in case of possible deadlocks or
timeouts, just to make sure user space or BPF programs relying on the
error code to detect problems do not break.

With these changes, the map should be safe to access in any context,
including NMIs.

  [0]: https://lore.kernel.org/all/20240429165658.1305969-1-sidchintamaneni@gmail.com

Reported-by: syzbot+8bdfc2c53fb2b63e1871@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/0000000000004c3fc90615f37756@google.com
Reported-by: syzbot+252bc5c744d0bba917e1@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/000000000000c80abd0616517df9@google.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20250410153142.2064340-1-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/queue_stack_maps.c