From patchwork Mon Oct 2 14:48:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 9980911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70BCC602A0 for ; Mon, 2 Oct 2017 14:49:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6285920453 for ; Mon, 2 Oct 2017 14:49:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 570D125223; Mon, 2 Oct 2017 14:49:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EECB720453 for ; Mon, 2 Oct 2017 14:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4tQXc0zcFimHD1e0BSJYAWeQ2EvIIueN3eE3O1qOOso=; b=ePML1VBhy05gUF 7bx9JOBo6mBysIAR97vYQSTXQyUzMFtLUNsanIMRlt3xbe+xm0WBF+vYiV0UpI84tA7qPyFjJlwyQ 0YjU169iRTAYetyyNqi1DkLexmrdy+aKqfYkhogImisefkoiEbOYTB5HPBnwXYgDW61aEYS2OAOI2 3SSMi8gO4leE0V0pVrV+gISrXTVst1f6ndx4UBNn0PB5/F470kcLlx0idnzK4ONRuKPUppIRy8zFD CTrqgzjjZNivNoM4Xr9hVaMpfl/+OFJm460BQo0YJ9de6+fNfiTlpSjFFNNECWvwyUoaWb7r2nDQz PWsbzjLesKeAvmXVaPsw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dz21l-0007XY-Is; Mon, 02 Oct 2017 14:49:01 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dz21c-0007EQ-Hs for linux-arm-kernel@lists.infradead.org; Mon, 02 Oct 2017 14:48:59 +0000 Received: by mail-pf0-x242.google.com with SMTP id g65so5967010pfe.1 for ; Mon, 02 Oct 2017 07:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=z4id2VPJiDp9SR6rmDOfuDjRhC5cJYI53gSz3PBKpLI=; b=tt/79WtY98aXocigoZ+lKyecyyi8uRV06+VRU6KynA1BEVsQ0QRm1smcj1x8rt6C06 ppVEM9yXRDaTkpL28M8RX2PtYg8rDsC516h7+J62IzwtKO0ZggTDyrtuDU0JkKyMXFAF xQe6XzI/jH3EUFTfx96wd6asDX0Bj093AmbpU00eTCKj7AriBEQlbDRf3A4QNvFmNsR2 6dB46cn7S0mUe1TLIu+YJ+Yoz9HDFtYjii8UorefoSUQG5gDM405Y96ljfn4qy5vpELF R4g4Em1B0denh4eJs/JknosBYxELChCZRlGGK90US7bAUxN9zi5ZoNopYW12VVe7z4AM tTdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=z4id2VPJiDp9SR6rmDOfuDjRhC5cJYI53gSz3PBKpLI=; b=IX9OHKV6iKyzyWFRS9xIUR+IuBsahjtApwjfTzCRndnRDcu6gJPKM8LTmfHgsVavA8 6xudUOcG6+B3t+0N9zplJ+4cUZo4tQ1hWXfSiM+vvyEsx4Jqo8jgTbSgPxRwmE7MtStt M/G9Qc6Upuznv/JmDGEvS/0wHVDWwJVcGwmek1WoUcdqUecFbxLVSbZ7B1gd0VmDyjVv d3axfpZteec+KYbX6PNdMVQDpDoP/MwbAjSGyHxnpmwIw8gXz8j9PAlPLRM1sOG63TOz Cnc7snmX9N77nf0DuInNEWKoRTi3TfcpbYjFQ8M4VdvM1ZCXpltibTNRpdVUuKdhhjF3 ftnA== X-Gm-Message-State: AHPjjUiUvlYZGROzJss9lWFj29rolErHqLg/up+n2qOc2OA5b7M7+e+7 RQRwTkwR1Ybrl7pPPV9k6Po= X-Google-Smtp-Source: AOwi7QB1saP8RCP/YosTfpVS3gvkA16OjUtf9dbMh3nwxxUBZL8gsQfQlkhrJAJWzLaZUinEIOWlDA== X-Received: by 10.84.248.144 with SMTP id q16mr14678197pll.345.1506955711652; Mon, 02 Oct 2017 07:48:31 -0700 (PDT) Received: from [10.1.104.77] ([207.198.105.19]) by smtp.googlemail.com with ESMTPSA id x13sm16324237pgt.16.2017.10.02.07.48.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 07:48:31 -0700 (PDT) Message-ID: <1506955708.8061.5.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: v4.14-rc2/arm64 kernel BUG at net/core/skbuff.c:2626 From: Eric Dumazet To: Mark Rutland Date: Mon, 02 Oct 2017 07:48:28 -0700 In-Reply-To: <20171002142156.GB21696@leverpostej> References: <20171002104947.GE20737@leverpostej> <20171002142156.GB21696@leverpostej> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171002_074852_908072_7D1255B7 X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Willem de Bruijn , netdev , LKML , Eric Dumazet , syzkaller , "David S. Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, 2017-10-02 at 15:21 +0100, Mark Rutland wrote: > Hi Eric, > > On Mon, Oct 02, 2017 at 06:36:32AM -0700, Eric Dumazet wrote: > > On Mon, Oct 2, 2017 at 3:49 AM, Mark Rutland wrote: > > > I hit the below splat at net/core/skbuff.c:2626 while fuzzing v4.14-rc2 > > > on arm64 with Syzkaller. This is the BUG_ON(len) at the end of > > > skb_copy_and_csum_bits(). > > > > kernel BUG at net/core/skbuff.c:2626! > > > > [] skb_copy_and_csum_bits+0x8dc/0xae0 net/core/skbuff.c:2626 > > > [] icmp_glue_bits+0xa4/0x2a0 net/ipv4/icmp.c:357 > > > [] __ip_append_data+0x10e4/0x20a8 net/ipv4/ip_output.c:1018 > > > [] ip_append_data.part.3+0xe8/0x1a0 net/ipv4/ip_output.c:1170 > > > [] ip_append_data+0xa4/0xb0 net/ipv4/ip_output.c:1173 > > > [] icmp_push_reply+0x1b8/0x690 net/ipv4/icmp.c:375 > > > [] icmp_send+0x1070/0x1890 net/ipv4/icmp.c:741 > > > [] ip_fragment.constprop.4+0x208/0x340 net/ipv4/ip_output.c:552 > > > [] ip_finish_output+0x3a8/0xab0 net/ipv4/ip_output.c:315 > > > [] NF_HOOK_COND include/linux/netfilter.h:238 [inline] > > > [] ip_output+0x284/0x790 net/ipv4/ip_output.c:405 > > > [] dst_output include/net/dst.h:458 [inline] > > > [] ip_local_out+0x9c/0x1b8 net/ipv4/ip_output.c:124 > > > [] ip_queue_xmit+0x850/0x18e0 net/ipv4/ip_output.c:504 > > > [] tcp_transmit_skb+0x107c/0x3338 net/ipv4/tcp_output.c:1123 > > > [] __tcp_retransmit_skb+0x614/0x1d18 net/ipv4/tcp_output.c:2847 > > > [] tcp_send_loss_probe+0x478/0x7d0 net/ipv4/tcp_output.c:2457 > > > [] tcp_write_timer_handler+0x50c/0x7e8 net/ipv4/tcp_timer.c:557 > > > [] tcp_write_timer+0x78/0x170 net/ipv4/tcp_timer.c:579 > > > [] call_timer_fn+0x1b8/0x430 kernel/time/timer.c:1281 > > > [] expire_timers+0x1d4/0x320 kernel/time/timer.c:1320 > > > [] __run_timers kernel/time/timer.c:1620 [inline] > > > [] run_timer_softirq+0x214/0x5f0 kernel/time/timer.c:1646 > > > [] __do_softirq+0x350/0xc0c kernel/softirq.c:284 > > > [] do_softirq_own_stack include/linux/interrupt.h:498 [inline] > > > [] invoke_softirq kernel/softirq.c:371 [inline] > > > [] irq_exit+0x1dc/0x2f8 kernel/softirq.c:405 > > > [] __handle_domain_irq+0xdc/0x230 kernel/irq/irqdesc.c:647 > > > [] handle_domain_irq include/linux/irqdesc.h:175 [inline] > > > [] gic_handle_irq+0x6c/0xe0 drivers/irqchip/irq-gic.c:367 Please try the following fool proof patch. This is what I had in my local tree back in August but could not conclude on the syzkaller bug I was working on. diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 681e33998e03b609fdca83a83e0fc62a3fee8c39..e51d777797a927058760a1ab7af00579f7488cb5 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -732,7 +732,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) room = 576; room -= sizeof(struct iphdr) + icmp_param.replyopts.opt.opt.optlen; room -= sizeof(struct icmphdr); - + if (room < 0) + goto ende; icmp_param.data_len = skb_in->len - icmp_param.offset; if (icmp_param.data_len > room) icmp_param.data_len = room;