* WARNING in cttimeout_default_get @ 2018-11-16 22:09 syzbot 2018-11-17 10:32 ` [PATCH nf] netfilter: nfnetlink_cttimeout: fetch timeouts for udplite and gre, too Florian Westphal 0 siblings, 1 reply; 3+ messages in thread From: syzbot @ 2018-11-16 22:09 UTC (permalink / raw) To: coreteam, davem, fw, kadlec, linux-kernel, netdev, netfilter-devel, pablo, syzkaller-bugs Hello, syzbot found the following crash on: HEAD commit: da5322e65940 Merge tag 'selinux-pr-20181115' of git://git... git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15d719eb400000 kernel config: https://syzkaller.appspot.com/x/.config?x=4a0a89f12ca9b0f5 dashboard link: https://syzkaller.appspot.com/bug?extid=2fae8fa157dd92618cae compiler: gcc (GCC) 8.0.1 20180413 (experimental) syz repro: https://syzkaller.appspot.com/x/repro.syz?x=129e0893400000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=125f66a3400000 IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+2fae8fa157dd92618cae@syzkaller.appspotmail.com audit: type=1800 audit(1542315810.422:30): pid=5877 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="startpar" name="rmnologin" dev="sda1" ino=2423 res=0 netlink: 'syz-executor298': attribute type 3 has an invalid length. netlink: 'syz-executor298': attribute type 2 has an invalid length. WARNING: CPU: 0 PID: 6032 at net/netfilter/nfnetlink_cttimeout.c:478 cttimeout_default_get+0x1df/0xb30 net/netfilter/nfnetlink_cttimeout.c:478 Kernel panic - not syncing: panic_on_warn set ... CPU: 0 PID: 6032 Comm: syz-executor298 Not tainted 4.20.0-rc2+ #336 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+0x244/0x39d lib/dump_stack.c:113 panic+0x2ad/0x55c kernel/panic.c:188 __warn.cold.8+0x20/0x45 kernel/panic.c:540 report_bug+0x254/0x2d0 lib/bug.c:186 fixup_bug arch/x86/kernel/traps.c:178 [inline] do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271 do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:290 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:969 RIP: 0010:cttimeout_default_get+0x1df/0xb30 net/netfilter/nfnetlink_cttimeout.c:478 Code: 00 0f 87 8d 00 00 00 41 80 ff 06 0f 84 94 07 00 00 41 80 ff 11 0f 84 6c 07 00 00 41 80 ff 01 0f 84 44 07 00 00 e8 91 f1 20 fb <0f> 0b 41 bd a1 ff ff ff eb 06 41 bd a1 ff ff ff e8 7c f1 20 fb 48 RSP: 0018:ffff8881b64c72b0 EFLAGS: 00010293 RAX: ffff8881c1686380 RBX: ffffffff88bf58e0 RCX: ffffffff865e961c RDX: 0000000000000000 RSI: ffffffff865e964f RDI: 0000000000000001 RBP: ffff8881b64c73c0 R08: ffff8881c1686380 R09: ffffed103b5c5b67 R10: 0000000000000002 R11: ffff8881dae2db3b R12: 0000000000000088 R13: ffff8881bf42b300 R14: 0000000000000000 R15: 0000000000000088 nfnetlink_rcv_msg+0xdd3/0x10c0 net/netfilter/nfnetlink.c:228 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2477 nfnetlink_rcv+0x1c0/0x4d0 net/netfilter/nfnetlink.c:560 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x5a5/0x760 net/netlink/af_netlink.c:1336 netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:631 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116 __sys_sendmsg+0x11d/0x280 net/socket.c:2154 __do_sys_sendmsg net/socket.c:2163 [inline] __se_sys_sendmsg net/socket.c:2161 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4400d9 Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffc704c30c8 EFLAGS: 00000213 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004400d9 RDX: 0000000000000000 RSI: 0000000020dddfc8 RDI: 0000000000000003 RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8 R10: 0000000000000000 R11: 0000000000000213 R12: 0000000000401960 R13: 00000000004019f0 R14: 0000000000000000 R15: 0000000000000000 Kernel Offset: disabled Rebooting in 86400 seconds.. --- This bug 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 bug report. See: https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot. syzbot can test patches for this bug, for details see: https://goo.gl/tpsmEJ#testing-patches ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH nf] netfilter: nfnetlink_cttimeout: fetch timeouts for udplite and gre, too 2018-11-16 22:09 WARNING in cttimeout_default_get syzbot @ 2018-11-17 10:32 ` Florian Westphal 2018-11-17 11:17 ` Pablo Neira Ayuso 0 siblings, 1 reply; 3+ messages in thread From: Florian Westphal @ 2018-11-17 10:32 UTC (permalink / raw) To: netfilter-devel; +Cc: syzkaller-bugs, netdev, Florian Westphal syzbot was able to trigger the WARN in cttimeout_default_get() by passing UDPLITE as l4protocol. Alias UDPLITE to UDP, both use same timeout values. Furthermore, also fetch GRE timeouts. GRE is a bit more complicated, as it still can be a module and its netns_proto_gre struct layout isn't visible outside of the gre module. Work around this by forcing the timeouts to be the first structure member, then use plain net_generic(). A followup nf-next patch could make gre tracker be built-in as well if needed, its not that large. Last, make the WARN() mention the missing protocol value in case anything else is missing. Reported-by: syzbot+2fae8fa157dd92618cae@syzkaller.appspotmail.com Fixes: 8866df9264a3 ("netfilter: nfnetlink_cttimeout: pass default timeout policy to obj_to_nlattr") Signed-off-by: Florian Westphal <fw@strlen.de> --- net/netfilter/nf_conntrack_proto_gre.c | 4 +++- net/netfilter/nfnetlink_cttimeout.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index 9b48dc8b4b88..dd8db7fbc437 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c @@ -56,10 +56,10 @@ static const unsigned int gre_timeouts[GRE_CT_MAX] = { static unsigned int proto_gre_net_id __read_mostly; struct netns_proto_gre { + unsigned int gre_timeouts[GRE_CT_MAX]; struct nf_proto_net nf; rwlock_t keymap_lock; struct list_head keymap_list; - unsigned int gre_timeouts[GRE_CT_MAX]; }; static inline struct netns_proto_gre *gre_pernet(struct net *net) @@ -402,6 +402,8 @@ static int __init nf_ct_proto_gre_init(void) { int ret; + BUILD_BUG_ON(offsetof(struct netns_proto_gre, gre_timeouts)); + ret = register_pernet_subsys(&proto_gre_net_ops); if (ret < 0) goto out_pernet; diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index a518eb162344..1643faa35f56 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c @@ -455,7 +455,8 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl, case IPPROTO_TCP: timeouts = nf_tcp_pernet(net)->timeouts; break; - case IPPROTO_UDP: + case IPPROTO_UDP: /* fallthrough */ + case IPPROTO_UDPLITE: timeouts = nf_udp_pernet(net)->timeouts; break; case IPPROTO_DCCP: @@ -469,13 +470,19 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl, case IPPROTO_SCTP: #ifdef CONFIG_NF_CT_PROTO_SCTP timeouts = nf_sctp_pernet(net)->timeouts; +#endif + break; + case IPPROTO_GRE: +#ifdef CONFIG_NF_CT_PROTO_GRE + if (l4proto->net_id) + timeouts = net_generic(net, *l4proto->net_id); #endif break; case 255: timeouts = &nf_generic_pernet(net)->timeout; break; default: - WARN_ON_ONCE(1); + WARN_ONCE(1, "Missing timeouts for proto %d", l4proto->l4proto); break; } -- 2.18.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nf] netfilter: nfnetlink_cttimeout: fetch timeouts for udplite and gre, too 2018-11-17 10:32 ` [PATCH nf] netfilter: nfnetlink_cttimeout: fetch timeouts for udplite and gre, too Florian Westphal @ 2018-11-17 11:17 ` Pablo Neira Ayuso 0 siblings, 0 replies; 3+ messages in thread From: Pablo Neira Ayuso @ 2018-11-17 11:17 UTC (permalink / raw) To: Florian Westphal; +Cc: netfilter-devel, syzkaller-bugs, netdev On Sat, Nov 17, 2018 at 11:32:29AM +0100, Florian Westphal wrote: > syzbot was able to trigger the WARN in cttimeout_default_get() by > passing UDPLITE as l4protocol. Alias UDPLITE to UDP, both use > same timeout values. > > Furthermore, also fetch GRE timeouts. GRE is a bit more complicated, > as it still can be a module and its netns_proto_gre struct layout isn't > visible outside of the gre module. > > Work around this by forcing the timeouts to be the first structure > member, then use plain net_generic(). > > A followup nf-next patch could make gre tracker be built-in as well > if needed, its not that large. > > Last, make the WARN() mention the missing protocol value in case > anything else is missing. Applied, thanks Florian. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-17 11:17 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-16 22:09 WARNING in cttimeout_default_get syzbot 2018-11-17 10:32 ` [PATCH nf] netfilter: nfnetlink_cttimeout: fetch timeouts for udplite and gre, too Florian Westphal 2018-11-17 11:17 ` Pablo Neira Ayuso
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.