From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA652C433EF for ; Sat, 4 Sep 2021 11:21:23 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E61E600D0 for ; Sat, 4 Sep 2021 11:21:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1E61E600D0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4H1sg55JRyz3052 for ; Sat, 4 Sep 2021 21:21:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=luaLPnw8; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ellerman.id.au (client-ip=2401:3900:2:1::2; helo=ozlabs.org; envelope-from=mpe@ellerman.id.au; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=luaLPnw8; dkim-atps=neutral Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4H1sfM4P5qz2xg6 for ; Sat, 4 Sep 2021 21:20:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1630754434; bh=rKIJGr4LxNvf6bGeq19fnSd30tX36l40x3zNqhpTpvs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=luaLPnw8QYAsNQGZqh0g5RYKx8r7mBIqT/9Y3PGDLZthzqEuG71MY6vpLer+nTjy/ w3QwMkdUjQfuwEIpnylzNgP/SwOg7Rn5kxujT/upa9icQM2g+KzdhvwKOmaR1PPHmj 3roNx8acOBkcpfMjcP4omZZl+COk4n52P0YFRB5tQ/zMn3nOWDg51633mcCQxIKzBv QR6DpFWuVfdBoJVpVF27hORP0IEgujZn7BHMHWtALMkKkRBnhmdIjYpDUfjNch6DZO iKX+/OPCkkiOZkApdopXBmM+FD20ZY1lHXjjhpoi70+cvEbs35VG0iDjSXYjCLFfXT /G6IOz1qMJzTg== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4H1sf91PV3z9sVq; Sat, 4 Sep 2021 21:20:32 +1000 (AEST) From: Michael Ellerman To: Nanyong Sun , Christophe Leroy , benh@kernel.crashing.org, paulus@samba.org, akpm@linux-foundation.org, npiggin@gmail.com, christophe.leroy@c-s.fr Subject: Re: [PATCH -next] powerpc/mm: check base flags in ioremap_prot In-Reply-To: References: <20210903090339.3671524-1-sunnanyong@huawei.com> <90aa2b67-24c8-4a5f-d91a-b562054d5c5d@csgroup.eu> Date: Sat, 04 Sep 2021 21:20:25 +1000 Message-ID: <87fsukzix2.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wangkefeng 00584194 , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Nanyong Sun writes: > On 2021/9/3 17:16, Christophe Leroy wrote: >> Le 03/09/2021 =C3=A0 11:03, Nanyong Sun a =C3=A9crit=C2=A0: >>> Some drivers who call ioremap_prot without setting base flags like >>> ioremap_prot(addr, len, 0) may work well before >>> commit 56f3c1413f5c ("powerpc/mm: properly set PAGE_KERNEL flags in >>> ioremap()"), but now they will get a virtual address "successfully" >>> from ioremap_prot and badly fault on memory access later because that >>> patch also dropped the hack adding of base flags for ioremap_prot. >>> >>> So return NULL and throw a warning if the caller of ioremap_prot did >>> not set base flags properly. Why not just hack adding PAGE_KERNEL flags >>> in the ioremap_prot, because most scenarios can be covered by high level >>> functions like ioremap(), ioremap_coherent(), ioremap_cache()... >>> so it is better to keep max flexibility for this low level api. >> >> As far as I can see, there is no user of this fonction that sets flags=20 >> to 0 in the kernel tree. >> >> Did you find any ? If you did, I think it is better to fix the caller. >> >> Christophe >> > I see some vendor's drivers which are not on upstream ... Sorry, but we don't carry extraneous checks in upstream for the sake of out-of-tree drivers. cheers