Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp841847ybh; Tue, 21 Jul 2020 09:10:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjoSBtm5WbMeDKHPpcvpJA0o/nXVP2efMZeiPCrEWFo5cnZUteI5rUHyc26tS4hEFMCs3R X-Received: by 2002:a50:9e02:: with SMTP id z2mr25622288ede.87.1595347805841; Tue, 21 Jul 2020 09:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595347805; cv=none; d=google.com; s=arc-20160816; b=pH/j35o+PJSX8GxOoVOpLALD8kXibz7OigGmHPiGKlMF+EnTwd29PPpfz2ZxC688IT iZUbUozHhU4Bnjo5vyN0gB+rHqhUWxuvyGBktfynOivL+QPQtA43i5mbT5DbyTWUGBU/ A/lTtqLXNOM72DQkBCrjIauRXUwLxhZ30LupqPfPKaGGJSOypvmPO9XYSRcsO3TEgif6 txPnDW7RkVC22BhBLfDzDTpIM+Fi/DKEmC3S8JUEVf5io4XIHpt2Bpz99ZShBtfYPi1c aPq3roplk+XHhlULAOsWJRi2+PLbxV498RxOyjSukUv5eJKHzzU/K+VagZSuOhLLtg8F UpRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kMZ0J0gjeWt9/eKzgX7YWI55BediOqgjGogsHf6e9Cg=; b=z7yI2x9dihlurJJ2uh2sFJSVH6dmatXFelIbz4yvMKg5Fcf9IqT4BqAlAzQzp3DX++ yO7USZtB5R2ASEAD2KUVVlI/aq1clKSYwG6Y6QPeIOweAWij/lklgsu1MryFXiTAZIQm kxIynMDo0xnKxhCExp8+YGaki4wX7heOqqGzmOvOswIzfWgiLoLoE88rp0NKGx7TyWZ2 e2rJZ5hEFFsqwcfS3jMGU3oNKYphGEiac049tYAEMNTs7Wb8bnaQwStQpE0zfq3JSgJw 7Lkq1fB5PnzFR6i1d/atdveaAPSkDrbmx2CKJdxspX5OtWCaKt8J6xuH1iI1wP24QCat +X/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xFvxtf5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n7si12557657ejg.734.2020.07.21.09.09.43; Tue, 21 Jul 2020 09:10:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xFvxtf5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730192AbgGUQIb (ORCPT + 99 others); Tue, 21 Jul 2020 12:08:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:53062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730180AbgGUQI3 (ORCPT ); Tue, 21 Jul 2020 12:08:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53A2822BEF; Tue, 21 Jul 2020 16:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595347708; bh=bE63ofQYOuJCDHkwYPXWxgUsUB8i3gu/kQjGh79M6RE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xFvxtf5wi2negsmKSYII+qpSHBLTYdCnnn1E0C3PnhkIMZ5dLJpDtmr/u3sHC02tp 5SFo/r2n+QH+plLsBmzNni4khMvB0xAz1nF4iEYpE1pkmsE3xbjCem+tGPH7LyX6Zl gzEPDSCll+1qsyOeLZOs4Eo1NUB9nWPMPxhDPYHA= Date: Tue, 21 Jul 2020 18:08:36 +0200 From: Greg Kroah-Hartman To: Tetsuo Handa Cc: Daniel Vetter , Dan Carpenter , linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , syzbot , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, George Kennedy , Jiri Slaby , Dmitry Vyukov Subject: Re: [PATCH v2] fbdev: Detect integer underflow at "struct fbcon_ops"->clear_margins. Message-ID: <20200721160836.GA2109047@kroah.com> References: <20200715015102.3814-1-penguin-kernel@I-love.SAKURA.ne.jp> <20200715094836.GD2571@kadam> <9e6eac10-c5c3-f518-36cc-9ea32fb5d7fe@i-love.sakura.ne.jp> <20200715151220.GE2571@kadam> <20200716100006.GN3278063@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 08:27:21PM +0900, Tetsuo Handa wrote: > On 2020/07/16 19:00, Daniel Vetter wrote: > > On Thu, Jul 16, 2020 at 12:29:00AM +0900, Tetsuo Handa wrote: > >> On 2020/07/16 0:12, Dan Carpenter wrote: > >>> I've complained about integer overflows in fbdev for a long time... > >>> > >>> What I'd like to see is something like the following maybe. I don't > >>> know how to get the vc_data in fbmem.c so it doesn't include your checks > >>> for negative. > >> > >> Yes. Like I said "Thus, I consider that we need more sanity/constraints checks." at > >> https://lore.kernel.org/lkml/b1e7dd6a-fc22-bba8-0abb-d3e779329bce@i-love.sakura.ne.jp/ , > >> we want basic checks. That's a task for fbdev people who should be familiar with > >> necessary constraints. > > > > I think the worldwide supply of people who understand fbdev and willing to > > work on it is roughly 0. So if someone wants to fix this mess properly > > (which likely means adding tons of over/underflow checks at entry points, > > since you're never going to catch the driver bugs, there's too many and > > not enough people who care) they need to fix this themselves. > > But I think we can enforce reasonable constraint which is much stricter than Dan's basic_checks() > (which used INT_MAX). For example, do we need to accept var->{xres,yres} >= 1048576, for > "32768 rows or cols" * "32 pixels per character" = 1045876 and vc_do_resize() accepts only > rows and cols < 32768 ? > > > > > Just to avoid confusion here. > > > >> Anyway, my two patches are small and low cost; can we apply these patches regardless > >> of basic checks? > > > > Which two patches where? > > [PATCH v3] vt: Reject zero-sized screen buffer size. > from https://lkml.kernel.org/r/20200712111013.11881-1-penguin-kernel@I-love.SAKURA.ne.jp This is now in my tree. > [PATCH v2] fbdev: Detect integer underflow at "struct fbcon_ops"->clear_margins. > from https://lkml.kernel.org/r/20200715015102.3814-1-penguin-kernel@I-love.SAKURA.ne.jp That should be taken by the fbdev maintainer, but I can take it too if people want. thanks, greg k-h