From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932457AbbJML46 (ORCPT ); Tue, 13 Oct 2015 07:56:58 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:59970 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932237AbbJML4x (ORCPT ); Tue, 13 Oct 2015 07:56:53 -0400 Message-Id: <1444737413.1838027.408845625.7BE0D712@webmail.messagingengine.com> X-Sasl-Enc: XZiDya/cAj8981MffaIsIFzeg+4ORqx/knHbjXXlKitR 1444737413 From: Hannes Frederic Sowa To: Dmitry Vyukov , David Miller , kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, Patrick McHardy , netdev@vger.kernel.org, LKML Cc: syzkaller@googlegroups.com, Kostya Serebryany , Alexander Potapenko , Andrey Konovalov , Sasha Levin , Eric Dumazet , =?UTF-8?Q?Maciej=20=C5=BBenczykowski?= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-7cc03d5c Subject: Re: Infinite loop in ip6_fragment Date: Tue, 13 Oct 2015 13:56:53 +0200 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Oct 12, 2015, at 11:26, Dmitry Vyukov wrote: > [] ip6_fragment+0x37e/0x9d0 net/ipv6/ip6_output.c:805 > [] ip6_finish_output+0xcd/0xe0 > net/ipv6/ip6_output.c:130 > [< inline >] NF_HOOK_COND include/linux/netfilter.h:236 > [] ip6_output+0x3f/0xe0 net/ipv6/ip6_output.c:146 > [< inline >] dst_output_sk include/net/dst.h:459 > [] ip6_local_out_sk+0x28/0x30 > net/ipv6/output_core.c:167 > [] ip6_local_out+0x10/0x20 net/ipv6/output_core.c:175 > [] ip6_send_skb+0x18/0x60 net/ipv6/ip6_output.c:1683 > [] ip6_push_pending_frames+0x34/0x40 > net/ipv6/ip6_output.c:1703 > [< inline >] rawv6_push_pending_frames net/ipv6/raw.c:607 > [] rawv6_sendmsg+0x871/0xb30 net/ipv6/raw.c:901 > [] inet_sendmsg+0x62/0xa0 net/ipv4/af_inet.c:737 > [< inline >] sock_sendmsg_nosec net/socket.c:610 > [] sock_sendmsg+0x33/0x40 net/socket.c:620 > [] sock_write_iter+0x73/0xd0 net/socket.c:819 > [< inline >] do_iter_readv_writev fs/read_write.c:664 > [] do_readv_writev+0x1bd/0x270 fs/read_write.c:808 > [] vfs_writev+0x34/0x40 fs/read_write.c:847 > [< inline >] SYSC_writev fs/read_write.c:880 > [] SyS_writev+0x45/0xc0 fs/read_write.c:872 > [] entry_SYSCALL_64_fastpath+0x12/0x6a > arch/x86/entry/entry_64.S:185 > > ip6_fragment computes mtu value as 4, which is then rounded down to 8 > and becomes 0. This causes infinite send loop by 0 bytes. Initial mtu > value is 1500, but here is becomes 4: > > mtu -= hlen + sizeof(struct frag_hdr); > > sizeof(struct frag_hdr) = 8, hlen = 1488. Yeah, absolutely logic and difficult to fix. Because of the unknown socket(..., ..., protocol = 0x....) you enabled hdrincl. The writev included non-fragmentable padding and options (yeah by being just zeros). hlen is the non-fragmentable header length of the packet and thus reduced the length of the actual payload near to or equal to zero. I think we just have to abort sending those packets and send errors back to user space. Thanks for the report! Bye, Hannes