x_tables: eb_tables: redirect target: used from hooks POSTROUTING, but only usable from PREROUTING/BROUTING ================================================================== BUG: KASAN: use-after-free in __list_del_entry_valid+0xf1/0x100 lib/list_debug.c:51 Read of size 8 at addr ffff8881b37e8b70 by task kworker/1:0/17 CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 4.20.0-rc6-next-20181210+ #164 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events_power_efficient neigh_periodic_work Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x244/0x39d lib/dump_stack.c:113 print_address_description.cold.4+0x9/0x1ff mm/kasan/report.c:187 kasan_report.cold.5+0x1b/0x39 mm/kasan/report.c:317 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135 __list_del_entry_valid+0xf1/0x100 lib/list_debug.c:51 __list_del_entry include/linux/list.h:117 [inline] list_del_init include/linux/list.h:159 [inline] neigh_mark_dead+0x13b/0x410 net/core/neighbour.c:125 neigh_periodic_work+0x89a/0xc30 net/core/neighbour.c:905 process_one_work+0xc90/0x1c40 kernel/workqueue.c:2153 worker_thread+0x17f/0x1390 kernel/workqueue.c:2296 kthread+0x35a/0x440 kernel/kthread.c:246 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352 Allocated by task 17972: save_stack+0x43/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] kasan_kmalloc+0xcb/0xd0 mm/kasan/common.c:482 __do_kmalloc_node mm/slab.c:3671 [inline] __kmalloc_node_track_caller+0x4d/0x70 mm/slab.c:3685 __kmalloc_reserve.isra.38+0x41/0xe0 net/core/skbuff.c:137 __alloc_skb+0x155/0x770 net/core/skbuff.c:205 __pskb_copy_fclone+0x16b/0xeb0 net/core/skbuff.c:1392 __pskb_copy include/linux/skbuff.h:1064 [inline] tipc_sk_mcast_rcv+0x6ff/0x1470 net/tipc/socket.c:1174 tipc_mcast_xmit+0xa0b/0xdb0 net/tipc/bcast.c:319 tipc_send_group_bcast+0xa1b/0xd90 net/tipc/socket.c:1051 __tipc_sendmsg+0xeec/0x1d40 net/tipc/socket.c:1307 tipc_sendmsg+0x50/0x70 net/tipc/socket.c:1272 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:632 ___sys_sendmsg+0x51d/0x930 net/socket.c:2117 __sys_sendmmsg+0x246/0x6d0 net/socket.c:2212 __do_sys_sendmmsg net/socket.c:2241 [inline] __se_sys_sendmmsg net/socket.c:2238 [inline] __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238 x_tables: eb_tables: redirect target: used from hooks POSTROUTING, but only usable from PREROUTING/BROUTING do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 17972: save_stack+0x43/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:444 kasan_slab_free+0xe/0x10 mm/kasan/common.c:452 __cache_free mm/slab.c:3485 [inline] kfree+0xcf/0x230 mm/slab.c:3804 skb_free_head+0x99/0xc0 net/core/skbuff.c:550 skb_release_data+0x70c/0x9a0 net/core/skbuff.c:570 skb_release_all+0x4a/0x60 net/core/skbuff.c:627 __kfree_skb net/core/skbuff.c:641 [inline] kfree_skb+0x1bb/0x580 net/core/skbuff.c:659 tipc_msg_reverse+0x67b/0x860 net/tipc/msg.c:554 tipc_sk_respond+0x2dc/0x620 net/tipc/socket.c:247 __tipc_shutdown+0x8b7/0xed0 net/tipc/socket.c:525 tipc_release+0x10e/0x1360 net/tipc/socket.c:574 __sock_release+0xd7/0x250 net/socket.c:580 sock_close+0x19/0x20 net/socket.c:1142 __fput+0x3bc/0xa90 fs/file_table.c:279 ____fput+0x15/0x20 fs/file_table.c:312 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x1a4d/0x2620 kernel/exit.c:867 do_group_exit+0x177/0x440 kernel/exit.c:970 __do_sys_exit_group kernel/exit.c:981 [inline] __se_sys_exit_group kernel/exit.c:979 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:979 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8881b37e8900 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 624 bytes inside of 1024-byte region [ffff8881b37e8900, ffff8881b37e8d00) The buggy address belongs to the page: page:ffffea0006cdfa00 count:1 mapcount:0 mapping:ffff8881da800ac0 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000010200(slab|head) raw: 02fffc0000010200 ffffea0006e4cd08 ffffea0006dc9088 ffff8881da800ac0 raw: 0000000000000000 ffff8881b37e8000 0000000100000007 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881b37e8a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881b37e8a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881b37e8b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881b37e8b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881b37e8c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================