Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp756036ybx; Wed, 6 Nov 2019 08:00:34 -0800 (PST) X-Google-Smtp-Source: APXvYqx35n9pyYUC5kh4x6xJRaOWqohCGpqcs9WQRraHZ9W3orczp1D0rnvwK2AvkwUSIQXBfhxv X-Received: by 2002:a05:6402:2029:: with SMTP id ay9mr3563009edb.47.1573056034585; Wed, 06 Nov 2019 08:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573056034; cv=none; d=google.com; s=arc-20160816; b=a2FM6aC9t2gkgPrCj6eyl4WYlJ7C0rqvwEGdwrsNra1f3YdtKm3d7H0cKM844vSKG7 tObjLu4BGX4Hy92TD02HuJNHwOIPyL10WUuSyqKLCWH/79atf1cV3fbnTIHUk+pAfoUL COfFy7daCqUGo6QNIq6464AE0ZeNQgt8IB1norOVApIuIwhB52JHkRkeNIpTsVqWemfd eb7vi64BXdHJX+KdhrYYuzVngQ54ESAyEaNwX3ieL49X/U+7YuobysTBlwY75G4q4yvV y37o5RR9egVGsM7iEjGswZtByGt2cQr+nZlruWBZZYRWTvAN3NIb1l6t3W1PR/OfejPB Dtwg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=cVWhQ7pk8kVnjo6deuYig81i/tXV4OF/4yQUgh5RwQM=; b=sL7V7r/ygjet8LyqZr3YUZ3mGAyysuGXFbZ3M1De5OsFQhzFFtpp28qJMQw2kDK8/E 9UIv7fVx2K32vv0uhGkW1WTjGhBxVC+LFOxJCu0scwa+ymj3YTH2s1tfKmfZbf4ZUCkH gtCfxJ+SvqtijzgFjCdZjTJzCCvbTe8t+YHyQryWBt1A6Pvjxv7pEkPFadPiuRaxtCIk 4QNQDarji+CTY6WUMQ4mdkFzt1Nifb/Vp0ubunla2uSJprka3NV8G9CRcjkBZqDJyvzg ByB0SN46LRsnUHyfSkk8o6DRPpM0JzUdJMeE8DJ5mJqRuZHqCohTiShN2yC7lstNi0V5 /3Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=GTw+U7Uq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w14si15806888ejv.112.2019.11.06.08.00.10; Wed, 06 Nov 2019 08:00:34 -0800 (PST) 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=@ffwll.ch header.s=google header.b=GTw+U7Uq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732179AbfKFP5F (ORCPT + 99 others); Wed, 6 Nov 2019 10:57:05 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:43154 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727231AbfKFP5F (ORCPT ); Wed, 6 Nov 2019 10:57:05 -0500 Received: by mail-oi1-f195.google.com with SMTP id l20so9323783oie.10 for ; Wed, 06 Nov 2019 07:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cVWhQ7pk8kVnjo6deuYig81i/tXV4OF/4yQUgh5RwQM=; b=GTw+U7UqwU6wESYuDmDzklHmTueMwVcboSvhkrl6oVTwevzsH8xvPPZY6JDnlIBr6A Xc9gZzri4CZ8IsqTISVOpHEuZpMIpWnCTXx6J2Oc9gQKI4QX/b930uAhHL+sA3/1/gSF stnw1f0mrCPfD+81NeFb1hHy1LYb+HNDRrq78= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cVWhQ7pk8kVnjo6deuYig81i/tXV4OF/4yQUgh5RwQM=; b=Mdl8OzavremAMPeSChuVCbNq1n95M34Vebz6VQCsXsb6CPArVdy3hWT5kxl+SCpFiY MSMpRQRwF822i4XQadzitUk5hYi8k6L1mtceDpeQY2hU1bMwTNvyF1YbzEdoMcySJrcH NEdL1/inyBuExVP9jeFJO2H4QX+cPK04OVX+bL0WIOf8lwKsDaJUvolHOY3fp7Aa1OXr NKewIoYKSPxl8UeJrGkiFSJaUKfxu+ZKMzAlmyYEa9/oHgT+T3GY0Tl5gBKbaQCJTLS2 XxH0D37ED0HQS0CmLnDW5cPxPF1w2w0eRBtwo2pxocrGx0/F5bUSk+JNQXef7pffUX/Q CMRg== X-Gm-Message-State: APjAAAUTY1RD0NQ7848URU0/1XrbUYFXjIZKYlM439VIWzJUPzDS/tBN 55+LIKeWve6tYpnxr6qd72IWhYMXovCEiZ/I2oozlg== X-Received: by 2002:aca:ead7:: with SMTP id i206mr2917301oih.128.1573055823820; Wed, 06 Nov 2019 07:57:03 -0800 (PST) MIME-Version: 1.0 References: <000000000000b2de3a0594d8b4ca@google.com> <00000000000012ff570596af15cc@google.com> In-Reply-To: From: Daniel Vetter Date: Wed, 6 Nov 2019 16:56:50 +0100 Message-ID: Subject: Re: WARNING in drm_mode_createblob_ioctl To: Dmitry Vyukov Cc: syzbot , Dave Airlie , Andrew Morton , dri-devel , Kees Cook , Linux Kernel Mailing List , Maarten Lankhorst , Maxime Ripard , Sean Paul , Stephen Rothwell , syzkaller-bugs , Al Viro 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, Nov 6, 2019 at 4:33 PM Dmitry Vyukov wrote: > > On Wed, Nov 6, 2019 at 4:28 PM Daniel Vetter wrote: > > > > On Wed, Nov 6, 2019 at 4:23 PM Daniel Vetter wrote: > > > > > > On Wed, Nov 6, 2019 at 4:20 PM syzbot > > > wrote: > > > > > > > > syzbot has bisected this bug to: > > > > > > > > commit 9e5a64c71b2f70ba530f8156046dd7dfb8a7a0ba > > > > Author: Kees Cook > > > > Date: Mon Nov 4 22:57:23 2019 +0000 > > > > > > > > uaccess: disallow > INT_MAX copy sizes > > > > > > Ah cool, this explains it. > > > > > > fwiw I never managed to get the WARNING in the backtrace to lign up > > > with any code. No idea what's been going on. > > > > Ok I think I have an idea, the above commit isn't in the linux-next I > > have here. Where is this from? > > -Daniel > > You need to fetch tags to linux-next. syzbot started bisecting from > the commit where the crash happened, and it is now probably not the > current tag. Indeed it's an -mm patch so rebases every day. I tried looking for it, but found nothing, not sure what exactly I screwed up. Patch on the way. -Daniel > > linux$ git show 9e5a64c71b2f70ba530f8156046dd7dfb8a7a0ba > commit 9e5a64c71b2f70ba530f8156046dd7dfb8a7a0ba > Author: Kees Cook > Date: Tue Nov 5 09:57:23 2019 +1100 > > uaccess: disallow > INT_MAX copy sizes > > As we've done with VFS, string operations, etc, reject usercopy sizes > larger than INT_MAX, which would be nice to have for catching bugs related > to size calculation overflows[1]. > > This adds 10 bytes to x86_64 defconfig text and 1980 bytes to the data > section: > > text data bss dec hex filename > 19691167 5134320 1646664 26472151 193eed7 vmlinux.before > 19691177 5136300 1646664 26474141 193f69d vmlinux.after > > [1] https://marc.info/?l=linux-s390&m=156631939010493&w=2 > > Link: http://lkml.kernel.org/r/201908251612.F9902D7A@keescook > Signed-off-by: Kees Cook > Suggested-by: Dan Carpenter > Cc: Alexander Viro > Signed-off-by: Andrew Morton > Signed-off-by: Stephen Rothwell > > diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h > index 659a4400517b2..e93e249a4e9bf 100644 > --- a/include/linux/thread_info.h > +++ b/include/linux/thread_info.h > @@ -147,6 +147,8 @@ check_copy_size(const void *addr, size_t bytes, > bool is_source) > __bad_copy_to(); > return false; > } > + if (WARN_ON_ONCE(bytes > INT_MAX)) > + return false; > check_object_size(addr, bytes, is_source); > return true; > } > > > > > I'll type a patch to paper over this. > > > -Daniel > > > > > > > > > > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=125fe6dce00000 > > > > start commit: 51309b9d Add linux-next specific files for 20191105 > > > > git tree: linux-next > > > > final crash: https://syzkaller.appspot.com/x/report.txt?x=115fe6dce00000 > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=165fe6dce00000 > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=a9b1a641c1f1fc52 > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=fb77e97ebf0612ee6914 > > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1212dc3ae00000 > > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=145f604ae00000 > > > > > > > > Reported-by: syzbot+fb77e97ebf0612ee6914@syzkaller.appspotmail.com > > > > Fixes: 9e5a64c71b2f ("uaccess: disallow > INT_MAX copy sizes") > > > > > > > > For information about bisection process see: https://goo.gl/tpsmEJ#bisection > > > > > > > > > > > > -- > > > Daniel Vetter > > > Software Engineer, Intel Corporation > > > +41 (0) 79 365 57 48 - http://blog.ffwll.ch > > > > > > > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > +41 (0) 79 365 57 48 - http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch