BPF Archive mirror
 help / color / mirror / Atom feed
* Re: WARNING in bpf_map_delete_elem
       [not found] <5c5936c9-f44c-45ba-920f-b07625b29071.bugreport@ubisectech.com>
@ 2024-04-29  4:05 ` Alexei Starovoitov
  0 siblings, 0 replies; only message in thread
From: Alexei Starovoitov @ 2024-04-29  4:05 UTC (permalink / raw
  To: Ubisectech Sirius, bpf; +Cc: security, ast, daniel, andrii

On Sun, Apr 28, 2024 at 6:12 PM Ubisectech Sirius
<bugreport@ubisectech.com> wrote:
>
> Hello.
> We are Ubisectech Sirius Team, the vulnerability lab of China ValiantSec. Recently, our team has discovered a issue in Linux kernel 6.7. Attached to the email were a PoC file of the issue.

This is not a vulnerability and not a security bug.
Cc-ing public bpf@vger list.

root triggering a warn at kernel/bpf/helpers.c:73
        WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_trace_held() &&
                     !rcu_read_lock_bh_held());
is just a bug,
and in this case it feels that it's a bug with your config,
since bpf_prog_test_run_syscall further down the stack does:
        rcu_read_lock_trace();
        retval = bpf_prog_run_pin_on_cpu(prog, ctx);
        rcu_read_unlock_trace();

so it shouldn't warn.

> Stack dump:
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 16824 at kernel/bpf/helpers.c:73 ____bpf_map_delete_elem kernel/bpf/helpers.c:73 [inline]
> WARNING: CPU: 0 PID: 16824 at kernel/bpf/helpers.c:73 bpf_map_delete_elem+0x94/0xb0 kernel/bpf/helpers.c:71
> Modules linked in:
> CPU: 0 PID: 16824 Comm: syz-executor.3 Not tainted 6.7.0 #2
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> RIP: 0010:____bpf_map_delete_elem kernel/bpf/helpers.c:73 [inline]
> RIP: 0010:bpf_map_delete_elem+0x94/0xb0 kernel/bpf/helpers.c:71
> Code: 89 ef 5b 5d 41 5c ff e0 cc 66 90 e8 66 04 e7 ff e8 a1 11 ce ff 31 ff 89 c3 89 c6 e8 f6 ff e6 ff 85 db 75 99 e8 4d 04 e7 ff 90 <0f> 0b 90 eb 8e 48 89 ef e8 3f bd 3d 00 eb a0 e8 38 bd 3d 00 eb b8
> RSP: 0018:ffffc90001ee7a90 EFLAGS: 00010212
> RAX: 0000000000000369 RBX: 0000000000000000 RCX: ffffc90011f07000
> RDX: 0000000000040000 RSI: ffffffff81a2f203 RDI: 0000000000000005
> RBP: ffff88801a226000 R08: 0000000000000005 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000000 R12: ffffc90001ee7b50
> R13: ffffffff81a2f170 R14: 0000000000000000 R15: 0000000000000000
> FS:  00007f1c460de640(0000) GS:ffff88802c600000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000001b2c923000 CR3: 0000000053eec000 CR4: 0000000000750ef0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> PKRU: 55555554
> Call Trace:
>  <TASK>
>  ___bpf_prog_run+0x335f/0x95e0 kernel/bpf/core.c:1962
>  __bpf_prog_run32+0x9d/0xe0 kernel/bpf/core.c:2201
>  bpf_dispatcher_nop_func include/linux/bpf.h:1196 [inline]
>  __bpf_prog_run include/linux/filter.h:651 [inline]
>  bpf_prog_run include/linux/filter.h:658 [inline]
>  bpf_prog_run_pin_on_cpu include/linux/filter.h:675 [inline]
>  bpf_prog_test_run_syscall+0x3b5/0x790 net/bpf/test_run.c:1496
>  bpf_prog_test_run kernel/bpf/syscall.c:4040 [inline]
>  __sys_bpf+0x1295/0x4e00 kernel/bpf/syscall.c:5401
>  __do_sys_bpf kernel/bpf/syscall.c:5487 [inline]
>  __se_sys_bpf kernel/bpf/syscall.c:5485 [inline]
>  __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5485
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0x43/0x120 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x6f/0x77
> RIP: 0033:0x7f1c4529002d
> Code: c3 e8 97 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f1c460de028 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
> RAX: ffffffffffffffda RBX: 00007f1c453cbf80 RCX: 00007f1c4529002d
> RDX: 000000000000000c RSI: 00000000200004c0 RDI: 000000000000000a
> RBP: 00007f1c452f14d0 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> R13: 000000000000000b R14: 00007f1c453cbf80 R15: 00007f1c460be000
>  </TASK>
>
> Thank you for taking the time to read this email and we look forward to working with you further.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-29  4:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5c5936c9-f44c-45ba-920f-b07625b29071.bugreport@ubisectech.com>
2024-04-29  4:05 ` WARNING in bpf_map_delete_elem Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).