Received: by 10.192.165.148 with SMTP id m20csp115613imm; Wed, 9 May 2018 09:39:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqGpTyAxaxhE3MziTHZYRcOIKPrlGvUa9+6VPvt/MsYp6ZKrARZFwrbCacS3KL7kh/OeiTs X-Received: by 2002:a17:902:164:: with SMTP id 91-v6mr46494669plb.134.1525883961200; Wed, 09 May 2018 09:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525883961; cv=none; d=google.com; s=arc-20160816; b=O3sC5ooHsEElGyjyAJJk5/my2dY40G6Ule1mb/Z0NUsWDvYfVCYZo01c1F5G5F/Mlp vTFsA66PaAk2OwJr0optxsu4BiMZiFMriBf2MT7r5IoU2eKz6VulVmv3AMzyk5OT4nUf 0GYdTIbkGcxBWdXi/o8tSPiVhHCPd7fnoq104YeKqCU6ZDHUlbZAKUBXJtG7uPXvxOP6 LJhFm4RB3C/H7rZ7WSEx7NoPvC1Ea7OsVAwQtV9tFLDnAhKxyoAsIQf2SNRTv1ZkVWS6 MqTKVpy6vWVUvAYHb+KeFquVzzQcb3HCybioePWbvY/BvZfI1e1NfHdaWyhx1o66Yh7u CkCg== 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=tO5P7y86BJh38jpRObhI43FZGnb8CIk4+iCCW2JGYSo=; b=Rhzlg7fwb72aSxwnjn9LCukSJsuk5DORK4phlSFxPfP6gbF87v3Sizrq4OvCV5D8Sd oo2oLxSB6Gxmjn40zaI2r/jFiFL9s1fE7PA4CyzFZ/qlD+gSsyyGFN+U2+UsEDEnHO1a n5WltceZPmvzB37N1QtRAV3MRRpFaxtr7yBKPhzUDui33lE6nUfmNysg7xQoiKVs4FQU s6wSN2GEPnJNVd8kfEJW1dSeLxvqZjyfKierVxbDGM4StJHinu+DD/jpQ6swqaOF5r1p T+Fv65fNv1l/Eyixv7+hJy9YkrOhV1GA5IRqiLja0qXHco3rS6Ws6PrFFfiJMptw2EL6 fXKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s3hyPm/7; 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 b73-v6si27151102pli.305.2018.05.09.09.39.06; Wed, 09 May 2018 09:39:21 -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=s3hyPm/7; 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 S965433AbeEIQiy (ORCPT + 99 others); Wed, 9 May 2018 12:38:54 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:36102 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934647AbeEIQix (ORCPT ); Wed, 9 May 2018 12:38:53 -0400 Received: by mail-ua0-f195.google.com with SMTP id b25so16730681uak.3; Wed, 09 May 2018 09:38:53 -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=tO5P7y86BJh38jpRObhI43FZGnb8CIk4+iCCW2JGYSo=; b=s3hyPm/7MmrBQoomEmVFD+lhnvCBoEoB7zupRk0OuR+tVu6zKNt7HRxceVGscOk7Lp r75jnhxYPlg8UFsb1MLIx57USRQz+RQhvCyunbIKBKgmCQ5+pH4nWK6rIlwuKqH3+GT0 e4OrjqrVkXALI54LeCqCT0OpabckeXhaTdqwS/uGHWYh7Xz4+2r5KCn0XBXsxMntBhWs bDIsLJm1h/PtPfCKucfO2kfVhjKpUETI0mWl+KI01ZX2qcZ04ryMkm+pbi5o5qUrN4vV oVhqCcVEuXHHYUQRwU08xAXK9UQ4WyJn+lBzq/rIfCZRwD8hZT5Dv5LcxmCROIo7TMVw cUXA== 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=tO5P7y86BJh38jpRObhI43FZGnb8CIk4+iCCW2JGYSo=; b=Gb+1JFtA5/sCyKIzA4pj1ESTpW/RsOH/GE+f1pJaNkDaFvA/OdAFfTii7HpAox+x/D EPYyNdl3KPunHzDvPR/Wmwmil6bmRu/0jA+e14HQRCfmDZeCqgLysx+sGonXqV/9U2uQ SllitOxDpozCj9L2/iYn/27W4ADnPEZvN+DKJka/ycYCkYs7rpsLMFaBkZJ1l/cDfv6U v8s3EDHzWbR3wpphBcdB9D1zZnZfiK7wzHJDVx/wB+C58t8LDbapRj+yl3QSL18dGnDc /E0vcPFX30LoI0LkuAgm9u8ogjgTCnvwC2nMSLQBpjNnsndLL4dZGoUBETzwRDZqpX/W F7cQ== X-Gm-Message-State: ALQs6tAqiJgPMcoH5e4ms6JVvEUgRXm/PMzwULRN36VecDI0BYcQY/l/ 8dxgzon+nzelHxTRHb/KTfyDxkQkUa17B71Ni9g= X-Received: by 10.159.34.167 with SMTP id 36mr40979006uan.101.1525883932167; Wed, 09 May 2018 09:38:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.151.90 with HTTP; Wed, 9 May 2018 09:38:11 -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 12:38:11 -0400 Message-ID: Subject: Re: KASAN: use-after-free Read in __dev_queue_xmit To: Eric Biggers Cc: Eric Dumazet , Eric Dumazet , 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 >> But a crash with the same signature is still occurring, so it should eventually >> get reported again. C reproducer is here, it works on Linus' tree (commit >> 036db8bd963): https://syzkaller.appspot.com/text?tag=ReproC&x=105b1ae7800000 > > This appears to be a separate issue. > > This reproducer requires a setsockopt SOL_SOCKET/SO_TIMESTAMPING > to trigger the use-after-free. And the freed path also points at a timestamping > skb: > > [ 31.963619] Freed by task 2672: > [ 31.964006] __kasan_slab_free+0x125/0x170 > [ 31.964509] kfree+0x8b/0x1a0 > [ 31.964875] skb_free_head+0x6f/0xa0 > [ 31.965314] skb_release_data+0x420/0x5a0 > [ 31.965802] skb_release_all+0x46/0x60 > [ 31.966260] kfree_skb+0x91/0x1c0 > [ 31.966669] __skb_complete_tx_timestamp+0x2e9/0x3d0 > [ 31.967273] __skb_tstamp_tx+0x3b3/0x620 > [ 31.967774] __dev_queue_xmit+0xed5/0x1a20 > [ 31.968300] packet_sendmsg+0x36fd/0x5400 > [ 31.968821] sock_sendmsg+0xc0/0x100 > [ 31.969284] ___sys_sendmsg+0x367/0x880 > [ 31.969777] __sys_sendmmsg+0x178/0x410 > [ 31.970267] __x64_sys_sendmmsg+0x99/0x100 > [ 31.970789] do_syscall_64+0x9a/0x2c0 > [ 31.971260] entry_SYSCALL_64_after_hwframe+0x44/0xa9 This is a rare path taken when the timestamp skb cannot be queued onto the socket (likely because of insufficient rcvbuf). Somehow, freeing the timestamp skb triggers this use-after-free in the original skb from which the timestamp was cloned. As if there is a bug in the shared info dataref. The report does occur on reading a shinfo field (gso_size).