public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
@ 2024-07-19  5:12 syzbot
  2024-07-19  8:11 ` Jesper Dangaard Brouer
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: syzbot @ 2024-07-19  5:12 UTC (permalink / raw)
  To: andrii, ast, bpf, daniel, davem, eddyz87, haoluo, hawk,
	john.fastabend, jolsa, kpsingh, kuba, linux-kernel, martin.lau,
	netdev, sdf, song, syzkaller-bugs, yonghong.song

Hello,

syzbot found the following issue on:

HEAD commit:    73399b58e5e5 Add linux-next specific files for 20240718
git tree:       linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=111f2195980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=54e443ddc2b981c8
dashboard link: https://syzkaller.appspot.com/bug?extid=707d98c8649695eaf329
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1602cf31980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=106fde5e980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/fbab059c854f/disk-73399b58.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/874a209f4c3f/vmlinux-73399b58.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f34e5c7be278/bzImage-73399b58.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+707d98c8649695eaf329@syzkaller.appspotmail.com

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in ./kernel/bpf/devmap.c:385:28
index 16 is out of range for type 'struct xdp_frame *[16]'
CPU: 1 UID: 0 PID: 5101 Comm: syz-executor232 Not tainted 6.10.0-next-20240718-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 ubsan_epilogue lib/ubsan.c:231 [inline]
 __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429
 bq_xmit_all+0x157/0x11d0 kernel/bpf/devmap.c:385
 __dev_flush+0x81/0x160 kernel/bpf/devmap.c:425
 xdp_do_check_flushed+0x129/0x240 net/core/filter.c:4300
 __napi_poll+0xe4/0x490 net/core/dev.c:6774
 napi_poll net/core/dev.c:6840 [inline]
 net_rx_action+0x89b/0x1240 net/core/dev.c:6962
 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
 common_interrupt+0xaa/0xd0 arch/x86/kernel/irq.c:278
 </IRQ>
 <TASK>
 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194
Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 ce cf 5c f6 f6 44 24 21 02 75 52 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> c3 69 c4 f5 65 8b 05 04 5f 65 74 85 c0 74 43 48 c7 04 24 0e 36
RSP: 0018:ffffc9000369fb60 EFLAGS: 00000206
RAX: 3e45100d05912800 RBX: 1ffff920006d3f70 RCX: ffffffff817023ea
RDX: dffffc0000000000 RSI: ffffffff8bcad5c0 RDI: 0000000000000001
RBP: ffffc9000369fbf0 R08: ffffffff9300f817 R09: 1ffffffff2601f02
R10: dffffc0000000000 R11: fffffbfff2601f03 R12: dffffc0000000000
R13: 1ffff920006d3f6c R14: ffffc9000369fb80 R15: 0000000000000246
 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
 do_notify_parent_cldstop+0x9ab/0xb50 kernel/signal.c:2216
 ptrace_stop+0x465/0x940 kernel/signal.c:2319
 ptrace_do_notify kernel/signal.c:2393 [inline]
 ptrace_notify+0x255/0x380 kernel/signal.c:2405
 ptrace_report_syscall include/linux/ptrace.h:415 [inline]
 ptrace_report_syscall_entry include/linux/ptrace.h:452 [inline]
 syscall_trace_enter+0x5d/0x150 kernel/entry/common.c:45
 syscall_enter_from_user_mode_work include/linux/entry-common.h:168 [inline]
 syscall_enter_from_user_mode include/linux/entry-common.h:198 [inline]
 do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f708ebe0e20
Code: ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 80 3d 81 e2 07 00 00 74 17 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c
RSP: 002b:00007ffd97b2a878 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 0000000000000015 RCX: 00007f708ebe0e20
RDX: ffffffffffffffb8 RSI: 0000000020000240 RDI: 0000000000000014
RBP: 0000000000000000 R08: 00007ffd97b2a9a8 R09: 00007ffd97b2a9a8
R10: 00007ffd97b2a9a8 R11: 0000000000000202 R12: 0000000000000000
R13: 0000000000000000 R14: 00007ffd97b2a8b0 R15: 00007ffd97b2a8a0
 </TASK>
---[ end trace ]---
----------------
Code disassembly (best guess):
   0:	9c                   	pushf
   1:	8f 44 24 20          	pop    0x20(%rsp)
   5:	42 80 3c 23 00       	cmpb   $0x0,(%rbx,%r12,1)
   a:	74 08                	je     0x14
   c:	4c 89 f7             	mov    %r14,%rdi
   f:	e8 ce cf 5c f6       	call   0xf65ccfe2
  14:	f6 44 24 21 02       	testb  $0x2,0x21(%rsp)
  19:	75 52                	jne    0x6d
  1b:	41 f7 c7 00 02 00 00 	test   $0x200,%r15d
  22:	74 01                	je     0x25
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 c3 69 c4 f5       	call   0xf5c469f2 <-- trapping instruction
  2f:	65 8b 05 04 5f 65 74 	mov    %gs:0x74655f04(%rip),%eax        # 0x74655f3a
  36:	85 c0                	test   %eax,%eax
  38:	74 43                	je     0x7d
  3a:	48                   	rex.W
  3b:	c7                   	.byte 0xc7
  3c:	04 24                	add    $0x24,%al
  3e:	0e                   	(bad)
  3f:	36                   	ss


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
@ 2024-07-19  8:11 ` Jesper Dangaard Brouer
  2024-07-20  9:15 ` syzbot
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Jesper Dangaard Brouer @ 2024-07-19  8:11 UTC (permalink / raw)
  To: syzbot, andrii, ast, bpf, daniel, davem, eddyz87, haoluo,
	john.fastabend, jolsa, kpsingh, kuba, linux-kernel, martin.lau,
	netdev, sdf, song, syzkaller-bugs, yonghong.song,
	Sebastian Andrzej Siewior



On 19/07/2024 07.12, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    73399b58e5e5 Add linux-next specific files for 20240718
> git tree:       linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=111f2195980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=54e443ddc2b981c8
> dashboard link: https://syzkaller.appspot.com/bug?extid=707d98c8649695eaf329
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1602cf31980000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=106fde5e980000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/fbab059c854f/disk-73399b58.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/874a209f4c3f/vmlinux-73399b58.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/f34e5c7be278/bzImage-73399b58.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+707d98c8649695eaf329@syzkaller.appspotmail.com
> 
> ------------[ cut here ]------------
> UBSAN: array-index-out-of-bounds in ./kernel/bpf/devmap.c:385:28
> index 16 is out of range for type 'struct xdp_frame *[16]'
> CPU: 1 UID: 0 PID: 5101 Comm: syz-executor232 Not tainted 6.10.0-next-20240718-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
> Call Trace:
>   <IRQ>
>   __dump_stack lib/dump_stack.c:94 [inline]
>   dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
>   ubsan_epilogue lib/ubsan.c:231 [inline]
>   __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429
>   bq_xmit_all+0x157/0x11d0 kernel/bpf/devmap.c:385
>   __dev_flush+0x81/0x160 kernel/bpf/devmap.c:425
>   xdp_do_check_flushed+0x129/0x240 net/core/filter.c:4300

When xdp_do_check_flushed() calls __dev_flush(), this indicate that some 
driver didn't call xdp_do_flush() after NAPI finished.

What NIC device driver is this tested on?

--Jesper

>   __napi_poll+0xe4/0x490 net/core/dev.c:6774
>   napi_poll net/core/dev.c:6840 [inline]
>   net_rx_action+0x89b/0x1240 net/core/dev.c:6962
>   handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
>   __do_softirq kernel/softirq.c:588 [inline]
>   invoke_softirq kernel/softirq.c:428 [inline]
>   __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
>   irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
>   common_interrupt+0xaa/0xd0 arch/x86/kernel/irq.c:278
>   </IRQ>
>   <TASK>
>   asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
> RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
> RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194
> Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 ce cf 5c f6 f6 44 24 21 02 75 52 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> c3 69 c4 f5 65 8b 05 04 5f 65 74 85 c0 74 43 48 c7 04 24 0e 36
> RSP: 0018:ffffc9000369fb60 EFLAGS: 00000206
> RAX: 3e45100d05912800 RBX: 1ffff920006d3f70 RCX: ffffffff817023ea
> RDX: dffffc0000000000 RSI: ffffffff8bcad5c0 RDI: 0000000000000001
> RBP: ffffc9000369fbf0 R08: ffffffff9300f817 R09: 1ffffffff2601f02
> R10: dffffc0000000000 R11: fffffbfff2601f03 R12: dffffc0000000000
> R13: 1ffff920006d3f6c R14: ffffc9000369fb80 R15: 0000000000000246
>   spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
>   do_notify_parent_cldstop+0x9ab/0xb50 kernel/signal.c:2216
>   ptrace_stop+0x465/0x940 kernel/signal.c:2319
>   ptrace_do_notify kernel/signal.c:2393 [inline]
>   ptrace_notify+0x255/0x380 kernel/signal.c:2405
>   ptrace_report_syscall include/linux/ptrace.h:415 [inline]
>   ptrace_report_syscall_entry include/linux/ptrace.h:452 [inline]
>   syscall_trace_enter+0x5d/0x150 kernel/entry/common.c:45
>   syscall_enter_from_user_mode_work include/linux/entry-common.h:168 [inline]
>   syscall_enter_from_user_mode include/linux/entry-common.h:198 [inline]
>   do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79
>   entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f708ebe0e20
> Code: ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 80 3d 81 e2 07 00 00 74 17 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c
> RSP: 002b:00007ffd97b2a878 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
> RAX: ffffffffffffffda RBX: 0000000000000015 RCX: 00007f708ebe0e20
> RDX: ffffffffffffffb8 RSI: 0000000020000240 RDI: 0000000000000014
> RBP: 0000000000000000 R08: 00007ffd97b2a9a8 R09: 00007ffd97b2a9a8
> R10: 00007ffd97b2a9a8 R11: 0000000000000202 R12: 0000000000000000
> R13: 0000000000000000 R14: 00007ffd97b2a8b0 R15: 00007ffd97b2a8a0
>   </TASK>
> ---[ end trace ]---
> ----------------
> Code disassembly (best guess):
>     0:	9c                   	pushf
>     1:	8f 44 24 20          	pop    0x20(%rsp)
>     5:	42 80 3c 23 00       	cmpb   $0x0,(%rbx,%r12,1)
>     a:	74 08                	je     0x14
>     c:	4c 89 f7             	mov    %r14,%rdi
>     f:	e8 ce cf 5c f6       	call   0xf65ccfe2
>    14:	f6 44 24 21 02       	testb  $0x2,0x21(%rsp)
>    19:	75 52                	jne    0x6d
>    1b:	41 f7 c7 00 02 00 00 	test   $0x200,%r15d
>    22:	74 01                	je     0x25
>    24:	fb                   	sti
>    25:	bf 01 00 00 00       	mov    $0x1,%edi
> * 2a:	e8 c3 69 c4 f5       	call   0xf5c469f2 <-- trapping instruction
>    2f:	65 8b 05 04 5f 65 74 	mov    %gs:0x74655f04(%rip),%eax        # 0x74655f3a
>    36:	85 c0                	test   %eax,%eax
>    38:	74 43                	je     0x7d
>    3a:	48                   	rex.W
>    3b:	c7                   	.byte 0xc7
>    3c:	04 24                	add    $0x24,%al
>    3e:	0e                   	(bad)
>    3f:	36                   	ss
> 
> 
> ---
> This report is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups.com.
> 
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> 
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
> 
> If you want syzbot to run the reproducer, reply with:
> #syz test: git://repo/address.git branch-or-commit-hash
> If you attach or paste a git patch, syzbot will apply it before testing.
> 
> If you want to overwrite report's subsystems, reply with:
> #syz set subsystems: new-subsystem
> (See the list of subsystem names on the web dashboard)
> 
> If the report is a duplicate of another one, reply with:
> #syz dup: exact-subject-of-another-report
> 
> If you want to undo deduplication, reply with:
> #syz undup

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
  2024-07-19  8:11 ` Jesper Dangaard Brouer
@ 2024-07-20  9:15 ` syzbot
  2024-07-21  3:28 ` [syzbot] Re: [syzbot] [net?] KMSAN: uninit-value in hsr_get_node (3) syzbot
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-20  9:15 UTC (permalink / raw)
  To: andrii, ast, bigeasy, bpf, daniel, davem, eddyz87, edumazet,
	haoluo, hawk, jasowang, john.fastabend, jolsa, kpsingh, kuba,
	linux-kernel, martin.lau, netdev, pabeni, sdf, song,
	syzkaller-bugs, willemdebruijn.kernel, yonghong.song

syzbot has bisected this issue to:

commit fecef4cd42c689a200bdd39e6fffa71475904bc1
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Thu Jul 4 14:48:15 2024 +0000

    tun: Assign missing bpf_net_context.

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12ddc995980000
start commit:   720261cfc732 Merge tag 'bcachefs-2024-07-18.2' of https://..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=11ddc995980000
console output: https://syzkaller.appspot.com/x/log.txt?x=16ddc995980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=93ca6cd6f392cb76
dashboard link: https://syzkaller.appspot.com/bug?extid=707d98c8649695eaf329
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1791eb49980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=118cf7a5980000

Reported-by: syzbot+707d98c8649695eaf329@syzkaller.appspotmail.com
Fixes: fecef4cd42c6 ("tun: Assign missing bpf_net_context.")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [net?] KMSAN: uninit-value in hsr_get_node (3)
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
  2024-07-19  8:11 ` Jesper Dangaard Brouer
  2024-07-20  9:15 ` syzbot
@ 2024-07-21  3:28 ` syzbot
  2024-07-21  8:52 ` [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21  3:28 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [net?] KMSAN: uninit-value in hsr_get_node (3)
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (2 preceding siblings ...)
  2024-07-21  3:28 ` [syzbot] Re: [syzbot] [net?] KMSAN: uninit-value in hsr_get_node (3) syzbot
@ 2024-07-21  8:52 ` syzbot
  2024-07-21 10:45 ` syzbot
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21  8:52 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (3 preceding siblings ...)
  2024-07-21  8:52 ` [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
@ 2024-07-21 10:45 ` syzbot
  2024-07-21 11:37 ` syzbot
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 10:45 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
 kernel/bpf/devmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 9e0e3b0a18e4..bca00badc0f8 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -465,7 +465,7 @@ static void bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
 	 * Do the same with xdp_prog and flush_list since these fields
 	 * are only ever modified together.
 	 */
-	if (!bq->dev_rx) {
+	if (!bq->dev_rx && bq->count <= DEV_MAP_BULK_SIZE) {
 		struct list_head *flush_list = bpf_net_ctx_get_dev_flush_list();
 
 		bq->dev_rx = dev_rx;
--

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (4 preceding siblings ...)
  2024-07-21 10:45 ` syzbot
@ 2024-07-21 11:37 ` syzbot
  2024-07-21 13:16 ` syzbot
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 11:37 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
 kernel/bpf/devmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 9e0e3b0a18e4..5e2ee97ad09f 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -378,7 +378,9 @@ static void bq_xmit_all(struct xdp_dev_bulk_queue *bq, u32 flags)
 	int to_send = cnt;
 	int i;
 
-	if (unlikely(!cnt))
+	printk(KERN_INFO "bq->count = %u\n",cnt);
+
+	if (unlikely(!cnt) || unlikely(cnt) > DEV_MAP_BULK_SIZE)
 		return;
 
 	for (i = 0; i < cnt; i++) {
--

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (5 preceding siblings ...)
  2024-07-21 11:37 ` syzbot
@ 2024-07-21 13:16 ` syzbot
  2024-07-21 13:29 ` syzbot
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 13:16 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
 kernel/bpf/devmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 9e0e3b0a18e4..5e2ee97ad09f 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -378,7 +378,9 @@ static void bq_xmit_all(struct xdp_dev_bulk_queue *bq, u32 flags)
 	int to_send = cnt;
 	int i;
 
-	if (unlikely(!cnt))
+	printk(KERN_INFO "bq->count = %u\n",cnt);
+
+	if (unlikely(!cnt) || unlikely(cnt) > DEV_MAP_BULK_SIZE)
 		return;
 
 	for (i = 0; i < cnt; i++) {
--

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (6 preceding siblings ...)
  2024-07-21 13:16 ` syzbot
@ 2024-07-21 13:29 ` syzbot
  2024-07-21 14:44 ` syzbot
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 13:29 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
 kernel/bpf/cpumap.c | 2 +-
 kernel/bpf/devmap.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index fbdf5a1aabfe..8fccc311397c 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -676,7 +676,7 @@ static void bq_flush_to_queue(struct xdp_bulk_queue *bq)
 	struct ptr_ring *q;
 	int i;
 
-	if (unlikely(!bq->count))
+	if (unlikely(!bq->count) || unlikely(bq->count) > CPU_MAP_BULK_SIZE)
 		return;
 
 	q = rcpu->queue;
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 9e0e3b0a18e4..4b9203deb711 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -378,7 +378,7 @@ static void bq_xmit_all(struct xdp_dev_bulk_queue *bq, u32 flags)
 	int to_send = cnt;
 	int i;
 
-	if (unlikely(!cnt))
+	if (unlikely(!cnt) || unlikely(cnt) > DEV_MAP_BULK_SIZE)
 		return;
 
 	for (i = 0; i < cnt; i++) {
--

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (7 preceding siblings ...)
  2024-07-21 13:29 ` syzbot
@ 2024-07-21 14:44 ` syzbot
  2024-07-21 15:04 ` syzbot
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 14:44 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
 kernel/bpf/cpumap.c | 6 ++----
 kernel/bpf/devmap.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index 8fccc311397c..22e1c62fc0f4 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -708,6 +708,7 @@ static void bq_flush_to_queue(struct xdp_bulk_queue *bq)
 static void bq_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_frame *xdpf)
 {
 	struct xdp_bulk_queue *bq = this_cpu_ptr(rcpu->bulkq);
+	struct list_head *flush_list = bpf_net_ctx_get_cpu_map_flush_list();
 
 	if (unlikely(bq->count == CPU_MAP_BULK_SIZE))
 		bq_flush_to_queue(bq);
@@ -723,11 +724,8 @@ static void bq_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_frame *xdpf)
 	 */
 	bq->q[bq->count++] = xdpf;
 
-	if (!bq->flush_node.prev) {
-		struct list_head *flush_list = bpf_net_ctx_get_cpu_map_flush_list();
-
+	if (!bq->flush_node.prev)
 		list_add(&bq->flush_node, flush_list);
-	}
 }
 
 int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_frame *xdpf,
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 4b9203deb711..dfde65014374 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -454,6 +454,7 @@ static void bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
 		       struct net_device *dev_rx, struct bpf_prog *xdp_prog)
 {
 	struct xdp_dev_bulk_queue *bq = this_cpu_ptr(dev->xdp_bulkq);
+	struct list_head *flush_list = bpf_net_ctx_get_cpu_map_flush_list();
 
 	if (unlikely(bq->count == DEV_MAP_BULK_SIZE))
 		bq_xmit_all(bq, 0);
@@ -466,8 +467,6 @@ static void bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
 	 * are only ever modified together.
 	 */
 	if (!bq->dev_rx) {
-		struct list_head *flush_list = bpf_net_ctx_get_dev_flush_list();
-
 		bq->dev_rx = dev_rx;
 		bq->xdp_prog = xdp_prog;
 		list_add(&bq->flush_node, flush_list);
--

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (8 preceding siblings ...)
  2024-07-21 14:44 ` syzbot
@ 2024-07-21 15:04 ` syzbot
  2024-07-21 15:13 ` syzbot
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 15:04 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3f9fe37d9e16a6cfd5f4d1f536686ea71db3196f

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (9 preceding siblings ...)
  2024-07-21 15:04 ` syzbot
@ 2024-07-21 15:13 ` syzbot
  2024-07-21 15:47 ` syzbot
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 15:13 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d839a73179ae91c07f5f2f97ccb9c69b2b7c3306

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (10 preceding siblings ...)
  2024-07-21 15:13 ` syzbot
@ 2024-07-21 15:47 ` syzbot
  2024-07-21 16:35 ` syzbot
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 15:47 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git upstream

---
 include/linux/filter.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/filter.h b/include/linux/filter.h
index b6672ff61407..22691015d175 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -842,15 +842,15 @@ static inline void bpf_net_ctx_get_all_used_flush_lists(struct list_head **lh_ma
 	if (!IS_ENABLED(CONFIG_BPF_SYSCALL))
 		return;
 
-	lh = &bpf_net_ctx->dev_map_flush_list;
+	lh = this_cpu_ptr(&bpf_net_ctx->dev_map_flush_list);
 	if (kern_flags & BPF_RI_F_DEV_MAP_INIT && !list_empty(lh))
 		*lh_dev = lh;
 
-	lh = &bpf_net_ctx->cpu_map_flush_list;
+	lh = this_cpu_ptr(&bpf_net_ctx->cpu_map_flush_list);
 	if (kern_flags & BPF_RI_F_CPU_MAP_INIT && !list_empty(lh))
 		*lh_map = lh;
 
-	lh = &bpf_net_ctx->xskmap_map_flush_list;
+	lh = this_cpu_ptr(&bpf_net_ctx->xskmap_map_flush_list);
 	if (IS_ENABLED(CONFIG_XDP_SOCKETS) &&
 	    kern_flags & BPF_RI_F_XSK_MAP_INIT && !list_empty(lh))
 		*lh_xsk = lh;
--

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (11 preceding siblings ...)
  2024-07-21 15:47 ` syzbot
@ 2024-07-21 16:35 ` syzbot
  2024-07-21 16:36 ` syzbot
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 16:35 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fd8db07705c55a995c42b1e71afc42faad675b0b

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (12 preceding siblings ...)
  2024-07-21 16:35 ` syzbot
@ 2024-07-21 16:36 ` syzbot
  2024-07-21 16:38 ` syzbot
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 16:36 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 605c96997d89c01c11bbddb4db820ede570581c7

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (13 preceding siblings ...)
  2024-07-21 16:36 ` syzbot
@ 2024-07-21 16:38 ` syzbot
  2024-07-22  9:43 ` syzbot
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-21 16:38 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (14 preceding siblings ...)
  2024-07-21 16:38 ` syzbot
@ 2024-07-22  9:43 ` syzbot
  2024-07-22  9:43 ` syzbot
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-22  9:43 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3b2aef99221d395ce37efa426d7b50e7dcd621d6a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (15 preceding siblings ...)
  2024-07-22  9:43 ` syzbot
@ 2024-07-22  9:43 ` syzbot
  2024-07-22  9:44 ` syzbot
  2024-07-22  9:48 ` syzbot
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-22  9:43 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3b2aef99221d395ce37efa426d7b50e7dcd621d6

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (16 preceding siblings ...)
  2024-07-22  9:43 ` syzbot
@ 2024-07-22  9:44 ` syzbot
  2024-07-22  9:48 ` syzbot
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-22  9:44 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fecef4cd42c689a200bdd39e6fffa71475904bc1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
  2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
                   ` (17 preceding siblings ...)
  2024-07-22  9:44 ` syzbot
@ 2024-07-22  9:48 ` syzbot
  18 siblings, 0 replies; 20+ messages in thread
From: syzbot @ 2024-07-22  9:48 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all
Author: aha310510@gmail.com

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 605c96997d89c01c11bbddb4db820ede570581c7

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-07-22  9:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19  5:12 [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
2024-07-19  8:11 ` Jesper Dangaard Brouer
2024-07-20  9:15 ` syzbot
2024-07-21  3:28 ` [syzbot] Re: [syzbot] [net?] KMSAN: uninit-value in hsr_get_node (3) syzbot
2024-07-21  8:52 ` [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all syzbot
2024-07-21 10:45 ` syzbot
2024-07-21 11:37 ` syzbot
2024-07-21 13:16 ` syzbot
2024-07-21 13:29 ` syzbot
2024-07-21 14:44 ` syzbot
2024-07-21 15:04 ` syzbot
2024-07-21 15:13 ` syzbot
2024-07-21 15:47 ` syzbot
2024-07-21 16:35 ` syzbot
2024-07-21 16:36 ` syzbot
2024-07-21 16:38 ` syzbot
2024-07-22  9:43 ` syzbot
2024-07-22  9:43 ` syzbot
2024-07-22  9:44 ` syzbot
2024-07-22  9:48 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox