Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8834185rwr; Thu, 11 May 2023 06:53:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rd3IGZgdEKH8Nchahxm+Le1mpTwDnNV+xQEM9Ldg5u5BJejjDb3ckvnYen/vTCwcwv+Av X-Received: by 2002:a05:6a20:7d8d:b0:101:166:863f with SMTP id v13-20020a056a207d8d00b001010166863fmr14754476pzj.23.1683813197030; Thu, 11 May 2023 06:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683813197; cv=none; d=google.com; s=arc-20160816; b=AkR8t2Segi8/r333GIyZk1/d8xGxlM3WnqRfjYI8jppZMaFZyfbdrf37c9K2BqVwQ5 8BI6fuy6RScgMwY3lJanKndF9tc+9YKEN9thbJITRZnJR6AqxIDgRqNMw4rkUVNjCn3Y FIbmE4yXk46ThfSjzQGufrTSmyV5cpPZeEUSjgANyEoF4aA/jE2uUqPTxhUiYUGtWYdH Uvg+XZDfaghuPBVw62fZ6cVBNrPRk0lroLAubdCLWi6XzyKvlFibAv4wJDmfDV4mduMK 1LGGVRaUQIlZ4RZ1pN3QPLupmnx1k0UqBQ8tDsbzd7P7lTQMHsHm3IW01oCgsAsU8t6T vxdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=bNMS+yJaTUyOEJLQDsSJtM7hMQk3rsz9Tjm7dcU5DZg=; b=GV7BUbk7oo0Cx0UpGTvuNaQcRkmjkwFGf/K6LosaM/ZJfyZVqB1ZZ1Mx69f/Uw7Z1v X9JO6vWibNJc7j/i8SYPIBad8vMFh+wcdMh53SGGMnu8kXQ1/Ag9L+yX8gcS3z+9nUy7 5jczp2czFqXoHHL3UXM5Ul5+n4JFhshLqklcDyPzuhDq/qT81TdX2dqjaO3658CuW1U3 SXnxwigyCf+qsgnMriQAygFptnWERHKWS0+33n1rB1+xbwUivkOZKI5vud/gyxe4cpoV 0lRgOOGAogfeI7H1jI+4W0+mZgtwSWp0UW27DN1kzYzWQVxF4aU5hCmwsfk372VGZyit Pw0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=pbfvNGcE; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=NUVaoKGj; 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 nv9-20020a17090b1b4900b002475916f319si12315429pjb.148.2023.05.11.06.53.04; Thu, 11 May 2023 06:53:16 -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; dkim=pass header.i=@arndb.de header.s=fm3 header.b=pbfvNGcE; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=NUVaoKGj; 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 S237687AbjEKNmB (ORCPT + 99 others); Thu, 11 May 2023 09:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237983AbjEKNlx (ORCPT ); Thu, 11 May 2023 09:41:53 -0400 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F0232700; Thu, 11 May 2023 06:41:30 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailnew.west.internal (Postfix) with ESMTP id 06E522B05DDC; Thu, 11 May 2023 09:41:02 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Thu, 11 May 2023 09:41:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1683812462; x=1683819662; bh=bN MS+yJaTUyOEJLQDsSJtM7hMQk3rsz9Tjm7dcU5DZg=; b=pbfvNGcEhT5R087tiN QnEE33cGWBvS5AiGVm1gu96LmUVgkxF03e4K96Ei9qPwA7fiKdXmlXU35YSty4lV upc6nhsgrNKO1Zu5vJdZRzsTYt5+zUsNa1/G1LgbSdyvZAkWWcimIWPpFpGxaLK6 hH7/y6eKFwClAzo+2pbOB483InnbRNbufNRaxh3CrbmLD7GhYXkCtmotomtbcOHW NAkD92i1A1Bqcysq66C1J4W0/8Ffr4tm/CjkCymgi72EioBx6dkJg+rOhYWSOSEQ rfFDwhYNZARWUi2ZC5uIDwtU5o7jO6mXg31RmRIKFygPD4lgfPnMU2vHZpWLzWR9 tY6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1683812462; x=1683819662; bh=bNMS+yJaTUyOE JLQDsSJtM7hMQk3rsz9Tjm7dcU5DZg=; b=NUVaoKGjAUB1IvBp3dt6JHnnJHLVm 5FazabUKUOC3zaEmLNyDQKpBgQBJXDhw6415JSYAsI7vcdS5XzphHJbcm+e1RYhU llcs9weTW01qk5AxUBbjOtH2kzwx7xePfQXIMcfPmjZGOSYBauaruz9JqW/61W85 heX8lT7nka5DtfPGfdG7S5QpZIuNTpDxxrHbUPJHanrVYS+a2Xfw0XBnyLyCziCN FQo1Pxm5MNwRhnbgYrHcF3+uL/xmCS5YxmDTGoWN77KSYtOLmS5dlADRru9/PWae uUp8Kzt4lULTaZjWcoN7X0TwqmJ+FUlxtD2Zae1Lsi2pmq9JY+k/goTzg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeegkedgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepvefhffeltdegheeffffhtdegvdehjedtgfekueevgfduffettedtkeekueef hedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 81468B60089; Thu, 11 May 2023 09:41:01 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-415-gf2b17fe6c3-fm-20230503.001-gf2b17fe6 Mime-Version: 1.0 Message-Id: In-Reply-To: <9c4be198444e9987c826c87b592e9dc6@artur-rojek.eu> References: <20230510110557.14343-6-tzimmermann@suse.de> <202305102136.eMjTSPwH-lkp@intel.com> <49684d58-c19d-b147-5e9f-2ac526dd50f0@suse.de> <743d2b1e-c843-4fb2-b252-0006be2e2bd8@app.fastmail.com> <9c4be198444e9987c826c87b592e9dc6@artur-rojek.eu> Date: Thu, 11 May 2023 15:40:28 +0200 From: "Arnd Bergmann" To: "Artur Rojek" , "Geert Uytterhoeven" Cc: "Thomas Zimmermann" , "kernel test robot" , "Helge Deller" , "Javier Martinez Canillas" , "Daniel Vetter" , "Vineet Gupta" , "Huacai Chen" , "WANG Xuerui" , "David S . Miller" , "James E . J . Bottomley" , "Sam Ravnborg" , suijingfeng@loongson.cn, oe-kbuild-all@lists.linux.dev, Linux-Arch , linux-fbdev@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@lists.linux-m68k.org, loongarch@lists.linux.dev, sparclinux@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 5/6] fbdev: Move framebuffer I/O helpers into Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Thu, May 11, 2023, at 15:22, Artur Rojek wrote: > On 2023-05-11 14:35, Geert Uytterhoeven wrote: >> >> CC Artur, who's working on HP Jornada 680. > Thanks for CC'ing me - I faced this exact issue while working on my > (still not upstreamed) hd6446x PCMCIA controller driver. The PCMCIA > subsystem uses `inb/outb`, which expect the `sh_io_port_base` to be set > to something else than the default `-1`. At first I tried to set it to > `0xa0000000`, so that all I/O goes through the fixed, non-cacheable P2 > area. That however broke some other driver code (I had no time to debug > which one). Eventually I ended up taking a suggestion from a MIPS PCMCIA > driver [1] and simply substract the broken `sh_io_port_base` address > from `HD64461_IOBASE`, as the base for `socket.io_offset`. This way all > the PCMCIA `inb/outb` accesses are absolute, no matter what the > `sh_io_port_base` is set to. This of course is a very ugly solution and > we should instead fix the root cause of this mess. I will have a better > look at this patch set and the problem at hand at a later date. > > Cheers, > Artur > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pcmcia/db1xxx_ss.c?h=v6.4-rc1#n527 I think the best fix would be to change all those drivers away from using inb/outb to readb/writeb, except when they access the actual PCMCIA I/O space behind the bridge. On most of the modern architectures, inb(addr) now turns into approximately readb(PCI_IOBASE + addr), with a bit of extra logic to deal with endianess and barrier semantics. PCI_IOBASE in turn tends to be a hardcoded virtual address to which the physical I/O space window gets mapped during early boot, though you can also #define it to sh_io_port_base if you want to allocate the virtual address dynamically and leave the existing logic unchanged. Setting sh_io_port_base to zero however is a problem for any driver that passes a small port number into it -- this then turns into a user space pointer dereference, which is trivially exploitable. Arnd