Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp706460rwr; Thu, 20 Apr 2023 05:32:02 -0700 (PDT) X-Google-Smtp-Source: AKy350aLOx1K0G3H4+cxe9OA4j2Vw1ZPgz7olx172NOrugMzZMwSiMc3mzNeHCQX4WGRXEgWKILB X-Received: by 2002:a17:902:ab92:b0:1a6:8ed5:428a with SMTP id f18-20020a170902ab9200b001a68ed5428amr1430365plr.22.1681993922205; Thu, 20 Apr 2023 05:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681993922; cv=none; d=google.com; s=arc-20160816; b=y4Hmq6OmSEn0gkscdPoArQiXCEZfsbCf5LtnSZZgehdjT8gcTEdwF4jCmAiUYCDbeK 6cjAHbjn4ceIqsqCmDgddHdY7rWA3HfGB/gvS35X5OYsw1srNKcwed3gynS5RgD/q80s VhIoJsXjKjGTaJnEy9nKIJBfzSDxrzgvb8VNIyxeFRA6iC47/ntWnFSjIM+GgqYiWcoy su+D1c6h4M3NTM/cek6j5Uu7NdUjIK6dddd+UP7p3668SBtmsSmui1Mf8fOxXY4BNSeU kgBLazaSrl2QEQBwyiNw3Gq2VJHWJ98blLaQ5z8TfKax/4rgB7Mt53wLSuyLwXM0yK5o RLtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=7uHkPgLuikmEi8GY5zEZtg7y3ieU/zyoSFIuDBlVwpA=; b=kXk7rKiMl0IUWPgWL+MuxFlkhwrZxPjITauxMuzI4+f8kbdtd8Aq8xubvOHPmsPMeu 4cEgAF7OSRstOv+eAGMea7DwT1eS14aY7OSCpSL2H3L+sKIBsmMFblWkEJYrkfsFonvx bnTRnqtey78J1dNJXWtJF68t3Y2gQhq7LsMz8kHrt+JUlwYXSJfpmifaziHdaN8dukHo D0uvILWDxWTA+ERx+Hn+AHTs4tdExIvr8IgXlp+Z36KCEgHlq5wP0Wd+jT+TL88v4w38 KrTMSQ9WZTL2ShNOQYbA1IYjAuV2Uu+pIyWcxpT06byaR3Dd711YC4MBpRFyiyL9F9bH KSqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a1709027e0f00b00194afb5a3f9si1561997plm.164.2023.04.20.05.31.43; Thu, 20 Apr 2023 05:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232605AbjDTMZd convert rfc822-to-8bit (ORCPT + 99 others); Thu, 20 Apr 2023 08:25:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233945AbjDTMZb (ORCPT ); Thu, 20 Apr 2023 08:25:31 -0400 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1C4A8F; Thu, 20 Apr 2023 05:25:29 -0700 (PDT) Received: by mail-yb1-f169.google.com with SMTP id a11so2083236ybm.3; Thu, 20 Apr 2023 05:25:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681993529; x=1684585529; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gXInmwaqBbfh6VGdRfeo5HdvJy20M73WF7/BcwOEW+c=; b=EdUCnQscPSboIGILIq2tKhbETz1HKNgnjL0hwA4jDTqD/YXSCrUYUmHlmt25ED5546 upL4UnPt1frbp83O/V6hsqLKOaDxCBsQIUrRXL3DY6QzWz2Rogkw2UerayfuoQ65VNg1 fK6VZMMdMIIxNQePVe2B6suJknqDYMv2dDQgvE+TQ3HtZMjB3XGrEUfDNclvkWI6aqFy 19wVHqdx4bPDb949xpNWOCFEdskRzip/oggqCZz6a6iJwvlgmLcGT4hxcQSfGXAFEx/o aPfXsVf2GF1cyJuMJtMLornW6pQ9ZQyf/8hj9+sM/VOnogRPCaoFL+7MinAi8XaJ46iG oi7Q== X-Gm-Message-State: AAQBX9easeFVuawVXedMQEe/tKn3A3QyJTrj2mKXIZvYmEe6uYwaLQHo 2r1gqOl/sjmhIc2L+holm28EE8qBGoL01hi3 X-Received: by 2002:a25:5091:0:b0:b92:6588:b07e with SMTP id e139-20020a255091000000b00b926588b07emr1219468ybb.19.1681993528848; Thu, 20 Apr 2023 05:25:28 -0700 (PDT) Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com. [209.85.128.174]) by smtp.gmail.com with ESMTPSA id u73-20020a0deb4c000000b0054605c23114sm302234ywe.66.2023.04.20.05.25.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Apr 2023 05:25:28 -0700 (PDT) Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-555e170df98so37655757b3.10; Thu, 20 Apr 2023 05:25:27 -0700 (PDT) X-Received: by 2002:a0d:eb41:0:b0:555:d531:fdf3 with SMTP id u62-20020a0deb41000000b00555d531fdf3mr634121ywe.32.1681993527822; Thu, 20 Apr 2023 05:25:27 -0700 (PDT) MIME-Version: 1.0 References: <20230420030500.1578756-1-suijingfeng@loongson.cn> <8ec3734b-4bc2-ad8f-fc17-3002f22d1fc9@suse.de> <12c8efaa-7266-5436-dc53-009a0d23b53f@suse.de> <4a0fdbe0-cd4f-9c87-f73a-6d27f5c497bb@189.cn> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 20 Apr 2023 14:25:15 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5] drm/fbdev-generic: prohibit potential out-of-bounds access To: Thomas Zimmermann Cc: Sui Jingfeng <15330273260@189.cn>, Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , Li Yi , Helge Deller , Lucas De Marchi , loongson-kernel@lists.loongnix.cn, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, On Thu, Apr 20, 2023 at 1:10 PM Thomas Zimmermann wrote: > Am 20.04.23 um 12:04 schrieb Sui Jingfeng: > > What will happen if the 'screen_size' is not page_size aligned and mmap > > will mapping in the granularity of pages ? > > You need to map at page granularity. If screen_size is not page-size > aligned, there's this trailing buffer that is accessible, but cannot be > displayed. But userspace has no direct way of knowing that, so let's > ignore that problem for now. Userspace can know, if fb_fix_screeninfo.smem_{start,len} match the actual offset and size. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds