Received: by 10.192.165.148 with SMTP id m20csp363889imm; Wed, 9 May 2018 14:07:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqQ6I+6X0983IZTN9VoTv95uir4pG1ZTTtrcdEdYeRBd4CT11o5iSU3+3dlfCZur9D7pYC4 X-Received: by 2002:a17:902:28ab:: with SMTP id f40-v6mr46835504plb.208.1525900067986; Wed, 09 May 2018 14:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525900067; cv=none; d=google.com; s=arc-20160816; b=bdHHOZSY7fliLVnQeaB3A672H5AaZN8Q+CZi0rD1g7/v5PMDem+hgAmw/NKXvj0UIa YYqbO69eT9rKa43/1Sm4uE8pyQf4nOtlV6KkEDOe5lCjdjwSQxGtXhvfBv0IY/HBFchc qF+tAIitmajtAIOI9XYIWeTB0pWyx6Y4eNWJyFTef1+kw5Ori0xg3P2c8Y96G3aVvRDt u5JQkeaVwoxC6W86bCNsQsAbMtr954bY/9WJ//mKMylDPiacyiufgC3Uvm07URJq+EDZ QYPlDFATaVIvjc3xROgATmWtKb7E7Eg8UtDvwPnobydb9KaZ2YbXYn4MS43/8URCLCsf hdWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=MbB/QpxobEKZnO1BbUyXCpu5CSSZvpY8T5jJ5hATrBg=; b=vxG7vryfF8rTNHS0a0c/yLHe68jPev/6y44Hn04tSG0OYzOK+fKQcYpCwk51HvM4IR mGzKtXmfq16EG7cXDb170d4ugHFWJ73gEXth+2t5aw0o0dBJHon3Osn7XauLRje4kdw2 7f3SBEcw3ujZv79E917tIHqT6g4dIpzRmJ6/wr3k5JB9o3xSXWv25lJRZ7bBScJptXjV UA6k0A3s0ojLvIHSk/jvg+Gql89zPzYfjuWT4hKyAlB0FIdRQDirpsfdoibQiuth7xyZ b+L/Uq3yix/tuLmM/VN/0uHbSRuxX8AnxSmsgK4QJFL2N+o9XWtj/X1nHhiO1OtKPsnd QfkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hYYNNXE0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w33-v6si26240871plb.431.2018.05.09.14.07.32; Wed, 09 May 2018 14:07:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hYYNNXE0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965455AbeEIVGH (ORCPT + 99 others); Wed, 9 May 2018 17:06:07 -0400 Received: from mail-ua0-f169.google.com ([209.85.217.169]:35069 "EHLO mail-ua0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935200AbeEIVGF (ORCPT ); Wed, 9 May 2018 17:06:05 -0400 Received: by mail-ua0-f169.google.com with SMTP id a2so23484322uak.2; Wed, 09 May 2018 14:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MbB/QpxobEKZnO1BbUyXCpu5CSSZvpY8T5jJ5hATrBg=; b=hYYNNXE0J8/dTTpJWIDM/H+pNHfK4hTpic0u8Y283wMGerlZRMH21SDjBv/9jfmezp s4EQBFy/JELdGhvXKbH94+bd1gv3VdxC1k6uVWBqz0P48HkxothcqRz/Al6elHF1lR7/ O8JBsLJ32w1BASidzkNJw4Qo27ztqVM32wxF3je05t1fiIp5m4+nyGHMhmjcOma6sEUF +bXncn0bJwde9PwSjLGaBw8+v3KcGs8LlqxGV/w7MACmLmyq3d5llMy+P5LOwzRk7Pwm /SSRLvaOdabX9SY/mcN0xyMzXDSIVC6AYw6vW0OxVYXeUb9stSld6dQ7Kg09u8uOAUKb G0lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MbB/QpxobEKZnO1BbUyXCpu5CSSZvpY8T5jJ5hATrBg=; b=SZt7dDjnf4YyK+MPvsOZqj9oNjaNjxHItjDvau0Nj9MMg/2JmVD7gIu7kExEGD9vju MIaEUzArNEP7jWh9qYcT5VV4+Idc9fx64hk/JAvhsTfIFOeQFccGtG8eX76Vz4+/uEv8 oVl2RjsZR/luHOOJFhVORPHNVee6F1LDG40hcJA+9sWObEUVAHpgCFKQ/IVEW4SlBpsC iYU0VPUeqAb3TkqkJ0DC2xEHnyHDQN4dqUMRb8UAc2b7PTwnEzAsgdqVqGTHeOWoImxS oo/SOvRZz0lVO+NREj5uCffNEMmPJOeOKx36jw50z8gaLU8F4PXa0jiH8BppGLpftOwz DxYw== X-Gm-Message-State: ALQs6tDPqlekp8IT4J9gIb6ojvWLDb+2T81ulij1DCQu5o89BMwee5zH jy/Ry2yPS9NtBVt7mSpcPENleg/dscGU+KhZWl0= X-Received: by 10.176.78.35 with SMTP id g35mr36284746uah.15.1525899964306; Wed, 09 May 2018 14:06:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.151.90 with HTTP; Wed, 9 May 2018 14:05:23 -0700 (PDT) In-Reply-To: References: <94eb2c0ce3aa27cfa40561ec2dc3@google.com> <1515048794.131759.4.camel@gmail.com> <20180509073754.GG711@sol.localdomain> From: Willem de Bruijn Date: Wed, 9 May 2018 17:05:23 -0400 Message-ID: Subject: Re: KASAN: use-after-free Read in __dev_queue_xmit To: Eric Dumazet Cc: Eric Biggers , syzbot , alexander.deucher@amd.com, Andrey Konovalov , Anoob Soman , chris@chris-wilson.co.uk, David Miller , "Reshetova, Elena" , Greg Kroah-Hartman , Kees Cook , LKML , Mike Maloney , mchehab@kernel.org, netdev , "Rosen, Rami" , Sowmini Varadhan , syzkaller-bugs@googlegroups.com, Willem de Bruijn Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 9, 2018 at 3:36 PM, Eric Dumazet wrote: > > > On 05/09/2018 12:21 PM, Willem de Bruijn wrote: > >> Indeed. The skb shared info struct is zeroed by dev_validate_header >> as a result of dev->hard_header_len exceeding skb->end - skb->data. >> >> Not exactly sure yet how this can happen. The hard header length space >> is accounted for during allocation as reserved memory. But, >> packet_alloc_skb does call skb_reserve(), moving skb->data >> effectively beyond this reserved region. >> >> It may be incorrect to pass skb->data to dev_validate_header, as that >> does not point to the start of the ll_header anymore. Still figuring out what >> the right fix is.. >> > > I believe the bug happens if the sock_wmalloc() call at line 1921 has to sleep. > > device can change (or at lest dev->hard_header_len can change) > > So we need to bailout if reserved/hhlen had changed. > > Or revert some patches, since dev_hold() and dev_put() are no longer high cost, > since it is now using per cpu counter. Oh nice, another bug :/ That seems quite plausible. This reproducer does not modify hard_header_len, however. It sends a long array of zero byte requests with sendmmsg to eventually exceed so_rcvbuf of the error queue. Hard header length is 116 throughout.