[moderation] [kernel?] KASAN: use-after-free Write in hash_netport6_gc

2 views
Skip to first unread message

syzbot

unread,
Feb 6, 2024, 7:08:35 PMFeb 6
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 021533194476 Kconfig: Disable -Wstringop-overflow for GCC ..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16f700afe80000
kernel config: https://syzkaller.appspot.com/x/.config?x=457249c250b93697
dashboard link: https://syzkaller.appspot.com/bug?extid=5f387c4b7b490255e126
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
CC: [b...@alien8.de dave....@linux.intel.com h...@zytor.com linux-...@vger.kernel.org mi...@redhat.com tg...@linutronix.de x...@kernel.org]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8569347139d3/disk-02153319.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/eebcd18a8335/vmlinux-02153319.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0358eed12f00/bzImage-02153319.xz

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

==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
BUG: KASAN: use-after-free in atomic_inc include/linux/atomic/atomic-instrumented.h:435 [inline]
BUG: KASAN: use-after-free in hash_netport6_gc+0x101/0x570 net/netfilter/ipset/ip_set_hash_gen.h:572
Write of size 4 at addr ffff888032a50004 by task kworker/0:6/5165

CPU: 0 PID: 5165 Comm: kworker/0:6 Not tainted 6.8.0-rc2-syzkaller-00199-g021533194476 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Workqueue: events_power_efficient hash_netport6_gc
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x167/0x540 mm/kasan/report.c:488
kasan_report+0x142/0x180 mm/kasan/report.c:601
kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
atomic_inc include/linux/atomic/atomic-instrumented.h:435 [inline]
hash_netport6_gc+0x101/0x570 net/netfilter/ipset/ip_set_hash_gen.h:572
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x915/0x1420 kernel/workqueue.c:2706
worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787
kthread+0x2f1/0x390 kernel/kthread.c:388
ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242
</TASK>

The buggy address belongs to the physical page:
page:ffffea0000ca9400 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x32a50
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 ffffea000131de08 ffff8880b94428c0 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x552dc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_ZERO|__GFP_ACCOUNT), pid 12506, tgid 12503 (syz-executor.1), ts 973924056183, free_ts 973924212073
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
prep_new_page mm/page_alloc.c:1540 [inline]
get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
__alloc_pages+0x255/0x680 mm/page_alloc.c:4567
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
__kmalloc_large_node+0x91/0x1f0 mm/slub.c:3926
__do_kmalloc_node mm/slub.c:3969 [inline]
__kmalloc_node+0x339/0x4e0 mm/slub.c:3988
kmalloc_node include/linux/slab.h:610 [inline]
kvmalloc_node+0x72/0x190 mm/util.c:617
hash_netport_create+0x35d/0x1050 net/netfilter/ipset/ip_set_hash_gen.h:1568
ip_set_create+0xa5e/0x1780 net/netfilter/ipset/ip_set_core.c:1103
nfnetlink_rcv_msg+0xbee/0x1190 net/netfilter/nfnetlink.c:302
netlink_rcv_skb+0x1e5/0x430 net/netlink/af_netlink.c:2543
nfnetlink_rcv+0x294/0x2650 net/netfilter/nfnetlink.c:659
netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
netlink_unicast+0x7ec/0x980 net/netlink/af_netlink.c:1367
netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x223/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
page last free pid 12506 tgid 12503 stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1140 [inline]
free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486
folio_put include/linux/mm.h:1494 [inline]
free_large_kmalloc+0x105/0x1c0 mm/slub.c:4380
kfree+0x1be/0x380 mm/slub.c:4403
hash_netport6_destroy+0x121/0x2c0 net/netfilter/ipset/ip_set_hash_gen.h:455
ip_set_create+0x13b6/0x1780 net/netfilter/ipset/ip_set_core.c:1157
nfnetlink_rcv_msg+0xbee/0x1190 net/netfilter/nfnetlink.c:302
netlink_rcv_skb+0x1e5/0x430 net/netlink/af_netlink.c:2543
nfnetlink_rcv+0x294/0x2650 net/netfilter/nfnetlink.c:659
netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
netlink_unicast+0x7ec/0x980 net/netlink/af_netlink.c:1367
netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x223/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6f/0x77

Memory state around the buggy address:
ffff888032a4ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888032a4ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888032a50000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888032a50080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888032a50100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
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 syzk...@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 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
Reply all
Reply to author
Forward
0 new messages