Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1183266pxj; Sat, 15 May 2021 06:27:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJEZydS61qk3mAUvEjB+MPpyPBlI1oBBYoQr9T5IeI/kOT9nNiGpYOM4yyXY7EF6KTnEWJ X-Received: by 2002:a05:6638:29a:: with SMTP id c26mr47999043jaq.135.1621085246203; Sat, 15 May 2021 06:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621085246; cv=none; d=google.com; s=arc-20160816; b=r6ChHj44kYOc1K2hxLyJdhqsb0X1pVsO00D+tN9ecQRVT3vfd3TBgrEelBVCOUXcgZ WR0qT9b8OUpjzyrBkqTnjdBv3QFpWG9W8hBQ3mArrbg69E2xN4gDLRoLmjVLQu7/745e c45web552bGQ0yTz9K7ZjUmW0Nu20JakY4/m7LQt5duH43os+w98QIntiTkF/XIDEMrS vYZ/PprIZMwct96AUUX55tmc6uwcU9iLi4Bl9x1maU1nzeIp2ao5vSSB4SffDR7cs+nn qmO7f+BGI099AAsuVfarE202yXaIxvL6o3CfA0ugADI8MLi5t/x3OJjj8haGq4X4Za35 GgPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qmD8bOtABF5XD+YzylZZ0F+UXv+l/cf1tAlHtz2MQKI=; b=LWfhGWnuMFhgfN5danwrf4zf1ZgtndTA78Pk5CiZUPGY98K9PqtUPm3onpT4r+1oQE dhLUS+QFQkpqQa0mMUjBISYkQ1FWMsMASqqeE1yogmR8cV0VF4uUOYxrF3CiIzUdvsbg 7112wZw6nxSrxzTbiwbhl2qgtgog+1eQgyN2+oGrl+OXSrODMoUSIUraICGtCogX/pHh 2JqeJOS+q8mIOhlPbuhe3x3ewzCBdxMVmGYve0iv0om6Mqqu8V7Ivs7rQcwkO6X2k1Pm hwNG3twBWni3i8hApIFtS65RpYKYPkU2D14IVWt/UItEudI6VBoJC8xOVa3NBtlr2UCH CRWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=E7NGDr8b; 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 k6si7953209ion.34.2021.05.15.06.26.58; Sat, 15 May 2021 06:27:26 -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=@linux-foundation.org header.s=google header.b=E7NGDr8b; 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 S231373AbhENVMT (ORCPT + 99 others); Fri, 14 May 2021 17:12:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbhENVMR (ORCPT ); Fri, 14 May 2021 17:12:17 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EA4CC06174A for ; Fri, 14 May 2021 14:11:04 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id p12so90109ljg.1 for ; Fri, 14 May 2021 14:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qmD8bOtABF5XD+YzylZZ0F+UXv+l/cf1tAlHtz2MQKI=; b=E7NGDr8baMYrNmyWjoI5iqN4uwMNaqda9XZ6KgibagBhs7q01o3AiUnWU21oLy+K+p 05yfVvaCeBxwJ+GRX7lNtGVBy1um0kIwp/pOYG3jAYfNG7rU+EMqRTrceEygaNGT81+E I6Kf4BqE1SyN58yvSQudkP2u9VbbGuJjaYF7U= 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=qmD8bOtABF5XD+YzylZZ0F+UXv+l/cf1tAlHtz2MQKI=; b=fw9aB24KP/OnVDhRQDfIf450SGTSCmQBkCM+JRZMePoFmOlVbCYESHZNa83Um2OrKm ViCwdplZpaJ7KUx1NgXmtw8/MSiWy51hi4ducRmTSPctwOrlEBU+iPw8TdMX5eXkt2Ud PHwfzERN0p+jWKVD4RuozPQ9OHaDlXBdR5qvKfxHRolTbi97n8aID8rUzcottH3ww/bd FUQI5aG52gfPw7y7R4BjC8PFow5+qbatZzV7wWATUQCHG2yD12+9lIOL7U2xYaZMrV2f 8MLkXWkC8S/Lffq64y/REmHTIhJKMxXYg/8ZqDaJyltxOdLLkCuquqJfBGItcUOpYXQK fYNQ== X-Gm-Message-State: AOAM533GSQ1B0X3Pl4EVORZrWcUCA832KIa3oKKqkAA65CWn48ymw/ea aKrCSg7eiI88AtSofYD7SfnqXRZ225U1PTaA3DY= X-Received: by 2002:a05:651c:210e:: with SMTP id a14mr23912565ljq.156.1621026662509; Fri, 14 May 2021 14:11:02 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id q27sm1444271ljm.127.2021.05.14.14.11.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 May 2021 14:11:01 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id c15so57950ljr.7 for ; Fri, 14 May 2021 14:11:00 -0700 (PDT) X-Received: by 2002:a2e:22c4:: with SMTP id i187mr38530598lji.465.1621026660520; Fri, 14 May 2021 14:11:00 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: Linus Torvalds Date: Fri, 14 May 2021 14:10:44 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] video: fbdev: vga16fb: fix OOB write in vga16fb_imageblit() To: "Maciej W. Rozycki" 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" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 1:32 PM Linus Torvalds wrote: > > Another alternative would be to just delay the resize to when vcmode > is put back to text mode again. That sounds somewhat reasonable to me, > but it's a pretty big thing. Actually thinking more about that option, it sounds horrible. It would mean that we'd continue to use the old geometry for the actual VC buffers for a random time, and then change it to the new geometry at some arbitrary point. So I think the only reasonable approach (apart from just my "don't do that then") might be to just always call ->con_resize(). There are only actually three cases of "->con_resize()", so it might not be too bad. Looking at it, both sisusbcon_resize() and vgacon_resize() seem to be trivially fine in KD_GRAPHICS mode. vgacon already seems to have that "!vga_is_gfx" test, and does vgacon_doresize() at vgacon_switch(). It might need to add a vgacon_doresize() to the vgacon_blank() case 0 code so that it actually does the right thing when going back to KD_TEXT mode. And fbcon_resize() looks like it might be mostly ok with it too. Again, there is a con_is_visible() test, and I suspect that might need to be changed to if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) instead, but it doesn't look _too_ bad. So I think just removing the "vc->vc_mode != KD_GRAPHICS" test from resize_screen() might be the way to go. That way, the low-level data structures actually are in sync with the resize, and the "out of bounds" bug should never happen. Would you mind testing that? Linus