Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1038854pxj; Sat, 15 May 2021 01:47:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPnQArFagLEnPKOJlm37FV4U80FdjLwUlOPNqA3W4IA3qnUSBkqegSBqF0XQBielfqh0Ws X-Received: by 2002:a02:cac6:: with SMTP id f6mr46319866jap.118.1621068436268; Sat, 15 May 2021 01:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621068436; cv=none; d=google.com; s=arc-20160816; b=OkPPJfj0LWouqj+VRhjpsTTX8FLnGsksCre2tFC4hVs1At3vJLrAhGlBIrFkVIkZZA T5O1DEQdjhhhA6hidjvPbvZzUg5CHUW/y/a2wNyBccPpr5FGI9yT26HF+PM7K6k6nvm6 6L+D8YmyvFtYr1TIr/GFtJaBHWWZsnndLcc/ySMMwswmsAWZgqIcQpqjtJmcUdH+hEHH 5+AkEFEQUDSXXQNgwYYOBX2wsT7tzq/Thu+qBL94j9XXkrLEJtYpKxXvDMIWGirPQHvA uBojqCN8mWGtD5P5ysTxsdm1cedffTBlSaFCiBf74uzl27782KP0+ruVTSDTQq1FO0zs nhMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=8zOi7V4yE4+3M9HiCmXQmQJEecQDJC1MV1HpIftHrfs=; b=FclEe71w7XTEHgPDhHDBWupTa8hSPIwIdb9TvqKBXIWI2uzwSxo6JO519yIY5eeCmm UPjvq2jLuJdi+JI9OzNtnQI3UIi8bHY0fkWSiEFVvkHXWQsLqzcjiO7h42AWkL7a7iyy 6CWVzn+4K0eZ/qTy2CpNdCfv6p92Nhc8/AMnJTDOCxXZoFOQqz5NKtlICeOLpB88zKbn jh929uZIfALf0pdejnYm/19jiNlDlND1ocOc0OuALM0In3SmvrEPutIUyx/8iTTdl+yB Bv5in7uTrI2dQMWDaQKJbh/a8yRjPKaXJiVRjWreuWCI+71U40Or2m5SBeM/+Nd/PRvE DbdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h21si9941241jav.99.2021.05.15.01.46.50; Sat, 15 May 2021 01:47:16 -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; 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 S230178AbhENU1L (ORCPT + 99 others); Fri, 14 May 2021 16:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230394AbhENU1J (ORCPT ); Fri, 14 May 2021 16:27:09 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3833BC061574; Fri, 14 May 2021 13:25:57 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id F21B192009C; Fri, 14 May 2021 22:25:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id EAA2B92009B; Fri, 14 May 2021 22:25:53 +0200 (CEST) Date: Fri, 14 May 2021 22:25:53 +0200 (CEST) From: "Maciej W. Rozycki" To: Linus Torvalds cc: Tetsuo Handa , dri-devel , Linux Fbdev development list , Linux Kernel Mailing List , Daniel Vetter , syzbot , Bartlomiej Zolnierkiewicz , Colin King , Greg Kroah-Hartman , Jani Nikula , Jiri Slaby , syzkaller-bugs , "Antonino A. Daplas" Subject: Re: [PATCH] video: fbdev: vga16fb: fix OOB write in vga16fb_imageblit() In-Reply-To: Message-ID: References: <0000000000006bbd0c05c14f1b09@google.com> <6e21483c-06f6-404b-4018-e00ee85c456c@i-love.sakura.ne.jp> <87d928e4-b2b9-ad30-f3f0-1dfb8e4e03ed@i-love.sakura.ne.jp> <05acdda8-dc1c-5119-4326-96eed24bea0c@i-love.sakura.ne.jp> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 May 2021, Linus Torvalds wrote: > > Currently it is impossible to control upper limit of rows/columns values > > based on amount of memory reserved for the graphical screen, for > > resize_screen() calls vc->vc_sw->con_resize() only if vc->vc_mode is not > > already KD_GRAPHICS > > Honestly, the saner approach would seem to be to simply error out if > vc_mode is KD_GRAPHICS. > > Doing VT_RESIZE while in KD_GRAPHICS mode seems _very_ questionable, > and is clearly currently very buggy. I haven't looked into it any further beyond tracking down (again, using the LMO tree) the originating change as the other fix took precedence. It came with: commit 094e0a9cdbdf1e11a28dd756a6cbd750b6303d10 Author: Ralf Baechle Date: Sun Jun 1 12:07:37 2003 +0000 Merge with Linux 2.5.51 along with framebuffer console support: +inline int resize_screen(int currcons, int width, int height) +{ + /* Resizes the resolution of the display adapater */ + int err = 0; + + if (vcmode != KD_GRAPHICS && sw->con_resize) + err = sw->con_resize(vc_cons[currcons].d, width, height); + return err; +} + A handler for fbcon was added shortly afterwards with: commit bab384bdbe279efd7acc2146ef13b0b0395b2a42 Author: Ralf Baechle Date: Tue Jun 3 17:04:10 2003 +0000 Merge with Linux 2.5.59. however vgacon didn't have a handler for it until commit 28254d439b8c ("[PATCH] vga text console and stty cols/rows") two years later only. Overall I think it does make sense to resize the text console at any time, even if the visible console (VT) chosen is in the graphics mode, as my understanding (and experience at least with vgacon) is that resizing the console applies globally across all the VTs. So the intent of the original change appears valid to me, and the choice not to reprogram the visible console and only store the settings for a future use if it's in the graphics mode correct. Which means any bug triggered here needs to be fixed elsewhere rather than by making the request fail. NB for fbcon the usual ioctl to resize the console is FBIOPUT_VSCREENINFO rather than VT_RESIZEX; fbset(8) uses it, and I actually experimented with it and a TGA-like (SFB+) framebuffer when at my lab last time, as Linux is kind enough to know how to fiddle with its clockchip. It works just fine. Maciej