* [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
@ 2023-12-18 14:33 syzbot
2023-12-19 10:59 ` Hillf Danton
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: syzbot @ 2023-12-18 14:33 UTC (permalink / raw)
To: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
syzkaller-bugs, vinicius.gomes, xiyou.wangcong
Hello,
syzbot found the following issue on:
HEAD commit: d5b235ec8eab Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=126c1c8ae80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f36ea342ce412b14
dashboard link: https://syzkaller.appspot.com/bug?extid=d4d8c0fd15a0abe39bcf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=112380bae80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15e40371e80000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/edab88544ce7/disk-d5b235ec.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2d149255b78d/vmlinux-d5b235ec.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c3bfc66db2fc/Image-d5b235ec.gz.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d4d8c0fd15a0abe39bcf@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-use-after-free in taprio_dump_tc_entries net/sched/sch_taprio.c:2307 [inline]
BUG: KASAN: slab-use-after-free in taprio_dump+0x72c/0xb94 net/sched/sch_taprio.c:2420
Read of size 4 at addr ffff0000c1f660d8 by task syz-executor368/7987
CPU: 0 PID: 7987 Comm: syz-executor368 Not tainted 6.7.0-rc5-syzkaller-gd5b235ec8eab #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call trace:
dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0x174/0x514 mm/kasan/report.c:475
kasan_report+0xd8/0x138 mm/kasan/report.c:588
__asan_report_load4_noabort+0x20/0x2c mm/kasan/report_generic.c:380
taprio_dump_tc_entries net/sched/sch_taprio.c:2307 [inline]
taprio_dump+0x72c/0xb94 net/sched/sch_taprio.c:2420
tc_fill_qdisc+0x570/0xf1c net/sched/sch_api.c:952
qdisc_notify+0x1a0/0x338 net/sched/sch_api.c:1024
tc_modify_qdisc+0x16d4/0x1870 net/sched/sch_api.c:1719
rtnetlink_rcv_msg+0x748/0xdbc net/core/rtnetlink.c:6558
netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2545
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6576
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x83c/0xb20 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x56c/0x840 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x26c/0x33c net/socket.c:2667
__do_sys_sendmsg net/socket.c:2676 [inline]
__se_sys_sendmsg net/socket.c:2674 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2674
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595
Allocated by task 7987:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x7c mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:511
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:198 [inline]
kmalloc_trace+0x70/0x88 mm/slab_common.c:1103
kmalloc include/linux/slab.h:600 [inline]
kzalloc include/linux/slab.h:721 [inline]
taprio_change+0xd74/0x3c54 net/sched/sch_taprio.c:1881
qdisc_change net/sched/sch_api.c:1387 [inline]
tc_modify_qdisc+0x1474/0x1870 net/sched/sch_api.c:1717
rtnetlink_rcv_msg+0x748/0xdbc net/core/rtnetlink.c:6558
netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2545
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6576
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x83c/0xb20 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x56c/0x840 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x26c/0x33c net/socket.c:2667
__do_sys_sendmsg net/socket.c:2676 [inline]
__se_sys_sendmsg net/socket.c:2674 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2674
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595
Freed by task 40:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x7c mm/kasan/common.c:52
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:522
____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1800 [inline]
slab_free_freelist_hook mm/slub.c:1826 [inline]
slab_free mm/slub.c:3809 [inline]
__kmem_cache_free+0x2ac/0x480 mm/slub.c:3822
kfree+0xb8/0x19c mm/slab_common.c:1056
taprio_free_sched_cb+0x158/0x178 net/sched/sch_taprio.c:199
rcu_do_batch kernel/rcu/tree.c:2158 [inline]
rcu_core+0x890/0x1b34 kernel/rcu/tree.c:2431
rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2448
__do_softirq+0x2d8/0xce4 kernel/softirq.c:553
Last potentially related work creation:
kasan_save_stack+0x40/0x6c mm/kasan/common.c:45
__kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:492
kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:502
__call_rcu_common kernel/rcu/tree.c:2681 [inline]
call_rcu+0x104/0xaf4 kernel/rcu/tree.c:2795
switch_schedules net/sched/sch_taprio.c:210 [inline]
advance_sched+0x7e0/0xac0 net/sched/sch_taprio.c:984
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1814
timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
__gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
__gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
Second to last potentially related work creation:
kasan_save_stack+0x40/0x6c mm/kasan/common.c:45
__kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:492
kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:502
__call_rcu_common kernel/rcu/tree.c:2681 [inline]
call_rcu+0x104/0xaf4 kernel/rcu/tree.c:2795
switch_schedules net/sched/sch_taprio.c:210 [inline]
advance_sched+0x7e0/0xac0 net/sched/sch_taprio.c:984
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1814
timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
__gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
__gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
The buggy address belongs to the object at ffff0000c1f66000
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 216 bytes inside of
freed 512-byte region [ffff0000c1f66000, ffff0000c1f66200)
The buggy address belongs to the physical page:
page:00000000dead7e4a refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000c1f64800 pfn:0x101f64
head:00000000dead7e4a order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x5ffc00000000840(slab|head|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 05ffc00000000840 ffff0000c0001c80 fffffc00036bd110 fffffc0003653210
raw: ffff0000c1f64800 000000000010000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff0000c1f65f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000c1f66000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000c1f66080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000c1f66100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000c1f66180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
---
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] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-18 14:33 [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump syzbot
@ 2023-12-19 10:59 ` Hillf Danton
2023-12-19 11:20 ` syzbot
2023-12-20 11:15 ` Hillf Danton
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Hillf Danton @ 2023-12-19 10:59 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Mon, 18 Dec 2023 06:33:26 -0800
> HEAD commit: d5b235ec8eab Merge branch 'for-next/core' into for-kernelci
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15e40371e80000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git d5b235ec8eab
--- x/net/sched/sch_taprio.c
+++ y/net/sched/sch_taprio.c
@@ -2393,6 +2393,7 @@ static int taprio_dump(struct Qdisc *sch
struct sched_gate_list *oper, *admin;
struct tc_mqprio_qopt opt = { 0 };
struct nlattr *nest, *sched_nest;
+ int active = hrtimer_cancel(&q->advance_timer);
oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);
@@ -2436,6 +2437,10 @@ static int taprio_dump(struct Qdisc *sch
nla_nest_end(skb, sched_nest);
done:
+ if (active)
+ hrtimer_start(&q->advance_timer,
+ hrtimer_get_expires(&q->advance_timer),
+ HRTIMER_MODE_ABS);
return nla_nest_end(skb, nest);
admin_error:
@@ -2445,6 +2450,10 @@ options_error:
nla_nest_cancel(skb, nest);
start_error:
+ if (active)
+ hrtimer_start(&q->advance_timer,
+ hrtimer_get_expires(&q->advance_timer),
+ HRTIMER_MODE_ABS);
return -ENOSPC;
}
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-19 10:59 ` Hillf Danton
@ 2023-12-19 11:20 ` syzbot
0 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-12-19 11:20 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in call_rcu
------------[ cut here ]------------
ODEBUG: activate active (active state 1) object: 00000000dde3d5ec object type: rcu_head hint: 0x0
WARNING: CPU: 0 PID: 6475 at lib/debugobjects.c:517 debug_print_object lib/debugobjects.c:514 [inline]
WARNING: CPU: 0 PID: 6475 at lib/debugobjects.c:517 debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
Modules linked in:
CPU: 0 PID: 6475 Comm: syz-executor.4 Not tainted 6.7.0-rc5-syzkaller-00083-gd5b235ec8eab-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : debug_print_object lib/debugobjects.c:514 [inline]
pc : debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
lr : debug_print_object lib/debugobjects.c:514 [inline]
lr : debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
sp : ffff800080007a00
x29: ffff800080007ad0 x28: dfff800000000000 x27: ffff700010000f44
x26: 0000000000000000 x25: ffff0000e798f100 x24: 0000000000000000
x23: ffff80008a9af3a0 x22: ffff80008ae8cdc0 x21: 0000000000000001
x20: ffff80008a9af3a0 x19: ffff0000e798f100 x18: ffff800080006ee0
x17: 6535643365646430 x16: ffff80008a82f3a0 x15: 0000000000000001
x14: 1fffe0003682623a x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000010004 x10: 0000000000ff0100 x9 : 20b7275ad0946800
x8 : 20b7275ad0946800 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff8000800072f8 x4 : ffff80008e5d2600 x3 : ffff8000805ad1c0
x2 : 0000000000000001 x1 : 0000000100010002 x0 : 0000000000000000
Call trace:
debug_print_object lib/debugobjects.c:514 [inline]
debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
debug_rcu_head_queue kernel/rcu/rcu.h:227 [inline]
__call_rcu_common kernel/rcu/tree.c:2666 [inline]
call_rcu+0x48/0xaf4 kernel/rcu/tree.c:2795
switch_schedules net/sched/sch_taprio.c:210 [inline]
advance_sched+0x7e0/0xac0 net/sched/sch_taprio.c:984
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1814
timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
__gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
__gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:886
do_interrupt_handler+0xd4/0x138 arch/arm64/kernel/entry-common.c:276
__el1_irq arch/arm64/kernel/entry-common.c:502 [inline]
el1_interrupt+0x34/0x68 arch/arm64/kernel/entry-common.c:517
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:522
el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:591
__daif_local_irq_enable arch/arm64/include/asm/irqflags.h:27 [inline]
arch_local_irq_enable arch/arm64/include/asm/irqflags.h:49 [inline]
raw_spin_rq_unlock_irq kernel/sched/sched.h:1361 [inline]
finish_lock_switch+0xc0/0x1e4 kernel/sched/core.c:5130
finish_task_switch+0x120/0x614 kernel/sched/core.c:5248
context_switch kernel/sched/core.c:5379 [inline]
__schedule+0x1358/0x2360 kernel/sched/core.c:6688
__schedule_loop kernel/sched/core.c:6763 [inline]
schedule+0xb8/0x19c kernel/sched/core.c:6778
do_nanosleep+0x170/0x504 kernel/time/hrtimer.c:2047
hrtimer_nanosleep+0x1c4/0x358 kernel/time/hrtimer.c:2100
common_nsleep+0xa8/0xc0 kernel/time/posix-timers.c:1350
__do_sys_clock_nanosleep kernel/time/posix-timers.c:1396 [inline]
__se_sys_clock_nanosleep kernel/time/posix-timers.c:1373 [inline]
__arm64_sys_clock_nanosleep+0x350/0x38c kernel/time/posix-timers.c:1373
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595
irq event stamp: 3966950
hardirqs last enabled at (3966949): [<ffff80008028f0b8>] raw_spin_rq_unlock_irq kernel/sched/sched.h:1361 [inline]
hardirqs last enabled at (3966949): [<ffff80008028f0b8>] finish_lock_switch+0xbc/0x1e4 kernel/sched/core.c:5130
hardirqs last disabled at (3966950): [<ffff80008a82af84>] __el1_irq arch/arm64/kernel/entry-common.c:499 [inline]
hardirqs last disabled at (3966950): [<ffff80008a82af84>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:517
softirqs last enabled at (3966932): [<ffff80008002189c>] softirq_handle_end kernel/softirq.c:399 [inline]
softirqs last enabled at (3966932): [<ffff80008002189c>] __do_softirq+0xac8/0xce4 kernel/softirq.c:582
softirqs last disabled at (3966927): [<ffff80008002aadc>] ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:81
---[ end trace 0000000000000000 ]---
------------[ cut here ]------------
ODEBUG: active_state active (active state 1) object: 00000000dde3d5ec object type: rcu_head hint: 0x0
WARNING: CPU: 0 PID: 6475 at lib/debugobjects.c:517 debug_print_object lib/debugobjects.c:514 [inline]
WARNING: CPU: 0 PID: 6475 at lib/debugobjects.c:517 debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
Modules linked in:
CPU: 0 PID: 6475 Comm: syz-executor.4 Tainted: G W 6.7.0-rc5-syzkaller-00083-gd5b235ec8eab-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : debug_print_object lib/debugobjects.c:514 [inline]
pc : debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
lr : debug_print_object lib/debugobjects.c:514 [inline]
lr : debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
sp : ffff800080007ac0
x29: ffff800080007ad0 x28: ffff80008e4f0000 x27: dfff800000000000
x26: 1fffe0001ae8f202 x25: ffff800092d4d000 x24: 1fffe0001ae8f203
x23: 0000000000000000 x22: ffff0000e798f100 x21: ffff80008a9af3a0
x20: ffff80008ae8cdc0 x19: 0000000000000001 x18: ffff800080006ee0
x17: 6564643030303030 x16: ffff80008a82f3a0 x15: 0000000000000001
x14: 1fffe0003682623a x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000010004 x10: 0000000000ff0100 x9 : 20b7275ad0946800
x8 : 20b7275ad0946800 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff8000800073b8 x4 : ffff80008e5d2600 x3 : ffff8000805ad1c0
x2 : 0000000000000001 x1 : 0000000100010002 x0 : 0000000000000000
Call trace:
debug_print_object lib/debugobjects.c:514 [inline]
debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
debug_rcu_head_queue kernel/rcu/rcu.h:228 [inline]
__call_rcu_common kernel/rcu/tree.c:2666 [inline]
call_rcu+0x60/0xaf4 kernel/rcu/tree.c:2795
switch_schedules net/sched/sch_taprio.c:210 [inline]
advance_sched+0x7e0/0xac0 net/sched/sch_taprio.c:984
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1814
timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
__gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
__gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:886
do_interrupt_handler+0xd4/0x138 arch/arm64/kernel/entry-common.c:276
__el1_irq arch/arm64/kernel/entry-common.c:502 [inline]
el1_interrupt+0x34/0x68 arch/arm64/kernel/entry-common.c:517
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:522
el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:591
__daif_local_irq_enable arch/arm64/include/asm/irqflags.h:27 [inline]
arch_local_irq_enable arch/arm64/include/asm/irqflags.h:49 [inline]
raw_spin_rq_unlock_irq kernel/sched/sched.h:1361 [inline]
finish_lock_switch+0xc0/0x1e4 kernel/sched/core.c:5130
finish_task_switch+0x120/0x614 kernel/sched/core.c:5248
context_switch kernel/sched/core.c:5379 [inline]
__schedule+0x1358/0x2360 kernel/sched/core.c:6688
__schedule_loop kernel/sched/core.c:6763 [inline]
schedule+0xb8/0x19c kernel/sched/core.c:6778
do_nanosleep+0x170/0x504 kernel/time/hrtimer.c:2047
hrtimer_nanosleep+0x1c4/0x358 kernel/time/hrtimer.c:2100
common_nsleep+0xa8/0xc0 kernel/time/posix-timers.c:1350
__do_sys_clock_nanosleep kernel/time/posix-timers.c:1396 [inline]
__se_sys_clock_nanosleep kernel/time/posix-timers.c:1373 [inline]
__arm64_sys_clock_nanosleep+0x350/0x38c kernel/time/posix-timers.c:1373
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595
irq event stamp: 3966950
hardirqs last enabled at (3966949): [<ffff80008028f0b8>] raw_spin_rq_unlock_irq kernel/sched/sched.h:1361 [inline]
hardirqs last enabled at (3966949): [<ffff80008028f0b8>] finish_lock_switch+0xbc/0x1e4 kernel/sched/core.c:5130
hardirqs last disabled at (3966950): [<ffff80008a82af84>] __el1_irq arch/arm64/kernel/entry-common.c:499 [inline]
hardirqs last disabled at (3966950): [<ffff80008a82af84>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:517
softirqs last enabled at (3966932): [<ffff80008002189c>] softirq_handle_end kernel/softirq.c:399 [inline]
softirqs last enabled at (3966932): [<ffff80008002189c>] __do_softirq+0xac8/0xce4 kernel/softirq.c:582
softirqs last disabled at (3966927): [<ffff80008002aadc>] ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:81
---[ end trace 0000000000000000 ]---
rcu: __call_rcu_common(): Double-freed CB 00000000dde3d5ec->taprio_free_sched_cb+0x0/0x178()!!! slab kmalloc-512 start ffff0000e798f000 pointer offset 256 size 512
Tested on:
commit: d5b235ec Merge branch 'for-next/core' into for-kernelci
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=13e8c811e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f36ea342ce412b14
dashboard link: https://syzkaller.appspot.com/bug?extid=d4d8c0fd15a0abe39bcf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=179f7076e80000
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-18 14:33 [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump syzbot
2023-12-19 10:59 ` Hillf Danton
@ 2023-12-20 11:15 ` Hillf Danton
2023-12-20 12:44 ` syzbot
2023-12-21 4:36 ` Hillf Danton
2024-11-05 11:14 ` Jeongjun Park
3 siblings, 1 reply; 9+ messages in thread
From: Hillf Danton @ 2023-12-20 11:15 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Mon, 18 Dec 2023 06:33:26 -0800
> HEAD commit: d5b235ec8eab Merge branch 'for-next/core' into for-kernelci
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15e40371e80000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git d5b235ec8eab
--- x/net/sched/sch_taprio.c
+++ y/net/sched/sch_taprio.c
@@ -1975,9 +1975,12 @@ static int taprio_change(struct Qdisc *s
goto unlock;
}
+ spin_lock_irqsave(&q->current_entry_lock, flags);
+ admin = rtnl_dereference(q->admin_sched);
rcu_assign_pointer(q->admin_sched, new_admin);
if (admin)
call_rcu(&admin->rcu, taprio_free_sched_cb);
+ spin_unlock_irqrestore(&q->current_entry_lock, flags);
} else {
setup_first_end_time(q, new_admin, start);
@@ -2393,6 +2396,7 @@ static int taprio_dump(struct Qdisc *sch
struct sched_gate_list *oper, *admin;
struct tc_mqprio_qopt opt = { 0 };
struct nlattr *nest, *sched_nest;
+ int active = hrtimer_cancel(&q->advance_timer);
oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);
@@ -2436,6 +2440,10 @@ static int taprio_dump(struct Qdisc *sch
nla_nest_end(skb, sched_nest);
done:
+ if (active)
+ hrtimer_start(&q->advance_timer,
+ hrtimer_get_expires(&q->advance_timer),
+ HRTIMER_MODE_ABS);
return nla_nest_end(skb, nest);
admin_error:
@@ -2445,6 +2453,10 @@ options_error:
nla_nest_cancel(skb, nest);
start_error:
+ if (active)
+ hrtimer_start(&q->advance_timer,
+ hrtimer_get_expires(&q->advance_timer),
+ HRTIMER_MODE_ABS);
return -ENOSPC;
}
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-20 11:15 ` Hillf Danton
@ 2023-12-20 12:44 ` syzbot
0 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-12-20 12:44 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in call_rcu
------------[ cut here ]------------
ODEBUG: activate active (active state 1) object: 0000000040a741f2 object type: rcu_head hint: 0x0
WARNING: CPU: 0 PID: 10724 at lib/debugobjects.c:517 debug_print_object lib/debugobjects.c:514 [inline]
WARNING: CPU: 0 PID: 10724 at lib/debugobjects.c:517 debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
Modules linked in:
CPU: 0 PID: 10724 Comm: syz-executor.4 Not tainted 6.7.0-rc5-syzkaller-00083-gd5b235ec8eab-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : debug_print_object lib/debugobjects.c:514 [inline]
pc : debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
lr : debug_print_object lib/debugobjects.c:514 [inline]
lr : debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
sp : ffff800080007a00
x29: ffff800080007ad0 x28: dfff800000000000 x27: ffff700010000f44
x26: 0000000000000000 x25: ffff0000da75c900 x24: 0000000000000000
x23: ffff80008a9af3a0 x22: ffff80008ae8cdc0 x21: 0000000000000001
x20: ffff80008a9af3a0 x19: ffff0000da75c900 x18: ffff800080006ee0
x17: 6631343761303430 x16: ffff80008a82f460 x15: 0000000000000001
x14: 1fffe0003682623a x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000010004 x10: 0000000000ff0100 x9 : f1155cbcba9a1100
x8 : f1155cbcba9a1100 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff8000800072f8 x4 : ffff80008e5d2600 x3 : ffff8000805ad1c0
x2 : 0000000000000001 x1 : 0000000100010002 x0 : 0000000000000000
Call trace:
debug_print_object lib/debugobjects.c:514 [inline]
debug_object_activate+0x578/0x7e0 lib/debugobjects.c:733
debug_rcu_head_queue kernel/rcu/rcu.h:227 [inline]
__call_rcu_common kernel/rcu/tree.c:2666 [inline]
call_rcu+0x48/0xaf4 kernel/rcu/tree.c:2795
switch_schedules net/sched/sch_taprio.c:210 [inline]
advance_sched+0x7e0/0xac0 net/sched/sch_taprio.c:984
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1814
timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
__gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
__gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:886
do_interrupt_handler+0xd4/0x138 arch/arm64/kernel/entry-common.c:276
__el1_irq arch/arm64/kernel/entry-common.c:502 [inline]
el1_interrupt+0x34/0x68 arch/arm64/kernel/entry-common.c:517
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:522
el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:591
__daif_local_irq_restore arch/arm64/include/asm/irqflags.h:176 [inline]
arch_local_irq_restore arch/arm64/include/asm/irqflags.h:196 [inline]
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
_raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:194
unlock_hrtimer_base kernel/time/hrtimer.c:1020 [inline]
hrtimer_start_range_ns+0x8a0/0x9ac kernel/time/hrtimer.c:1304
hrtimer_start include/linux/hrtimer.h:418 [inline]
taprio_dump+0xa40/0xc68 net/sched/sch_taprio.c:2444
tc_fill_qdisc+0x570/0xf1c net/sched/sch_api.c:952
qdisc_notify+0x1a0/0x338 net/sched/sch_api.c:1024
tc_modify_qdisc+0x16d4/0x1870 net/sched/sch_api.c:1719
rtnetlink_rcv_msg+0x748/0xdbc net/core/rtnetlink.c:6558
netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2545
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6576
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x83c/0xb20 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x56c/0x840 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x26c/0x33c net/socket.c:2667
__do_sys_sendmsg net/socket.c:2676 [inline]
__se_sys_sendmsg net/socket.c:2674 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2674
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595
irq event stamp: 2628
hardirqs last enabled at (2627): [<ffff80008a91ca44>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last enabled at (2627): [<ffff80008a91ca44>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:194
hardirqs last disabled at (2628): [<ffff80008a82b044>] __el1_irq arch/arm64/kernel/entry-common.c:499 [inline]
hardirqs last disabled at (2628): [<ffff80008a82b044>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:517
softirqs last enabled at (2616): [<ffff800088d03038>] spin_unlock_bh include/linux/spinlock.h:396 [inline]
softirqs last enabled at (2616): [<ffff800088d03038>] taprio_change+0x3504/0x3d40 net/sched/sch_taprio.c:2010
softirqs last disabled at (2608): [<ffff800088d029c0>] spin_lock_bh include/linux/spinlock.h:356 [inline]
softirqs last disabled at (2608): [<ffff800088d029c0>] taprio_change+0x2e8c/0x3d40 net/sched/sch_taprio.c:1943
---[ end trace 0000000000000000 ]---
------------[ cut here ]------------
ODEBUG: active_state active (active state 1) object: 0000000040a741f2 object type: rcu_head hint: 0x0
WARNING: CPU: 0 PID: 10724 at lib/debugobjects.c:517 debug_print_object lib/debugobjects.c:514 [inline]
WARNING: CPU: 0 PID: 10724 at lib/debugobjects.c:517 debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
Modules linked in:
CPU: 0 PID: 10724 Comm: syz-executor.4 Tainted: G W 6.7.0-rc5-syzkaller-00083-gd5b235ec8eab-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : debug_print_object lib/debugobjects.c:514 [inline]
pc : debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
lr : debug_print_object lib/debugobjects.c:514 [inline]
lr : debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
sp : ffff800080007ac0
x29: ffff800080007ad0 x28: ffff80008e4f0000 x27: dfff800000000000
x26: 1fffe0001ac85cf7 x25: ffff800092d4d000 x24: 1fffe0001ac85cf8
x23: 0000000000000000 x22: ffff0000da75c900 x21: ffff80008a9af3a0
x20: ffff80008ae8cdc0 x19: 0000000000000001 x18: ffff800080006ee0
x17: 6130343030303030 x16: ffff80008a82f460 x15: 0000000000000001
x14: 1fffe0003682623a x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000010004 x10: 0000000000ff0100 x9 : f1155cbcba9a1100
x8 : f1155cbcba9a1100 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff8000800073b8 x4 : ffff80008e5d2600 x3 : ffff8000805ad1c0
x2 : 0000000000000001 x1 : 0000000100010002 x0 : 0000000000000000
Call trace:
debug_print_object lib/debugobjects.c:514 [inline]
debug_object_active_state+0x2e4/0x414 lib/debugobjects.c:993
debug_rcu_head_queue kernel/rcu/rcu.h:228 [inline]
__call_rcu_common kernel/rcu/tree.c:2666 [inline]
call_rcu+0x60/0xaf4 kernel/rcu/tree.c:2795
switch_schedules net/sched/sch_taprio.c:210 [inline]
advance_sched+0x7e0/0xac0 net/sched/sch_taprio.c:984
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1814
timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
__gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
__gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:886
do_interrupt_handler+0xd4/0x138 arch/arm64/kernel/entry-common.c:276
__el1_irq arch/arm64/kernel/entry-common.c:502 [inline]
el1_interrupt+0x34/0x68 arch/arm64/kernel/entry-common.c:517
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:522
el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:591
__daif_local_irq_restore arch/arm64/include/asm/irqflags.h:176 [inline]
arch_local_irq_restore arch/arm64/include/asm/irqflags.h:196 [inline]
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
_raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:194
unlock_hrtimer_base kernel/time/hrtimer.c:1020 [inline]
hrtimer_start_range_ns+0x8a0/0x9ac kernel/time/hrtimer.c:1304
hrtimer_start include/linux/hrtimer.h:418 [inline]
taprio_dump+0xa40/0xc68 net/sched/sch_taprio.c:2444
tc_fill_qdisc+0x570/0xf1c net/sched/sch_api.c:952
qdisc_notify+0x1a0/0x338 net/sched/sch_api.c:1024
tc_modify_qdisc+0x16d4/0x1870 net/sched/sch_api.c:1719
rtnetlink_rcv_msg+0x748/0xdbc net/core/rtnetlink.c:6558
netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2545
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6576
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x83c/0xb20 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x56c/0x840 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x26c/0x33c net/socket.c:2667
__do_sys_sendmsg net/socket.c:2676 [inline]
__se_sys_sendmsg net/socket.c:2674 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2674
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595
irq event stamp: 2628
hardirqs last enabled at (2627): [<ffff80008a91ca44>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last enabled at (2627): [<ffff80008a91ca44>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:194
hardirqs last disabled at (2628): [<ffff80008a82b044>] __el1_irq arch/arm64/kernel/entry-common.c:499 [inline]
hardirqs last disabled at (2628): [<ffff80008a82b044>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:517
softirqs last enabled at (2616): [<ffff800088d03038>] spin_unlock_bh include/linux/spinlock.h:396 [inline]
softirqs last enabled at (2616): [<ffff800088d03038>] taprio_change+0x3504/0x3d40 net/sched/sch_taprio.c:2010
softirqs last disabled at (2608): [<ffff800088d029c0>] spin_lock_bh include/linux/spinlock.h:356 [inline]
softirqs last disabled at (2608): [<ffff800088d029c0>] taprio_change+0x2e8c/0x3d40 net/sched/sch_taprio.c:1943
---[ end trace 0000000000000000 ]---
rcu: __call_rcu_common(): Double-freed CB 0000000040a741f2->taprio_free_sched_cb+0x0/0x178()!!! slab kmalloc-512 start ffff0000da75c800 pointer offset 256 size 512
Tested on:
commit: d5b235ec Merge branch 'for-next/core' into for-kernelci
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=11d6e2bee80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f36ea342ce412b14
dashboard link: https://syzkaller.appspot.com/bug?extid=d4d8c0fd15a0abe39bcf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=11e0f416e80000
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-18 14:33 [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump syzbot
2023-12-19 10:59 ` Hillf Danton
2023-12-20 11:15 ` Hillf Danton
@ 2023-12-21 4:36 ` Hillf Danton
2023-12-21 5:02 ` syzbot
2024-11-05 11:14 ` Jeongjun Park
3 siblings, 1 reply; 9+ messages in thread
From: Hillf Danton @ 2023-12-21 4:36 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Mon, 18 Dec 2023 06:33:26 -0800
> HEAD commit: d5b235ec8eab Merge branch 'for-next/core' into for-kernelci
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15e40371e80000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git d5b235ec8eab
--- x/net/sched/sch_taprio.c
+++ y/net/sched/sch_taprio.c
@@ -1941,6 +1941,9 @@ static int taprio_change(struct Qdisc *s
/* Protects against enqueue()/dequeue() */
spin_lock_bh(qdisc_lock(sch));
+ spin_lock_irqsave(&q->current_entry_lock, flags);
+ oper = rtnl_dereference(q->oper_sched);
+ admin = rtnl_dereference(q->admin_sched);
if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
if (!TXTIME_ASSIST_IS_ENABLED(q->flags)) {
@@ -1981,17 +1984,12 @@ static int taprio_change(struct Qdisc *s
} else {
setup_first_end_time(q, new_admin, start);
- /* Protects against advance_sched() */
- spin_lock_irqsave(&q->current_entry_lock, flags);
-
taprio_start_sched(sch, start, new_admin);
rcu_assign_pointer(q->admin_sched, new_admin);
if (admin)
call_rcu(&admin->rcu, taprio_free_sched_cb);
- spin_unlock_irqrestore(&q->current_entry_lock, flags);
-
if (FULL_OFFLOAD_IS_ENABLED(q->flags))
taprio_offload_config_changed(q);
}
@@ -2004,6 +2002,7 @@ static int taprio_change(struct Qdisc *s
"Size table not specified, frame length estimations may be inaccurate");
unlock:
+ spin_unlock_irqrestore(&q->current_entry_lock, flags);
spin_unlock_bh(qdisc_lock(sch));
free_sched:
@@ -2393,6 +2392,7 @@ static int taprio_dump(struct Qdisc *sch
struct sched_gate_list *oper, *admin;
struct tc_mqprio_qopt opt = { 0 };
struct nlattr *nest, *sched_nest;
+ int active = hrtimer_cancel(&q->advance_timer);
oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);
@@ -2436,6 +2436,10 @@ static int taprio_dump(struct Qdisc *sch
nla_nest_end(skb, sched_nest);
done:
+ if (active)
+ hrtimer_start(&q->advance_timer,
+ hrtimer_get_expires(&q->advance_timer),
+ HRTIMER_MODE_ABS);
return nla_nest_end(skb, nest);
admin_error:
@@ -2445,6 +2449,10 @@ options_error:
nla_nest_cancel(skb, nest);
start_error:
+ if (active)
+ hrtimer_start(&q->advance_timer,
+ hrtimer_get_expires(&q->advance_timer),
+ HRTIMER_MODE_ABS);
return -ENOSPC;
}
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-21 4:36 ` Hillf Danton
@ 2023-12-21 5:02 ` syzbot
0 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-12-21 5:02 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+d4d8c0fd15a0abe39bcf@syzkaller.appspotmail.com
Tested on:
commit: d5b235ec Merge branch 'for-next/core' into for-kernelci
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10924b06e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f36ea342ce412b14
dashboard link: https://syzkaller.appspot.com/bug?extid=d4d8c0fd15a0abe39bcf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=177ca826e80000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2023-12-18 14:33 [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump syzbot
` (2 preceding siblings ...)
2023-12-21 4:36 ` Hillf Danton
@ 2024-11-05 11:14 ` Jeongjun Park
2024-11-05 20:41 ` syzbot
3 siblings, 1 reply; 9+ messages in thread
From: Jeongjun Park @ 2024-11-05 11:14 UTC (permalink / raw)
To: syzbot+d4d8c0fd15a0abe39bcf; +Cc: linux-kernel, syzkaller-bugs
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8a7d12d674ac6f2147c18f36d1e15f1a48060edf
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump
2024-11-05 11:14 ` Jeongjun Park
@ 2024-11-05 20:41 ` syzbot
0 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2024-11-05 20:41 UTC (permalink / raw)
To: aha310510, 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 taprio_dump
==================================================================
BUG: KASAN: slab-use-after-free in taprio_dump_tc_entries net/sched/sch_taprio.c:2286 [inline]
BUG: KASAN: slab-use-after-free in taprio_dump+0x857/0xd50 net/sched/sch_taprio.c:2399
Read of size 4 at addr ffff8880774444c0 by task syz-executor.0/7739
CPU: 0 UID: 0 PID: 7739 Comm: syz-executor.0 Not tainted 6.12.0-rc3-syzkaller-00163-g8a7d12d674ac #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
taprio_dump_tc_entries net/sched/sch_taprio.c:2286 [inline]
taprio_dump+0x857/0xd50 net/sched/sch_taprio.c:2399
tc_fill_qdisc+0x6a7/0x11f0 net/sched/sch_api.c:951
qdisc_notify+0x2ec/0x4b0 net/sched/sch_api.c:1052
tc_modify_qdisc+0x1c58/0x1e40 net/sched/sch_api.c:1754
rtnetlink_rcv_msg+0x73f/0xcf0 net/core/rtnetlink.c:6675
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2551
netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline]
netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357
netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:729 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:744
____sys_sendmsg+0x52a/0x7e0 net/socket.c:2607
___sys_sendmsg net/socket.c:2661 [inline]
__sys_sendmsg+0x292/0x380 net/socket.c:2690
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb320c7de69
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:00007fb3219990c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fb320dabf80 RCX: 00007fb320c7de69
RDX: 0000000000000000 RSI: 00000000200007c0 RDI: 0000000000000003
RBP: 00007fb320cca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fb320dabf80 R15: 00007fff29f54758
</TASK>
Allocated by task 7731:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:257 [inline]
__kmalloc_cache_noprof+0x19c/0x2c0 mm/slub.c:4295
kmalloc_noprof include/linux/slab.h:878 [inline]
kzalloc_noprof include/linux/slab.h:1014 [inline]
taprio_change+0x1037/0x44c0 net/sched/sch_taprio.c:1859
qdisc_change net/sched/sch_api.c:1422 [inline]
tc_modify_qdisc+0x190d/0x1e40 net/sched/sch_api.c:1752
rtnetlink_rcv_msg+0x73f/0xcf0 net/core/rtnetlink.c:6675
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2551
netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline]
netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357
netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:729 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:744
____sys_sendmsg+0x52a/0x7e0 net/socket.c:2607
___sys_sendmsg net/socket.c:2661 [inline]
__sys_sendmsg+0x292/0x380 net/socket.c:2690
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 1035:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:2342 [inline]
slab_free mm/slub.c:4579 [inline]
kfree+0x1a0/0x440 mm/slub.c:4727
rcu_do_batch kernel/rcu/tree.c:2567 [inline]
rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
handle_softirqs+0x2c5/0x980 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
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541
__call_rcu_common kernel/rcu/tree.c:3086 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:3190
taprio_change+0x265d/0x44c0 net/sched/sch_taprio.c:1970
qdisc_change net/sched/sch_api.c:1422 [inline]
tc_modify_qdisc+0x190d/0x1e40 net/sched/sch_api.c:1752
rtnetlink_rcv_msg+0x73f/0xcf0 net/core/rtnetlink.c:6675
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2551
netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline]
netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357
netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:729 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:744
____sys_sendmsg+0x52a/0x7e0 net/socket.c:2607
___sys_sendmsg net/socket.c:2661 [inline]
__sys_sendmsg+0x292/0x380 net/socket.c:2690
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888077444400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 192 bytes inside of
freed 512-byte region [ffff888077444400, ffff888077444600)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888077447800 pfn:0x77444
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff888015441c80 0000000000000000 dead000000000001
raw: ffff888077447800 000000008010000f 00000001f5000000 0000000000000000
head: 00fff00000000040 ffff888015441c80 0000000000000000 dead000000000001
head: ffff888077447800 000000008010000f 00000001f5000000 0000000000000000
head: 00fff00000000002 ffffea0001dd1101 ffffffffffffffff 0000000000000000
head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4553, tgid 4553 (udevadm), ts 16557674621, free_ts 13771592324
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
prep_new_page mm/page_alloc.c:1545 [inline]
get_page_from_freelist+0x3045/0x3190 mm/page_alloc.c:3457
__alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4733
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
alloc_slab_page+0x6a/0x120 mm/slub.c:2412
allocate_slab+0x5a/0x2f0 mm/slub.c:2578
new_slab mm/slub.c:2631 [inline]
___slab_alloc+0xcd1/0x14b0 mm/slub.c:3818
__slab_alloc+0x58/0xa0 mm/slub.c:3908
__slab_alloc_node mm/slub.c:3961 [inline]
slab_alloc_node mm/slub.c:4122 [inline]
__kmalloc_cache_noprof+0x1d5/0x2c0 mm/slub.c:4290
kmalloc_noprof include/linux/slab.h:878 [inline]
kzalloc_noprof include/linux/slab.h:1014 [inline]
kernfs_fop_open+0x3e0/0xd10 fs/kernfs/file.c:623
do_dentry_open+0x978/0x1460 fs/open.c:958
vfs_open+0x3e/0x330 fs/open.c:1088
do_open fs/namei.c:3774 [inline]
path_openat+0x2c84/0x3590 fs/namei.c:3933
do_filp_open+0x235/0x490 fs/namei.c:3960
do_sys_openat2+0x13e/0x1d0 fs/open.c:1415
do_sys_open fs/open.c:1430 [inline]
__do_sys_openat fs/open.c:1446 [inline]
__se_sys_openat fs/open.c:1441 [inline]
__x64_sys_openat+0x247/0x2a0 fs/open.c:1441
page last free pid 1 tgid 1 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1108 [inline]
free_unref_page+0xcfb/0xf20 mm/page_alloc.c:2638
free_contig_range+0x152/0x550 mm/page_alloc.c:6748
destroy_args+0x8a/0x840 mm/debug_vm_pgtable.c:1017
debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1397
do_one_initcall+0x248/0x880 init/main.c:1269
do_initcall_level+0x157/0x210 init/main.c:1331
do_initcalls+0x3f/0x80 init/main.c:1347
kernel_init_freeable+0x435/0x5d0 init/main.c:1580
kernel_init+0x1d/0x2b0 init/main.c:1469
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Memory state around the buggy address:
ffff888077444380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888077444400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888077444480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888077444500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888077444580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Tested on:
commit: 8a7d12d6 net: usb: usbnet: fix name regression
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=15bf8e30580000
kernel config: https://syzkaller.appspot.com/x/.config?x=fd7a8d0218abac59
dashboard link: https://syzkaller.appspot.com/bug?extid=d4d8c0fd15a0abe39bcf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
Note: no patches were applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-11-05 20:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-18 14:33 [syzbot] [net?] KASAN: slab-use-after-free Read in taprio_dump syzbot
2023-12-19 10:59 ` Hillf Danton
2023-12-19 11:20 ` syzbot
2023-12-20 11:15 ` Hillf Danton
2023-12-20 12:44 ` syzbot
2023-12-21 4:36 ` Hillf Danton
2023-12-21 5:02 ` syzbot
2024-11-05 11:14 ` Jeongjun Park
2024-11-05 20:41 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox