All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [net?] KASAN: slab-use-after-free Read in team_device_event
@ 2023-09-07 15:22 syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-07 15:22 UTC (permalink / raw)
  To: ap420073, davem, edumazet, jiri, kuba, linux-kernel, netdev,
	pabeni, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    f8fdd54ee6a1 Merge branch 'sja1105-fixes'
git tree:       net
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15476748680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=634e05b4025da9da
dashboard link: https://syzkaller.appspot.com/bug?extid=44ae022028805f4600fc
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12838914680000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=117e54dc680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/3e90dbfb0a87/disk-f8fdd54e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ca3cbcaceef2/vmlinux-f8fdd54e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a57b5f1bd614/bzImage-f8fdd54e.xz

The issue was bisected to:

commit 39285e124edbc752331e98ace37cc141a6a3747a
Author: Taehee Yoo <ap420073@gmail.com>
Date:   Tue Sep 5 08:46:10 2023 +0000

    net: team: do not use dynamic lockdep key

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=16f177f4680000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=15f177f4680000
console output: https://syzkaller.appspot.com/x/log.txt?x=11f177f4680000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+44ae022028805f4600fc@syzkaller.appspotmail.com
Fixes: 39285e124edb ("net: team: do not use dynamic lockdep key")

8021q: adding VLAN 0 to HW filter on device bond1
==================================================================
BUG: KASAN: slab-out-of-bounds in team_device_event+0xa3b/0xad0 drivers/net/team/team.c:3021
Read of size 8 at addr ffff888143fdc1a8 by task syz-executor133/5151

CPU: 0 PID: 5151 Comm: syz-executor133 Not tainted 6.5.0-syzkaller-04043-gf8fdd54ee6a1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 team_device_event+0xa3b/0xad0 drivers/net/team/team.c:3021
 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970
 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
 call_netdevice_notifiers net/core/dev.c:2022 [inline]
 netdev_features_change net/core/dev.c:1333 [inline]
 netdev_update_features net/core/dev.c:9874 [inline]
 netdev_update_features net/core/dev.c:9871 [inline]
 dev_disable_lro+0x224/0x3e0 net/core/dev.c:1606
 team_port_add drivers/net/team/team.c:1248 [inline]
 team_add_slave+0x1a4d/0x2310 drivers/net/team/team.c:1977
 do_set_master+0x1bc/0x220 net/core/rtnetlink.c:2674
 do_setlink+0xa07/0x3fa0 net/core/rtnetlink.c:2873
 __rtnl_newlink+0xc1d/0x1940 net/core/rtnetlink.c:3671
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff3deaf85d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd3e202a18 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007ff3deaf85d9
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000007
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 5151:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:196 [inline]
 __do_kmalloc_node mm/slab_common.c:985 [inline]
 __kmalloc_node_track_caller+0x5e/0x100 mm/slab_common.c:1005
 kstrdup+0x3c/0x70 mm/util.c:62
 kstrdup_const+0x5f/0x70 mm/util.c:85
 __kernfs_new_node+0x9c/0x8a0 fs/kernfs/dir.c:607
 kernfs_new_node+0x94/0x110 fs/kernfs/dir.c:675
 kernfs_create_link+0xcc/0x230 fs/kernfs/symlink.c:39
 sysfs_do_create_link_sd+0x90/0x140 fs/sysfs/symlink.c:44
 sysfs_do_create_link fs/sysfs/symlink.c:80 [inline]
 sysfs_create_link+0x61/0xc0 fs/sysfs/symlink.c:92
 netdev_adjacent_sysfs_add net/core/dev.c:7481 [inline]
 __netdev_adjacent_dev_insert+0x751/0xb40 net/core/dev.c:7537
 __netdev_adjacent_dev_link_lists net/core/dev.c:7619 [inline]
 __netdev_adjacent_dev_link_neighbour net/core/dev.c:7643 [inline]
 __netdev_upper_dev_link+0x410/0x840 net/core/dev.c:7703
 netdev_upper_dev_link+0x92/0xc0 net/core/dev.c:7749
 macsec_newlink+0x800/0x1a30 drivers/net/macsec.c:4087
 rtnl_newlink_create net/core/rtnetlink.c:3485 [inline]
 __rtnl_newlink+0x1177/0x1940 net/core/rtnetlink.c:3705
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888143fdc1a0
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 8 bytes inside of
 allocated 12-byte region [ffff888143fdc1a0, ffff888143fdc1ac)

The buggy address belongs to the physical page:
page:ffffea00050ff700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x143fdc
flags: 0x57ff00000000200(slab|node=1|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 057ff00000000200 ffff8880128413c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000080800080 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 10509138456, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570
 prep_new_page mm/page_alloc.c:1577 [inline]
 get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477
 alloc_page_interleave+0x1e/0x250 mm/mempolicy.c:2131
 alloc_pages+0x22a/0x270 mm/mempolicy.c:2293
 alloc_slab_page mm/slub.c:1862 [inline]
 allocate_slab+0x24e/0x380 mm/slub.c:2009
 new_slab mm/slub.c:2062 [inline]
 ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314
 __slab_alloc_node mm/slub.c:3367 [inline]
 slab_alloc_node mm/slub.c:3460 [inline]
 __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509
 __do_kmalloc_node mm/slab_common.c:984 [inline]
 __kmalloc_node_track_caller+0x4d/0x100 mm/slab_common.c:1005
 kstrdup+0x3c/0x70 mm/util.c:62
 kstrdup_const+0x5f/0x70 mm/util.c:85
 __kernfs_new_node+0x9c/0x8a0 fs/kernfs/dir.c:607
 kernfs_new_node fs/kernfs/dir.c:675 [inline]
 kernfs_create_dir_ns+0x9a/0x210 fs/kernfs/dir.c:1036
 sysfs_create_dir_ns+0x13b/0x2a0 fs/sysfs/dir.c:59
 create_dir lib/kobject.c:65 [inline]
 kobject_add_internal+0x2c8/0x990 lib/kobject.c:233
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888143fdc080: 00 04 fc fc fb fb fc fc fb fb fc fc fb fb fc fc
 ffff888143fdc100: 00 04 fc fc 00 04 fc fc 00 00 fc fc 00 00 fc fc
>ffff888143fdc180: 00 00 fc fc 00 04 fc fc 00 07 fc fc 00 04 fc fc
                                  ^
 ffff888143fdc200: 00 04 fc fc 00 04 fc fc 00 00 fc fc 00 00 fc fc
 ffff888143fdc280: fa fb fc fc fa fb fc fc 00 00 fc fc 00 07 fc fc
==================================================================


---
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.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the bug is already fixed, 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 bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

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

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

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

* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in team_device_event
       [not found] <20230910031719.6205-1-hdanton@sina.com>
@ 2023-09-10  3:52 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-10  3:52 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+44ae022028805f4600fc@syzkaller.appspotmail.com

Tested on:

commit:         f8fdd54e Merge branch 'sja1105-fixes'
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
console output: https://syzkaller.appspot.com/x/log.txt?x=112f3908680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=634e05b4025da9da
dashboard link: https://syzkaller.appspot.com/bug?extid=44ae022028805f4600fc
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=14564e94680000

Note: testing is done by a robot and is best-effort only.

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

* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in team_device_event
       [not found] <20230909092011.5956-1-hdanton@sina.com>
@ 2023-09-09  9:58 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-09  9:58 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in team_device_event

8021q: adding VLAN 0 to HW filter on device bond1
==================================================================
BUG: KASAN: slab-use-after-free in team_device_event+0xa3b/0xad0 drivers/net/team/team.c:3025
Read of size 8 at addr ffff888017364548 by task syz-executor213/19525

CPU: 0 PID: 19525 Comm: syz-executor213 Not tainted 6.5.0-syzkaller-04043-gf8fdd54ee6a1-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 team_device_event+0xa3b/0xad0 drivers/net/team/team.c:3025
 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970
 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
 call_netdevice_notifiers net/core/dev.c:2022 [inline]
 netdev_features_change net/core/dev.c:1333 [inline]
 netdev_update_features net/core/dev.c:9874 [inline]
 netdev_update_features net/core/dev.c:9871 [inline]
 dev_disable_lro+0x224/0x3e0 net/core/dev.c:1606
 team_port_add drivers/net/team/team.c:1248 [inline]
 team_add_slave+0x1a8f/0x2360 drivers/net/team/team.c:1980
 do_set_master+0x1bc/0x220 net/core/rtnetlink.c:2674
 do_setlink+0xa07/0x3fa0 net/core/rtnetlink.c:2873
 __rtnl_newlink+0xc1d/0x1940 net/core/rtnetlink.c:3671
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa6368d05d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc7b3e0188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fa6368d05d9
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000007
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 15081:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:196 [inline]
 __do_kmalloc_node mm/slab_common.c:985 [inline]
 __kmalloc_node_track_caller+0x5e/0x100 mm/slab_common.c:1005
 kstrdup+0x3c/0x70 mm/util.c:62
 kstrdup_const+0x5f/0x70 mm/util.c:85
 __kernfs_new_node+0x9c/0x8a0 fs/kernfs/dir.c:607
 kernfs_new_node+0x94/0x110 fs/kernfs/dir.c:675
 kernfs_create_link+0xcc/0x230 fs/kernfs/symlink.c:39
 sysfs_do_create_link_sd+0x90/0x140 fs/sysfs/symlink.c:44
 sysfs_do_create_link fs/sysfs/symlink.c:80 [inline]
 sysfs_create_link+0x61/0xc0 fs/sysfs/symlink.c:92
 netdev_adjacent_sysfs_add net/core/dev.c:7481 [inline]
 __netdev_adjacent_dev_insert+0x751/0xb40 net/core/dev.c:7537
 __netdev_adjacent_dev_link_lists net/core/dev.c:7619 [inline]
 __netdev_adjacent_dev_link_neighbour net/core/dev.c:7643 [inline]
 __netdev_upper_dev_link+0x410/0x840 net/core/dev.c:7703
 netdev_upper_dev_link+0x92/0xc0 net/core/dev.c:7749
 macsec_newlink+0x800/0x1a30 drivers/net/macsec.c:4087
 rtnl_newlink_create net/core/rtnetlink.c:3485 [inline]
 __rtnl_newlink+0x1177/0x1940 net/core/rtnetlink.c:3705
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888017364540
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 8 bytes inside of
 freed 16-byte region [ffff888017364540, ffff888017364550)

The buggy address belongs to the physical page:
page:ffffea00005cd900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17364
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000200 ffff8880128413c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000080800080 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5390, tgid 5390 (syz-executor.0), ts 86692200297, free_ts 86666078377
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570
 prep_new_page mm/page_alloc.c:1577 [inline]
 get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 alloc_slab_page mm/slub.c:1864 [inline]
 allocate_slab+0xa1/0x380 mm/slub.c:2009
 new_slab mm/slub.c:2062 [inline]
 ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314
 __slab_alloc_node mm/slub.c:3367 [inline]
 slab_alloc_node mm/slub.c:3460 [inline]
 __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509
 __do_kmalloc_node mm/slab_common.c:984 [inline]
 __kmalloc_node+0x4f/0x100 mm/slab_common.c:992
 kmalloc_node include/linux/slab.h:602 [inline]
 kvmalloc_node+0x99/0x1a0 mm/util.c:604
 xt_jumpstack_alloc net/netfilter/x_tables.c:1354 [inline]
 xt_replace_table+0x1ea/0x940 net/netfilter/x_tables.c:1393
 __do_replace+0x1d5/0x9c0 net/ipv4/netfilter/arp_tables.c:912
 do_replace net/ipv6/netfilter/ip6_tables.c:1154 [inline]
 do_ip6t_set_ctl+0x93a/0xbd0 net/ipv6/netfilter/ip6_tables.c:1636
 nf_setsockopt+0x87/0xe0 net/netfilter/nf_sockopt.c:101
 ipv6_setsockopt+0x12b/0x190 net/ipv6/ipv6_sockglue.c:1017
 tcp_setsockopt+0x9d/0x100 net/ipv4/tcp.c:3680
 __sys_setsockopt+0x2cd/0x5b0 net/socket.c:2306
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1161 [inline]
 free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348
 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443
 __unfreeze_partials+0x21d/0x240 mm/slub.c:2647
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook mm/slab.h:762 [inline]
 slab_alloc_node mm/slub.c:3470 [inline]
 slab_alloc mm/slub.c:3478 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3485 [inline]
 kmem_cache_alloc+0x172/0x3b0 mm/slub.c:3494
 kmem_cache_zalloc include/linux/slab.h:693 [inline]
 alloc_buffer_head+0x21/0x140 fs/buffer.c:3037
 folio_alloc_buffers+0x2ad/0x800 fs/buffer.c:941
 grow_dev_page fs/buffer.c:1078 [inline]
 grow_buffers fs/buffer.c:1124 [inline]
 __getblk_slow+0x2ac/0x720 fs/buffer.c:1151
 __getblk_gfp+0x70/0x80 fs/buffer.c:1445
 sb_getblk include/linux/buffer_head.h:369 [inline]
 ext4_getblk+0x229/0x810 fs/ext4/inode.c:829
 ext4_bread+0x2c/0x190 fs/ext4/inode.c:875
 ext4_append+0x26d/0x560 fs/ext4/namei.c:83
 ext4_init_new_dir+0x220/0x4c0 fs/ext4/namei.c:2976
 ext4_mkdir+0x316/0xb70 fs/ext4/namei.c:3022

Memory state around the buggy address:
 ffff888017364400: fb fb fc fc fb fb fc fc fb fb fc fc fb fb fc fc
 ffff888017364480: fb fb fc fc 00 00 fc fc fb fb fc fc fb fb fc fc
>ffff888017364500: fb fb fc fc 00 00 fc fc fb fb fc fc fb fb fc fc
                                              ^
 ffff888017364580: fb fb fc fc fb fb fc fc fb fb fc fc 00 00 fc fc
 ffff888017364600: 00 01 fc fc fb fb fc fc 00 01 fc fc fb fb fc fc
==================================================================


Tested on:

commit:         f8fdd54e Merge branch 'sja1105-fixes'
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
console output: https://syzkaller.appspot.com/x/log.txt?x=15b29abfa80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=634e05b4025da9da
dashboard link: https://syzkaller.appspot.com/bug?extid=44ae022028805f4600fc
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17c8150c680000


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

* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in team_device_event
       [not found] <20230909040639.5886-1-hdanton@sina.com>
@ 2023-09-09  5:02 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-09  5:02 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-out-of-bounds Read in team_device_event

8021q: adding VLAN 0 to HW filter on device bond1
team0: Device bond1 failed to register rx_handler
==================================================================
BUG: KASAN: slab-out-of-bounds in team_device_event+0xba3/0xe40 drivers/net/team/team.c:3002
Read of size 4 at addr ffff888016f42910 by task syz-executor.0/5633

CPU: 1 PID: 5633 Comm: syz-executor.0 Not tainted 6.5.0-syzkaller-04043-gf8fdd54ee6a1-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 team_device_event+0xba3/0xe40 drivers/net/team/team.c:3002
 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970
 __netdev_upper_dev_unlink+0x111/0x430 net/core/dev.c:7799
 netdev_upper_dev_unlink+0x84/0xb0 net/core/dev.c:7831
 team_upper_dev_unlink drivers/net/team/team.c:1126 [inline]
 team_port_add drivers/net/team/team.c:1316 [inline]
 team_add_slave+0x1849/0x2310 drivers/net/team/team.c:1977
 do_set_master+0x1bc/0x220 net/core/rtnetlink.c:2674
 do_setlink+0xa07/0x3fa0 net/core/rtnetlink.c:2873
 __rtnl_newlink+0xc1d/0x1940 net/core/rtnetlink.c:3671
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f9a4087cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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:00007f9a415690c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f9a4099bf80 RCX: 00007f9a4087cae9
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000007
RBP: 00007f9a408c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f9a4099bf80 R15: 00007ffc4b5304d8
 </TASK>

Allocated by task 5633:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:582 [inline]
 kzalloc include/linux/slab.h:703 [inline]
 apparmor_sk_alloc_security+0x87/0x150 security/apparmor/lsm.c:828
 security_sk_alloc+0x72/0xb0 security/security.c:4386
 sk_prot_alloc+0x1c3/0x2a0 net/core/sock.c:2093
 sk_alloc+0x3a/0x7f0 net/core/sock.c:2143
 __netlink_create+0x63/0x380 net/netlink/af_netlink.c:647
 netlink_create+0x3dc/0x670 net/netlink/af_netlink.c:712
 __sock_create+0x334/0x810 net/socket.c:1550
 sock_create net/socket.c:1601 [inline]
 __sys_socket_create net/socket.c:1638 [inline]
 __sys_socket+0x14c/0x260 net/socket.c:1689
 __do_sys_socket net/socket.c:1703 [inline]
 __se_sys_socket net/socket.c:1701 [inline]
 __x64_sys_socket+0x72/0xb0 net/socket.c:1701
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888016f42900
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 0 bytes to the right of
 allocated 16-byte region [ffff888016f42900, ffff888016f42910)

The buggy address belongs to the physical page:
page:ffffea00005bd080 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16f42
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000200 ffff8880128413c0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080800080 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5391, tgid 5391 (syz-executor.0), ts 94696443415, free_ts 94682336522
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570
 prep_new_page mm/page_alloc.c:1577 [inline]
 get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 alloc_slab_page mm/slub.c:1864 [inline]
 allocate_slab+0xa1/0x380 mm/slub.c:2009
 new_slab mm/slub.c:2062 [inline]
 ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314
 __slab_alloc_node mm/slub.c:3367 [inline]
 slab_alloc_node mm/slub.c:3460 [inline]
 __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509
 __do_kmalloc_node mm/slab_common.c:984 [inline]
 __kmalloc_node+0x4f/0x100 mm/slab_common.c:992
 kmalloc_node include/linux/slab.h:602 [inline]
 kvmalloc_node+0x99/0x1a0 mm/util.c:604
 xt_jumpstack_alloc net/netfilter/x_tables.c:1354 [inline]
 xt_replace_table+0x1ea/0x940 net/netfilter/x_tables.c:1393
 __do_replace+0x1d5/0x9c0 net/ipv4/netfilter/arp_tables.c:912
 do_replace net/ipv6/netfilter/ip6_tables.c:1154 [inline]
 do_ip6t_set_ctl+0x93a/0xbd0 net/ipv6/netfilter/ip6_tables.c:1636
 nf_setsockopt+0x87/0xe0 net/netfilter/nf_sockopt.c:101
 ipv6_setsockopt+0x12b/0x190 net/ipv6/ipv6_sockglue.c:1017
 tcp_setsockopt+0x9d/0x100 net/ipv4/tcp.c:3680
 __sys_setsockopt+0x2cd/0x5b0 net/socket.c:2306
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1161 [inline]
 free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348
 free_unref_page_list+0xe6/0xb30 mm/page_alloc.c:2489
 release_pages+0x32a/0x14e0 mm/swap.c:1042
 tlb_batch_pages_flush+0x9a/0x190 mm/mmu_gather.c:97
 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline]
 tlb_flush_mmu mm/mmu_gather.c:299 [inline]
 tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:391
 exit_mmap+0x2db/0x960 mm/mmap.c:3215
 __mmput+0x12a/0x4d0 kernel/fork.c:1356
 mmput+0x62/0x70 kernel/fork.c:1378
 exit_mm kernel/exit.c:567 [inline]
 do_exit+0x9b4/0x2a20 kernel/exit.c:861
 do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
 get_signal+0x23ea/0x2770 kernel/signal.c:2881
 arch_do_signal_or_restart+0x89/0x5f0 arch/x86/kernel/signal.c:308
 exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
 exit_to_user_mode_prepare+0x11f/0x240 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296
 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888016f42800: 00 00 fc fc 00 00 fc fc 00 01 fc fc 00 01 fc fc
 ffff888016f42880: 00 01 fc fc 00 07 fc fc 00 04 fc fc 00 00 fc fc
>ffff888016f42900: 00 00 fc fc 00 00 fc fc 00 04 fc fc 00 04 fc fc
                         ^
 ffff888016f42980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888016f42a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


Tested on:

commit:         f8fdd54e Merge branch 'sja1105-fixes'
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
console output: https://syzkaller.appspot.com/x/log.txt?x=16688684680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=634e05b4025da9da
dashboard link: https://syzkaller.appspot.com/bug?extid=44ae022028805f4600fc
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=120c0278680000


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

* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in team_device_event
       [not found] <20230909025602.5753-1-hdanton@sina.com>
@ 2023-09-09  3:36 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-09  3:36 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in team_device_event

8021q: adding VLAN 0 to HW filter on device bond1
==================================================================
BUG: KASAN: slab-use-after-free in team_device_event+0xa3b/0xad0 drivers/net/team/team.c:3024
Read of size 8 at addr ffff888055dd5b88 by task syz-executor408/19067

CPU: 0 PID: 19067 Comm: syz-executor408 Not tainted 6.5.0-syzkaller-04043-gf8fdd54ee6a1-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 team_device_event+0xa3b/0xad0 drivers/net/team/team.c:3024
 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970
 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
 call_netdevice_notifiers net/core/dev.c:2022 [inline]
 netdev_features_change net/core/dev.c:1333 [inline]
 netdev_update_features net/core/dev.c:9874 [inline]
 netdev_update_features net/core/dev.c:9871 [inline]
 dev_disable_lro+0x224/0x3e0 net/core/dev.c:1606
 team_port_add drivers/net/team/team.c:1249 [inline]
 team_add_slave+0x1c53/0x2560 drivers/net/team/team.c:1980
 do_set_master+0x1bc/0x220 net/core/rtnetlink.c:2674
 do_setlink+0xa07/0x3fa0 net/core/rtnetlink.c:2873
 __rtnl_newlink+0xc1d/0x1940 net/core/rtnetlink.c:3671
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f1732fde5d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff2a8f2868 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f1732fde5d9
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000007
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 18103:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:196 [inline]
 __do_kmalloc_node mm/slab_common.c:985 [inline]
 __kmalloc_node_track_caller+0x5e/0x100 mm/slab_common.c:1005
 kstrdup+0x3c/0x70 mm/util.c:62
 kstrdup_const+0x5f/0x70 mm/util.c:85
 kvasprintf_const+0x10b/0x190 lib/kasprintf.c:48
 kobject_set_name_vargs+0x5a/0x130 lib/kobject.c:267
 dev_set_name+0xc8/0x100 drivers/base/core.c:3429
 netdev_register_kobject+0xc1/0x3f0 net/core/net-sysfs.c:2031
 register_netdevice+0xbcb/0x1490 net/core/dev.c:10136
 macsec_newlink+0x4ca/0x1a30 drivers/net/macsec.c:4079
 rtnl_newlink_create net/core/rtnetlink.c:3485 [inline]
 __rtnl_newlink+0x1177/0x1940 net/core/rtnetlink.c:3705
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6444
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:728 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:751
 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2539
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2593
 __sys_sendmsg+0x117/0x1e0 net/socket.c:2622
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888055dd5b80
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 8 bytes inside of
 freed 16-byte region [ffff888055dd5b80, ffff888055dd5b90)

The buggy address belongs to the physical page:
page:ffffea0001577540 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x55dd5
anon flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000200 ffff8880128413c0 0000000000000000 dead000000000001
raw: 0000000000000000 0000000080800080 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5390, tgid 5390 (syz-executor.0), ts 134688220071, free_ts 134681893991
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570
 prep_new_page mm/page_alloc.c:1577 [inline]
 get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 alloc_slab_page mm/slub.c:1864 [inline]
 allocate_slab+0xa1/0x380 mm/slub.c:2009
 new_slab mm/slub.c:2062 [inline]
 ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314
 __slab_alloc_node mm/slub.c:3367 [inline]
 slab_alloc_node mm/slub.c:3460 [inline]
 __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509
 __do_kmalloc_node mm/slab_common.c:984 [inline]
 __kmalloc_node+0x4f/0x100 mm/slab_common.c:992
 kmalloc_node include/linux/slab.h:602 [inline]
 kvmalloc_node+0x99/0x1a0 mm/util.c:604
 xt_jumpstack_alloc net/netfilter/x_tables.c:1354 [inline]
 xt_replace_table+0x1ea/0x940 net/netfilter/x_tables.c:1393
 __do_replace+0x1d5/0x9c0 net/ipv4/netfilter/arp_tables.c:912
 do_replace net/ipv6/netfilter/ip6_tables.c:1154 [inline]
 do_ip6t_set_ctl+0x93a/0xbd0 net/ipv6/netfilter/ip6_tables.c:1636
 nf_setsockopt+0x87/0xe0 net/netfilter/nf_sockopt.c:101
 ipv6_setsockopt+0x12b/0x190 net/ipv6/ipv6_sockglue.c:1017
 tcp_setsockopt+0x9d/0x100 net/ipv4/tcp.c:3680
 __sys_setsockopt+0x2cd/0x5b0 net/socket.c:2306
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1161 [inline]
 free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348
 free_unref_page_list+0xe6/0xb30 mm/page_alloc.c:2489
 release_pages+0x32a/0x14e0 mm/swap.c:1042
 tlb_batch_pages_flush+0x9a/0x190 mm/mmu_gather.c:97
 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline]
 tlb_flush_mmu mm/mmu_gather.c:299 [inline]
 tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:391
 exit_mmap+0x2db/0x960 mm/mmap.c:3215
 __mmput+0x12a/0x4d0 kernel/fork.c:1356
 mmput+0x62/0x70 kernel/fork.c:1378
 exit_mm kernel/exit.c:567 [inline]
 do_exit+0x9b4/0x2a20 kernel/exit.c:861
 do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
 get_signal+0x23ea/0x2770 kernel/signal.c:2881
 arch_do_signal_or_restart+0x89/0x5f0 arch/x86/kernel/signal.c:308
 exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
 exit_to_user_mode_prepare+0x11f/0x240 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296
 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888055dd5a80: fa fb fc fc fa fb fc fc 00 00 fc fc fb fb fc fc
 ffff888055dd5b00: fb fb fc fc 00 04 fc fc fb fb fc fc 00 00 fc fc
>ffff888055dd5b80: fb fb fc fc fb fb fc fc fb fb fc fc fb fb fc fc
                      ^
 ffff888055dd5c00: fb fb fc fc fb fb fc fc fb fb fc fc fa fb fc fc
 ffff888055dd5c80: fa fb fc fc fb fb fc fc fb fb fc fc fb fb fc fc
==================================================================


Tested on:

commit:         f8fdd54e Merge branch 'sja1105-fixes'
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
console output: https://syzkaller.appspot.com/x/log.txt?x=138e0da4680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=634e05b4025da9da
dashboard link: https://syzkaller.appspot.com/bug?extid=44ae022028805f4600fc
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=149ee384680000


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

end of thread, other threads:[~2023-09-10  3:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 15:22 [syzbot] [net?] KASAN: slab-use-after-free Read in team_device_event syzbot
     [not found] <20230909025602.5753-1-hdanton@sina.com>
2023-09-09  3:36 ` syzbot
     [not found] <20230909040639.5886-1-hdanton@sina.com>
2023-09-09  5:02 ` syzbot
     [not found] <20230909092011.5956-1-hdanton@sina.com>
2023-09-09  9:58 ` syzbot
     [not found] <20230910031719.6205-1-hdanton@sina.com>
2023-09-10  3:52 ` syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.