[syzbot] general protection fault in cgroup_sk_free

12 views
Skip to first unread message

syzbot

unread,
Sep 17, 2021, 5:06:27ā€ÆPM9/17/21
to and...@kernel.org, a...@kernel.org, b...@vger.kernel.org, cgr...@vger.kernel.org, chri...@brauner.io, dan...@iogearbox.net, han...@cmpxchg.org, john.fa...@gmail.com, ka...@fb.com, kps...@kernel.org, linux-...@vger.kernel.org, lize...@bytedance.com, net...@vger.kernel.org, songliu...@fb.com, syzkall...@googlegroups.com, t...@kernel.org, y...@fb.com
Hello,

syzbot found the following issue on:

HEAD commit: 7366c23ff492 ptp: dp83640: don't define PAGE0
git tree: net
console output: https://syzkaller.appspot.com/x/log.txt?x=15af7951300000
kernel config: https://syzkaller.appspot.com/x/.config?x=c31c0936547df9ea
dashboard link: https://syzkaller.appspot.com/bug?extid=df709157a4ecaf192b03
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12f2b28d300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1656e7c7300000

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

general protection fault, probably for non-canonical address 0xdffffc0000000182: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000c10-0x0000000000000c17]
CPU: 0 PID: 10393 Comm: syz-executor023 Not tainted 5.14.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__ref_is_percpu include/linux/percpu-refcount.h:174 [inline]
RIP: 0010:percpu_ref_put_many include/linux/percpu-refcount.h:319 [inline]
RIP: 0010:percpu_ref_put include/linux/percpu-refcount.h:338 [inline]
RIP: 0010:cgroup_bpf_put include/linux/cgroup.h:926 [inline]
RIP: 0010:cgroup_sk_free+0x8d/0x570 kernel/cgroup/cgroup.c:6613
Code: 0e 06 00 40 84 ed 5a 0f 84 42 01 00 00 e8 0b 08 06 00 4c 8d ab 10 0c 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1 ea 03 <80> 3c 02 00 0f 85 6f 04 00 00 48 8b ab 10 0c 00 00 31 ff 49 89 ec
RSP: 0018:ffffc9000cef79c0 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000182 RSI: ffffffff81700755 RDI: 0000000000000003
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000001
R10: ffffffff81700746 R11: 0000000000000000 R12: ffff888017463000
R13: 0000000000000c10 R14: ffffffff8d0d318c R15: ffff888017463060
FS: 0000000000000000(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000080 CR3: 000000000b68e000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
sk_prot_free net/core/sock.c:1852 [inline]
__sk_destruct+0x579/0x900 net/core/sock.c:1943
sk_destruct+0xbd/0xe0 net/core/sock.c:1958
__sk_free+0xef/0x3d0 net/core/sock.c:1969
sk_free+0x78/0xa0 net/core/sock.c:1980
sock_put include/net/sock.h:1815 [inline]
nr_release+0x392/0x450 net/netrom/af_netrom.c:554
__sock_release+0xcd/0x280 net/socket.c:649
sock_close+0x18/0x20 net/socket.c:1314
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
exit_task_work include/linux/task_work.h:32 [inline]
do_exit+0xbae/0x2a30 kernel/exit.c:825
do_group_exit+0x125/0x310 kernel/exit.c:922
get_signal+0x47f/0x2160 kernel/signal.c:2868
arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:865
handle_signal_work kernel/entry/common.c:148 [inline]
exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:209
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x443559
Code: Unable to access opcode bytes at RIP 0x44352f.
RSP: 002b:00007fff3922f8c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
RAX: 0000000000000003 RBX: 0000000000000003 RCX: 0000000000443559
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000003 R08: 000000000000000d R09: 000000000000000d
R10: 000000000000000d R11: 0000000000000246 R12: 00000000009db2c0
R13: 0000000000000000 R14: 00000000004b8018 R15: 00000000004004b8
Modules linked in:
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 00 40 84 add %al,-0x7c(%rax)
3: ed in (%dx),%eax
4: 5a pop %rdx
5: 0f 84 42 01 00 00 je 0x14d
b: e8 0b 08 06 00 callq 0x6081b
10: 4c 8d ab 10 0c 00 00 lea 0xc10(%rbx),%r13
17: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1e: fc ff df
21: 4c 89 ea mov %r13,%rdx
24: 48 c1 ea 03 shr $0x3,%rdx
* 28: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2c: 0f 85 6f 04 00 00 jne 0x4a1
32: 48 8b ab 10 0c 00 00 mov 0xc10(%rbx),%rbp
39: 31 ff xor %edi,%edi
3b: 49 89 ec mov %rbp,%r12


---
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.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Sep 17, 2021, 6:41:06ā€ÆPM9/17/21
to dan...@iogearbox.net, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: f9eec43b bpf, cgroup: test fix
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/bpf-cgroup-test
kernel config: https://syzkaller.appspot.com/x/.config?x=c31c0936547df9ea
dashboard link: https://syzkaller.appspot.com/bug?extid=df709157a4ecaf192b03
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

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

syzbot

unread,
Sep 20, 2021, 9:05:09ā€ÆPM9/20/21
to dan...@iogearbox.net, syzkall...@googlegroups.com
Hello,

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

==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:111 [inline]
BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline]
BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline]
BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline]
BUG: KASAN: use-after-free in sock_hold include/net/sock.h:702 [inline]
BUG: KASAN: use-after-free in nr_release+0x62/0x450 net/netrom/af_netrom.c:520
Write of size 4 at addr ffff88807bdfa080 by task syz-executor774/31100

CPU: 0 PID: 31100 Comm: syz-executor774 Not tainted 5.14.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256
__kasan_report mm/kasan/report.c:442 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:111 [inline]
__refcount_add include/linux/refcount.h:193 [inline]
__refcount_inc include/linux/refcount.h:250 [inline]
refcount_inc include/linux/refcount.h:267 [inline]
sock_hold include/net/sock.h:702 [inline]
nr_release+0x62/0x450 net/netrom/af_netrom.c:520
__sock_release+0xcd/0x280 net/socket.c:649
sock_close+0x18/0x20 net/socket.c:1314
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
exit_task_work include/linux/task_work.h:32 [inline]
do_exit+0xbae/0x2a30 kernel/exit.c:825
do_group_exit+0x125/0x310 kernel/exit.c:922
get_signal+0x47f/0x2160 kernel/signal.c:2868
arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:865
handle_signal_work kernel/entry/common.c:148 [inline]
exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:209
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f38b0f936d9
Code: Unable to access opcode bytes at RIP 0x7f38b0f936af.
RSP: 002b:00007fff001aa888 EFLAGS: 00000246 ORIG_RAX: 0000000000000110
RAX: fffffffffffffffc RBX: 0000000000000003 RCX: 00007f38b0f936d9
RDX: 00007f38b0f936d9 RSI: ffffffffffffffc0 RDI: 0000000040000000
RBP: 0000000000000003 R08: 000000000000000d R09: 000000000000000d
R10: 000000000000000d R11: 0000000000000246 R12: 00005555557af2c0
R13: 0000000000000000 R14: 000000000007ed88 R15: 00007fff001aa894

Allocated by task 31100:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
____kasan_kmalloc mm/kasan/common.c:472 [inline]
__kasan_kmalloc+0xa4/0xd0 mm/kasan/common.c:522
kmalloc include/linux/slab.h:596 [inline]
sk_prot_alloc+0x110/0x290 net/core/sock.c:1822
sk_alloc+0x30/0xa60 net/core/sock.c:1875
nr_create+0xb2/0x5f0 net/netrom/af_netrom.c:433
__sock_create+0x353/0x790 net/socket.c:1464
sock_create net/socket.c:1515 [inline]
__sys_socket+0xef/0x200 net/socket.c:1557
__do_sys_socket net/socket.c:1566 [inline]
__se_sys_socket net/socket.c:1564 [inline]
__x64_sys_socket+0x6f/0xb0 net/socket.c:1564
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 0:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free mm/kasan/common.c:328 [inline]
__kasan_slab_free+0xff/0x130 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1628 [inline]
slab_free_freelist_hook+0xe3/0x250 mm/slub.c:1653
slab_free mm/slub.c:3213 [inline]
kfree+0xe4/0x540 mm/slub.c:4267
sk_prot_free net/core/sock.c:1858 [inline]
__sk_destruct+0x6a8/0x900 net/core/sock.c:1943
sk_destruct+0xbd/0xe0 net/core/sock.c:1958
__sk_free+0xef/0x3d0 net/core/sock.c:1969
sk_free+0x78/0xa0 net/core/sock.c:1980
sock_put include/net/sock.h:1815 [inline]
nr_heartbeat_expiry+0x2e7/0x460 net/netrom/nr_timer.c:148
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558

Last potentially related work creation:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_record_aux_stack+0xe9/0x110 mm/kasan/generic.c:348
kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3552
drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1647
unregister_sysctl_table fs/proc/proc_sysctl.c:1685 [inline]
unregister_sysctl_table+0xc2/0x190 fs/proc/proc_sysctl.c:1660
__devinet_sysctl_unregister net/ipv4/devinet.c:2600 [inline]
devinet_exit_net+0xe4/0x280 net/ipv4/devinet.c:2739
ops_exit_list+0xb0/0x160 net/core/net_namespace.c:168
cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:591
process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297
worker_thread+0x658/0x11f0 kernel/workqueue.c:2444
kthread+0x3e5/0x4d0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88807bdfa000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 128 bytes inside of
2048-byte region [ffff88807bdfa000, ffff88807bdfa800)
The buggy address belongs to the page:
page:ffffea0001ef7e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7bdf8
head:ffffea0001ef7e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010c42000
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 13438, ts 157614377167, free_ts 157510986812
prep_new_page mm/page_alloc.c:2436 [inline]
get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4168
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5390
alloc_pages+0x1a7/0x300 mm/mempolicy.c:2291
alloc_slab_page mm/slub.c:1691 [inline]
allocate_slab+0x32e/0x4b0 mm/slub.c:1831
new_slab mm/slub.c:1894 [inline]
new_slab_objects mm/slub.c:2640 [inline]
___slab_alloc+0x473/0x7b0 mm/slub.c:2803
__slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2843
slab_alloc_node mm/slub.c:2925 [inline]
__kmalloc_node_track_caller+0x2e3/0x360 mm/slub.c:4653
kmalloc_reserve net/core/skbuff.c:355 [inline]
__alloc_skb+0xde/0x340 net/core/skbuff.c:426
alloc_skb include/linux/skbuff.h:1116 [inline]
nlmsg_new include/net/netlink.h:953 [inline]
rtmsg_ifinfo_build_skb+0x72/0x1a0 net/core/rtnetlink.c:3809
unregister_netdevice_many+0x9e4/0x1790 net/core/dev.c:11043
vti6_exit_batch_net+0x3a0/0x670 net/ipv6/ip6_vti.c:1188
ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
setup_net+0x639/0xa30 net/core/net_namespace.c:349
copy_net_ns+0x319/0x760 net/core/net_namespace.c:470
create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1346 [inline]
free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397
free_unref_page_prepare mm/page_alloc.c:3332 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3411
unfreeze_partials+0x16c/0x1b0 mm/slub.c:2421
put_cpu_partial+0x13d/0x230 mm/slub.c:2457
qlink_free mm/kasan/quarantine.c:146 [inline]
qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
__kasan_slab_alloc+0x95/0xb0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:2959 [inline]
slab_alloc mm/slub.c:2967 [inline]
kmem_cache_alloc+0x285/0x4a0 mm/slub.c:2972
prepare_kernel_cred+0x27/0x890 kernel/cred.c:724
call_usermodehelper_exec_async+0x10e/0x580 kernel/umh.c:91
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
ffff88807bdf9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807bdfa000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807bdfa080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807bdfa100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807bdfa180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


Tested on:

commit: 39f15afa bpf, cgroup: test fix 2
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/bpf-cgroup-test2
console output: https://syzkaller.appspot.com/x/log.txt?x=157c331d300000

syzbot

unread,
Sep 21, 2021, 8:05:09ā€ÆAM9/21/21
to dan...@iogearbox.net, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: 93f377ac bpf, test, cgroup: Use cgroup_sk_{alloc,free}..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/bpf-cgroup-test3
kernel config: https://syzkaller.appspot.com/x/.config?x=c31c0936547df9ea
dashboard link: https://syzkaller.appspot.com/bug?extid=df709157a4ecaf192b03
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

syzbot

unread,
Sep 21, 2021, 4:27:10ā€ÆPM9/21/21
to dan...@iogearbox.net, syzkall...@googlegroups.com

syzbot

unread,
Sep 22, 2021, 9:32:14ā€ÆPM9/22/21
to dan...@iogearbox.net, syzkall...@googlegroups.com
Hello,

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

==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:111 [inline]
BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline]
BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline]
BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline]
BUG: KASAN: use-after-free in sock_hold include/net/sock.h:702 [inline]
BUG: KASAN: use-after-free in nr_release+0x62/0x450 net/netrom/af_netrom.c:520
Write of size 4 at addr ffff88807cfa0080 by task syz-executor349/11930

CPU: 0 PID: 11930 Comm: syz-executor349 Not tainted 5.14.0-syzkaller #0
RIP: 0033:0x7f192d12c6d9
Code: Unable to access opcode bytes at RIP 0x7f192d12c6af.
RSP: 002b:00007fff7f850278 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
RAX: 0000000000000003 RBX: 0000000000000003 RCX: 00007f192d12c6d9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000003 R08: 000000000000000d R09: 000000000000000d
R10: 000000000000000d R11: 0000000000000246 R12: 00005555556752c0
R13: 0000000000000000 R14: 000000000002448a R15: 00007fff7f850284

Allocated by task 11930:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
____kasan_kmalloc mm/kasan/common.c:472 [inline]
__kasan_kmalloc+0xa4/0xd0 mm/kasan/common.c:522
kmalloc include/linux/slab.h:596 [inline]
sk_prot_alloc+0x110/0x290 net/core/sock.c:1822
sk_alloc+0x30/0xa60 net/core/sock.c:1875
nr_create+0xb2/0x5f0 net/netrom/af_netrom.c:433
__sock_create+0x353/0x790 net/socket.c:1464
sock_create net/socket.c:1515 [inline]
__sys_socket+0xef/0x200 net/socket.c:1557
__do_sys_socket net/socket.c:1566 [inline]
__se_sys_socket net/socket.c:1564 [inline]
__x64_sys_socket+0x6f/0xb0 net/socket.c:1564
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 10:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free mm/kasan/common.c:328 [inline]
__kasan_slab_free+0xff/0x130 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1628 [inline]
slab_free_freelist_hook+0xe3/0x250 mm/slub.c:1653
slab_free mm/slub.c:3213 [inline]
kfree+0xe4/0x540 mm/slub.c:4267
sk_prot_free net/core/sock.c:1858 [inline]
__sk_destruct+0x6a8/0x900 net/core/sock.c:1943
sk_destruct+0xbd/0xe0 net/core/sock.c:1958
__sk_free+0xef/0x3d0 net/core/sock.c:1969
sk_free+0x78/0xa0 net/core/sock.c:1980
sock_put include/net/sock.h:1815 [inline]
nr_heartbeat_expiry+0x2e7/0x460 net/netrom/nr_timer.c:148
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558

The buggy address belongs to the object at ffff88807cfa0000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 128 bytes inside of
2048-byte region [ffff88807cfa0000, ffff88807cfa0800)
The buggy address belongs to the page:
page:ffffea0001f3e800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7cfa0
head:ffffea0001f3e800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010c42000
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 58, ts 98581111275, free_ts 94148432803
prep_new_page mm/page_alloc.c:2436 [inline]
get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4168
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5390
alloc_pages+0x1a7/0x300 mm/mempolicy.c:2291
alloc_slab_page mm/slub.c:1691 [inline]
allocate_slab+0x32e/0x4b0 mm/slub.c:1831
new_slab mm/slub.c:1894 [inline]
new_slab_objects mm/slub.c:2640 [inline]
___slab_alloc+0x473/0x7b0 mm/slub.c:2803
__slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2843
slab_alloc_node mm/slub.c:2925 [inline]
__kmalloc_node_track_caller+0x2e3/0x360 mm/slub.c:4653
kmalloc_reserve net/core/skbuff.c:355 [inline]
__alloc_skb+0xde/0x340 net/core/skbuff.c:426
alloc_skb include/linux/skbuff.h:1116 [inline]
nlmsg_new include/net/netlink.h:953 [inline]
rtmsg_ifinfo_build_skb+0x72/0x1a0 net/core/rtnetlink.c:3809
rtmsg_ifinfo_event net/core/rtnetlink.c:3845 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:3836 [inline]
rtmsg_ifinfo+0x83/0x120 net/core/rtnetlink.c:3854
dev_close_many+0x2e4/0x620 net/core/dev.c:1596
unregister_netdevice_many+0x3ff/0x1790 net/core/dev.c:11016
default_device_exit_batch+0x2fa/0x3c0 net/core/dev.c:11569
ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:591
process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1346 [inline]
free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397
free_unref_page_prepare mm/page_alloc.c:3332 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3411
qlink_free mm/kasan/quarantine.c:146 [inline]
qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
__kasan_slab_alloc+0x95/0xb0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:2959 [inline]
slab_alloc mm/slub.c:2967 [inline]
kmem_cache_alloc_trace+0x26d/0x3c0 mm/slub.c:2984
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
mld_add_delrec net/ipv6/mcast.c:742 [inline]
igmp6_leave_group net/ipv6/mcast.c:2633 [inline]
igmp6_group_dropped+0x4f7/0xeb0 net/ipv6/mcast.c:722
__ipv6_dev_mc_dec+0x25e/0x340 net/ipv6/mcast.c:978
addrconf_leave_solict net/ipv6/addrconf.c:2189 [inline]
addrconf_leave_solict net/ipv6/addrconf.c:2181 [inline]
__ipv6_ifa_notify+0x5b6/0xa90 net/ipv6/addrconf.c:6124
addrconf_ifdown.isra.0+0xa4b/0x1630 net/ipv6/addrconf.c:3835
addrconf_notify+0xeb/0x1bb0 net/ipv6/addrconf.c:3646
notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1996
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
dev_close_many+0x2ff/0x620 net/core/dev.c:1597
unregister_netdevice_many+0x3ff/0x1790 net/core/dev.c:11016
default_device_exit_batch+0x2fa/0x3c0 net/core/dev.c:11569

Memory state around the buggy address:
ffff88807cf9ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807cfa0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807cfa0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807cfa0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807cfa0180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


Tested on:

commit: 39f15afa bpf, cgroup: test fix 2
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/bpf-cgroup-test2
console output: https://syzkaller.appspot.com/x/log.txt?x=16c0a2ad300000

syzbot

unread,
Sep 23, 2021, 10:09:16ā€ÆAM9/23/21
to dan...@iogearbox.net, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: 9e975cdb errata
kernel config: https://syzkaller.appspot.com/x/.config?x=c31c0936547df9ea
dashboard link: https://syzkaller.appspot.com/bug?extid=df709157a4ecaf192b03
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

syzbot

unread,
Sep 23, 2021, 10:53:10ā€ÆAM9/23/21
to dan...@iogearbox.net, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: 0a3ead8a bpf, test, cgroup: Use sk_{alloc,free} for te..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/bpf-cgroup-test4
Reply all
Reply to author
Forward
0 new messages