Re: KASAN: use-after-free Read in tick_sched_handle (3)

From: Frederic Weisbecker
Date: Mon Nov 19 2018 - 23:17:10 EST


On Mon, Nov 19, 2018 at 01:39:02PM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: bae4e109837b mlxsw: spectrum: Expose discard counters via ..
> git tree: net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=11b5e77b400000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d86f24333880b605
> dashboard link: https://syzkaller.appspot.com/bug?extid=999bca54de2ee169c021
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14b7d093400000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1487a225400000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+999bca54de2ee169c021@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
> IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
> 8021q: adding VLAN 0 to HW filter on device team0
> ==================================================================
> kasan: CONFIG_KASAN_INLINE enabled
> BUG: KASAN: use-after-free in tick_sched_handle+0x16c/0x180
> kernel/time/tick-sched.c:164

So tick_sched_timer() -> tick_sched_handle() is passed regs returned by
get_irq_regs() that seem to be junk.

Those regs should come from smp_apic_timer_interrupt().

Thoughts?