bpfilter: read fail -512 ================================================================== BUG: KASAN: use-after-free in io_is_direct include/linux/fs.h:3215 [inline] BUG: KASAN: use-after-free in iocb_flags include/linux/fs.h:3242 [inline] BUG: KASAN: use-after-free in init_sync_kiocb include/linux/fs.h:1952 [inline] BUG: KASAN: use-after-free in new_sync_write fs/read_write.c:470 [inline] BUG: KASAN: use-after-free in __vfs_write+0x9c0/0x9d0 fs/read_write.c:487 Read of size 8 at addr ffff8801d1c143c8 by task syz-executor3/4609 CPU: 0 PID: 4609 Comm: syz-executor3 Not tainted 4.17.0+ #118 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1b9/0x294 lib/dump_stack.c:113 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 io_is_direct include/linux/fs.h:3215 [inline] iocb_flags include/linux/fs.h:3242 [inline] init_sync_kiocb include/linux/fs.h:1952 [inline] new_sync_write fs/read_write.c:470 [inline] __vfs_write+0x9c0/0x9d0 fs/read_write.c:487 __kernel_write+0x10c/0x380 fs/read_write.c:506 __bpfilter_process_sockopt+0x1d8/0x35b net/bpfilter/bpfilter_kern.c:66 bpfilter_mbox_request+0x4d/0xb0 net/ipv4/bpfilter/sockopt.c:25 bpfilter_ip_get_sockopt+0x6b/0x90 net/ipv4/bpfilter/sockopt.c:42 compat_ip_getsockopt+0x256/0x2f0 net/ipv4/ip_sockglue.c:1600 inet_csk_compat_getsockopt+0x97/0x120 net/ipv4/inet_connection_sock.c:1023 compat_tcp_getsockopt+0x49/0x80 net/ipv4/tcp.c:3543 compat_sock_common_getsockopt+0xb4/0x150 net/core/sock.c:3023 __compat_sys_getsockopt+0x1ae/0x880 net/compat.c:532 __do_compat_sys_socketcall net/compat.c:916 [inline] __se_compat_sys_socketcall net/compat.c:844 [inline] __ia32_compat_sys_socketcall+0xcd1/0x1070 net/compat.c:844 do_syscall_32_irqs_on arch/x86/entry/common.c:323 [inline] do_fast_syscall_32+0x345/0xf9b arch/x86/entry/common.c:394 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7fb9cb9 Code: 55 08 8b 88 64 cd ff ff 8b 98 68 cd ff ff 89 c8 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 1c 24 c3 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:000000000845e340 EFLAGS: 00000206 ORIG_RAX: 0000000000000066 RAX: ffffffffffffffda RBX: 000000000000000f RCX: 000000000845e35c RDX: 000000000845e4a8 RSI: 000000000845e3b4 RDI: 000000000845eacc RBP: 000000000811fe18 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 2223: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554 alloc_inode+0xb2/0x190 fs/inode.c:212 new_inode_pseudo+0x69/0x1a0 fs/inode.c:895 get_pipe_inode fs/pipe.c:707 [inline] create_pipe_files+0x90/0x940 fs/pipe.c:748 umh_pipe_setup+0xac/0x430 kernel/umh.c:431 call_usermodehelper_exec_async+0x3c0/0x9e0 kernel/umh.c:93 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412 Freed by task 2223: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kmem_cache_free+0x86/0x2d0 mm/slab.c:3756 free_inode_nonrcu+0x1c/0x20 fs/inode.c:230 destroy_inode+0x151/0x1f0 fs/inode.c:267 evict+0x5cd/0x960 fs/inode.c:575 iput_final fs/inode.c:1506 [inline] iput+0x62d/0xa80 fs/inode.c:1532 dentry_unlink_inode+0x49a/0x620 fs/dcache.c:376 __dentry_kill+0x444/0x790 fs/dcache.c:568 dentry_kill+0xc9/0x5a0 fs/dcache.c:687 dput.part.26+0x65a/0x780 fs/dcache.c:848 dput+0x15/0x20 fs/dcache.c:830 __fput+0x558/0x890 fs/file_table.c:227 ____fput+0x15/0x20 fs/file_table.c:243 task_work_run+0x1e4/0x290 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x1aee/0x2730 kernel/exit.c:865 do_group_exit+0x16f/0x430 kernel/exit.c:968 __do_sys_exit_group kernel/exit.c:979 [inline] __se_sys_exit_group kernel/exit.c:977 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:977 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8801d1c141c0 which belongs to the cache inode_cache of size 944 The buggy address is located 520 bytes inside of 944-byte region [ffff8801d1c141c0, ffff8801d1c14570) The buggy address belongs to the page: page:ffffea0007470500 count:1 mapcount:0 mapping:ffff8801da986ac0 index:0xffff8801d1c14ffd flags: 0x2fffc0000000100(slab) raw: 02fffc0000000100 ffffea000753fc48 ffffea0007470308 ffff8801da986ac0 raw: ffff8801d1c14ffd ffff8801d1c141c0 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801d1c14280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d1c14300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801d1c14380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801d1c14400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d1c14480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================