bisecting cause commit starting from e69ec487b2c7c82ef99b4b15122f58a2a99289a3 building syzkaller on 4de4e9f01d7139b72102ae0b8a1e810730467774 testing commit e69ec487b2c7c82ef99b4b15122f58a2a99289a3 with gcc (GCC) 8.1.0 kernel signature: c75c9c8d384e71e765b15f5a9256d0da4f4711e5 all runs: crashed: general protection fault in tcf_ife_cleanup testing release v5.4 testing commit 219d54332a09e8d8741c1e1982f5eae56099de85 with gcc (GCC) 8.1.0 kernel signature: 97b37299af1cd654c97742faa4fff5f8f2095455 all runs: crashed: general protection fault in tcf_ife_cleanup testing release v5.3 testing commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8 with gcc (GCC) 8.1.0 kernel signature: f45414f426a054655f17424b40a54d639384fa0b all runs: crashed: general protection fault in tcf_ife_cleanup testing release v5.2 testing commit 0ecfebd2b52404ae0c54a878c872bb93363ada36 with gcc (GCC) 8.1.0 kernel signature: eb7f41727c97e8aa4e2f87cf15cd8cddb784c3dc all runs: crashed: general protection fault in tcf_ife_cleanup testing release v5.1 testing commit e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd with gcc (GCC) 8.1.0 kernel signature: 26a2738a89b6452fa508f59a08f75a923b520a40 all runs: crashed: general protection fault in tcf_ife_cleanup testing release v5.0 testing commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 with gcc (GCC) 8.1.0 kernel signature: c04a72179eb90974cf70c6dafc5a0261d2f92d15 all runs: OK # git bisect start e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd 1c163f4c7b3f621efff9b28a47abb36f7378d783 Bisecting: 7074 revisions left to test after this (roughly 13 steps) [b5dd0c658c31b469ccff1b637e5124851e7a4a1c] Merge branch 'akpm' (patches from Andrew) testing commit b5dd0c658c31b469ccff1b637e5124851e7a4a1c with gcc (GCC) 8.1.0 kernel signature: c96fc727e550ee1e22cc8dcb8fe57f529e31d86b all runs: OK # git bisect good b5dd0c658c31b469ccff1b637e5124851e7a4a1c Bisecting: 3573 revisions left to test after this (roughly 12 steps) [4f0237062ca70c8e34e16e518aee4b84c30d1832] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input testing commit 4f0237062ca70c8e34e16e518aee4b84c30d1832 with gcc (GCC) 8.1.0 kernel signature: 2945ce9a5ce559d3ae1fee412330b55f93b9ff09 all runs: OK # git bisect good 4f0237062ca70c8e34e16e518aee4b84c30d1832 Bisecting: 1796 revisions left to test after this (roughly 11 steps) [345077c8e172c255ea0707214303ccd099e5656b] KVM: PPC: Book3S: Protect memslots while validating user address testing commit 345077c8e172c255ea0707214303ccd099e5656b with gcc (GCC) 8.1.0 kernel signature: 5ceff2521a3991407a1bc59591f78536cd14a6ae all runs: OK # git bisect good 345077c8e172c255ea0707214303ccd099e5656b Bisecting: 898 revisions left to test after this (roughly 10 steps) [8065a779f17e94536a1c4dcee4f9d88011672f97] failover: allow name change on IFF_UP slave interfaces testing commit 8065a779f17e94536a1c4dcee4f9d88011672f97 with gcc (GCC) 8.1.0 kernel signature: 1d3a1e6d1ea32a81b461a4ad66eee45745cb4820 all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad 8065a779f17e94536a1c4dcee4f9d88011672f97 Bisecting: 444 revisions left to test after this (roughly 9 steps) [32faca66bd3f6aa7ec4212d20c7b2d45657fab10] Merge tag 'staging-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging testing commit 32faca66bd3f6aa7ec4212d20c7b2d45657fab10 with gcc (GCC) 8.1.0 kernel signature: 7c1d70dff2a150ede9ba5ddcb5c56ea567930105 all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad 32faca66bd3f6aa7ec4212d20c7b2d45657fab10 Bisecting: 219 revisions left to test after this (roughly 8 steps) [97c41a6bdce506bad1cce623378656a5cb956a18] Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc testing commit 97c41a6bdce506bad1cce623378656a5cb956a18 with gcc (GCC) 8.1.0 kernel signature: f4a7451759fc3dd86006891a3060b398745848a6 all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad 97c41a6bdce506bad1cce623378656a5cb956a18 Bisecting: 115 revisions left to test after this (roughly 7 steps) [cb8075d934ec6111f8f660eb4cba5a8c93cd13eb] Merge branch 'ks8851-fixes' testing commit cb8075d934ec6111f8f660eb4cba5a8c93cd13eb with gcc (GCC) 8.1.0 kernel signature: 301120ada211843f3f98ed83f04e4afa3cb62511 all runs: OK # git bisect good cb8075d934ec6111f8f660eb4cba5a8c93cd13eb Bisecting: 57 revisions left to test after this (roughly 6 steps) [1eec7151ae0e134bd42e3f128066b2ff8da21393] net: dsa: qca8k: remove leftover phy accessors testing commit 1eec7151ae0e134bd42e3f128066b2ff8da21393 with gcc (GCC) 8.1.0 kernel signature: 0fb3e31c2c82dd196b4d1ec6eb6ad31c8614e22f all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad 1eec7151ae0e134bd42e3f128066b2ff8da21393 Bisecting: 28 revisions left to test after this (roughly 5 steps) [7c3d825d12c5e6056ea73c0a202cbdef9d9ab9e6] net/sched: act_skbmod: validate the control action inside init() testing commit 7c3d825d12c5e6056ea73c0a202cbdef9d9ab9e6 with gcc (GCC) 8.1.0 kernel signature: a30c5e8356f175a3bfffe503038e3eef979c064e all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad 7c3d825d12c5e6056ea73c0a202cbdef9d9ab9e6 Bisecting: 14 revisions left to test after this (roughly 4 steps) [06acc17a96215a11134114aee26532b12dc8fde1] net: phy: Add DP83825I to the DP83822 driver testing commit 06acc17a96215a11134114aee26532b12dc8fde1 with gcc (GCC) 8.1.0 kernel signature: b31a8cf95c4bfa53d9e3877eed7960fde7460e24 all runs: OK # git bisect good 06acc17a96215a11134114aee26532b12dc8fde1 Bisecting: 7 revisions left to test after this (roughly 3 steps) [ff9721d32b1aba8bf46a06df20827d0a5d52ec48] net/sched: act_mirred: validate the control action inside init() testing commit ff9721d32b1aba8bf46a06df20827d0a5d52ec48 with gcc (GCC) 8.1.0 kernel signature: d5f34fa4b59833942248a82205bc249bda958759 all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad ff9721d32b1aba8bf46a06df20827d0a5d52ec48 Bisecting: 3 revisions left to test after this (roughly 2 steps) [4e1810049c267c203c19130301203d0591174535] net/sched: act_bpf: validate the control action inside init() testing commit 4e1810049c267c203c19130301203d0591174535 with gcc (GCC) 8.1.0 kernel signature: 1d6d8cecba0e2d935da758c815411394c571b5c5 all runs: OK # git bisect good 4e1810049c267c203c19130301203d0591174535 Bisecting: 1 revision left to test after this (roughly 1 step) [0da2dbd6029c2be4191651bafa57c3c006eff63c] net/sched: act_gact: validate the control action inside init() testing commit 0da2dbd6029c2be4191651bafa57c3c006eff63c with gcc (GCC) 8.1.0 kernel signature: d7a0f3bebc4fd41ea120424e64d3fcc9bfbb2c77 all runs: OK # git bisect good 0da2dbd6029c2be4191651bafa57c3c006eff63c Bisecting: 0 revisions left to test after this (roughly 0 steps) [11a94d7fd80f92325e7b8653290ad3d2cd67f119] net/sched: act_ife: validate the control action inside init() testing commit 11a94d7fd80f92325e7b8653290ad3d2cd67f119 with gcc (GCC) 8.1.0 kernel signature: 62329cf57ec82cf6f3aeb9298cc475c81f47167a all runs: crashed: general protection fault in tcf_ife_cleanup # git bisect bad 11a94d7fd80f92325e7b8653290ad3d2cd67f119 11a94d7fd80f92325e7b8653290ad3d2cd67f119 is the first bad commit commit 11a94d7fd80f92325e7b8653290ad3d2cd67f119 Author: Davide Caratti Date: Wed Mar 20 15:00:03 2019 +0100 net/sched: act_ife: validate the control action inside init() the following script: # tc qdisc add dev crash0 clsact # tc filter add dev crash0 egress matchall \ > action ife encode allow mark pass index 90 # tc actions replace action ife \ > encode allow mark goto chain 42 index 90 cookie c1a0c1a0 # tc action show action ife had the following output: IFE type 0xED3E IFE type 0xED3E Error: Failed to init TC action chain. We have an error talking to the kernel total acts 1 action order 0: ife encode action goto chain 42 type 0XED3E allow mark index 90 ref 2 bind 1 cookie c1a0c1a0 Then, the first packet transmitted by crash0 made the kernel crash: BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 #PF error: [normal kernel read fault] PGD 800000007b4e7067 P4D 800000007b4e7067 PUD 7b4e6067 PMD 0 Oops: 0000 [#1] SMP PTI CPU: 2 PID: 164 Comm: kworker/2:1 Not tainted 5.0.0-rc4.gotochain_crash+ #533 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 Workqueue: ipv6_addrconf addrconf_dad_work RIP: 0010:tcf_action_exec+0xb8/0x100 Code: 00 00 00 20 74 1d 83 f8 03 75 09 49 83 c4 08 4d 39 ec 75 bc 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 49 8b 97 a8 00 00 00 <48> 8b 12 48 89 55 00 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 RSP: 0018:ffffa6a7c0553ad0 EFLAGS: 00010246 RAX: 000000002000002a RBX: ffff9796ee1bbd00 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffa6a7c0553b70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: ffff9797385bb038 R12: ffff9796ead9d700 R13: ffff9796ead9d708 R14: 0000000000000001 R15: ffff9796ead9d800 FS: 0000000000000000(0000) GS:ffff97973db00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000007c41e006 CR4: 00000000001606e0 Call Trace: tcf_classify+0x58/0x120 __dev_queue_xmit+0x40a/0x890 ? ndisc_next_option+0x50/0x50 ? ___neigh_create+0x4d5/0x680 ? ip6_finish_output2+0x1b5/0x590 ip6_finish_output2+0x1b5/0x590 ? ip6_output+0x68/0x110 ip6_output+0x68/0x110 ? nf_hook.constprop.28+0x79/0xc0 ndisc_send_skb+0x248/0x2e0 ndisc_send_ns+0xf8/0x200 ? addrconf_dad_work+0x389/0x4b0 addrconf_dad_work+0x389/0x4b0 ? __switch_to_asm+0x34/0x70 ? process_one_work+0x195/0x380 ? addrconf_dad_completed+0x370/0x370 process_one_work+0x195/0x380 worker_thread+0x30/0x390 ? process_one_work+0x380/0x380 kthread+0x113/0x130 ? kthread_park+0x90/0x90 ret_from_fork+0x35/0x40 Modules linked in: act_gact act_meta_mark act_ife dummy veth ip6table_filter ip6_tables iptable_filter binfmt_misc snd_hda_codec_generic ext4 snd_hda_intel snd_hda_codec crct10dif_pclmul mbcache crc32_pclmul jbd2 snd_hwdep snd_hda_core ghash_clmulni_intel snd_seq snd_seq_device snd_pcm snd_timer aesni_intel crypto_simd snd cryptd glue_helper virtio_balloon joydev pcspkr soundcore i2c_piix4 nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs ata_generic pata_acpi qxl virtio_net drm_kms_helper virtio_blk net_failover syscopyarea failover sysfillrect virtio_console sysimgblt fb_sys_fops ttm drm crc32c_intel serio_raw ata_piix virtio_pci virtio_ring libata virtio floppy dm_mirror dm_region_hash dm_log dm_mod [last unloaded: act_ife] CR2: 0000000000000000 Validating the control action within tcf_ife_init() proved to fix the above issue. A TDC selftest is added to verify the correct behavior. Fixes: db50514f9a9c ("net: sched: add termination action to allow goto chain") Fixes: 97763dc0f401 ("net_sched: reject unknown tcfa_action values") Signed-off-by: Davide Caratti Signed-off-by: David S. Miller net/sched/act_ife.c | 33 +++++++++++++--------- .../selftests/tc-testing/tc-tests/actions/ife.json | 25 ++++++++++++++++ 2 files changed, 45 insertions(+), 13 deletions(-) culprit signature: 62329cf57ec82cf6f3aeb9298cc475c81f47167a parent signature: d7a0f3bebc4fd41ea120424e64d3fcc9bfbb2c77 revisions tested: 20, total time: 4h1m40.726813005s (build: 1h57m29.823702896s, test: 2h2m16.64252692s) first bad commit: 11a94d7fd80f92325e7b8653290ad3d2cd67f119 net/sched: act_ife: validate the control action inside init() cc: ["davem@davemloft.net" "dcaratti@redhat.com" "jhs@mojatatu.com" "jiri@resnulli.us" "linux-kernel@vger.kernel.org" "linux-kselftest@vger.kernel.org" "netdev@vger.kernel.org" "shuah@kernel.org" "stephen@networkplumber.org" "xiyou.wangcong@gmail.com"] crash: general protection fault in tcf_ife_cleanup netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'. kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 7213 Comm: syz-executor.3 Not tainted 5.0.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:_tcf_ife_cleanup net/sched/act_ife.c:417 [inline] RIP: 0010:tcf_ife_cleanup+0x67/0x3d0 net/sched/act_ife.c:436 Code: c1 ea 03 80 3c 02 00 0f 85 74 03 00 00 4d 8b bc 24 e8 00 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8d 77 e8 4c 89 f9 48 c1 e9 03 <80> 3c 01 00 0f 85 40 03 00 00 49 8b 07 4c 89 ff 49 bf 00 00 00 00 RSP: 0018:ffff88808630ede0 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffff88808c4c7700 RCX: 0000000000000000 RDX: 1ffff11011898efd RSI: 0000000000000004 RDI: ffff88808630ed48 RBP: ffff88808630ee30 R08: ffffed1010c61daa R09: ffffed1010c61da9 R10: ffffed1010c61da9 R11: 0000000000000003 R12: ffff88808c4c7700 R13: ffff88808c4c77e8 R14: ffffffffffffffe8 R15: 0000000000000000 FS: 00007f99ba6c5700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fff46f3af00 CR3: 0000000094a00000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: tcf_action_cleanup+0x57/0x170 net/sched/act_api.c:127 __tcf_action_put+0xc1/0x100 net/sched/act_api.c:143 __tcf_idr_release+0x6a/0x90 net/sched/act_api.c:173 tcf_idr_release include/net/act_api.h:160 [inline] tcf_ife_init+0x997/0x1420 net/sched/act_ife.c:611 tcf_action_init_1+0x6b7/0x9c0 net/sched/act_api.c:915 tcf_action_init+0x178/0x300 net/sched/act_api.c:970 tcf_action_add+0xdb/0x360 net/sched/act_api.c:1355 tc_ctl_action+0x2c0/0x401 net/sched/act_api.c:1407 rtnetlink_rcv_msg+0x34f/0x8f0 net/core/rtnetlink.c:5192 netlink_rcv_skb+0x13c/0x380 net/netlink/af_netlink.c:2485 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:5210 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x43b/0x640 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x765/0xc40 net/netlink/af_netlink.c:1925 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:661 ___sys_sendmsg+0x647/0x950 net/socket.c:2260 __sys_sendmsg+0xd9/0x180 net/socket.c:2298 __do_sys_sendmsg net/socket.c:2307 [inline] __se_sys_sendmsg net/socket.c:2305 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2305 do_syscall_64+0xd0/0x4d0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45af49 Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f99ba6c4c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045af49 RDX: 0000000000000000 RSI: 0000000020007300 RDI: 0000000000000003 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f99ba6c56d4 R13: 00000000004ca9fe R14: 00000000004e3e78 R15: 00000000ffffffff Modules linked in: ---[ end trace 62a189dc796e009a ]--- RIP: 0010:_tcf_ife_cleanup net/sched/act_ife.c:417 [inline] RIP: 0010:tcf_ife_cleanup+0x67/0x3d0 net/sched/act_ife.c:436 Code: c1 ea 03 80 3c 02 00 0f 85 74 03 00 00 4d 8b bc 24 e8 00 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8d 77 e8 4c 89 f9 48 c1 e9 03 <80> 3c 01 00 0f 85 40 03 00 00 49 8b 07 4c 89 ff 49 bf 00 00 00 00 RSP: 0018:ffff88808630ede0 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffff88808c4c7700 RCX: 0000000000000000 RDX: 1ffff11011898efd RSI: 0000000000000004 RDI: ffff88808630ed48 RBP: ffff88808630ee30 R08: ffffed1010c61daa R09: ffffed1010c61da9 R10: ffffed1010c61da9 R11: 0000000000000003 R12: ffff88808c4c7700 R13: ffff88808c4c77e8 R14: ffffffffffffffe8 R15: 0000000000000000 FS: 00007f99ba6c5700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fff46f3af00 CR3: 0000000094a00000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400