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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDAFBC54EED for ; Mon, 30 Jan 2023 15:24:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23E386B0072; Mon, 30 Jan 2023 10:24:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C6FC6B0073; Mon, 30 Jan 2023 10:24:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 067F26B0074; Mon, 30 Jan 2023 10:24:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E84446B0072 for ; Mon, 30 Jan 2023 10:24:51 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C381740A67 for ; Mon, 30 Jan 2023 15:24:51 +0000 (UTC) X-FDA: 80411837982.16.E2FDF66 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id BE95DC0015 for ; Mon, 30 Jan 2023 15:24:48 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=f8aP+RFj; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675092289; a=rsa-sha256; cv=none; b=sVlQPtazh3T+uoNqGycM9PCeerMygbNlSFT4qaD/UcdjBfLWBZ+DSPhrckC5ONpcyRxGzz pbelvMArPiuhjQ4fG18Jrg+tMDbeGsRuQcU1BUUuu0MzSIpmTacp2arP0Ie5Yzi/5nVIXv MC8Aec9U7Z4KY1HlSYrvgXNDCeAqEOs= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=f8aP+RFj; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675092289; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=l/UE1BohSbsYPSjuqli4vf8tirXZJGoVCmdHLEf4q2s=; b=OjzuhWXhVHLMqcbG/LpESx3vZ1HduXkFPVOu99Q4HoL4JEuZ2knudLC69qAx1ZQCYkE2Pg SZZ8mw38E5Z9V5fRfv9vdaTywovGYC7PGeKF3gE7pkUoLw7OfAyDZ+cMShOswnyWoDAS+x VcAuleyiEl9STm6ahw5hQVoMYDtxgzg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=l/UE1BohSbsYPSjuqli4vf8tirXZJGoVCmdHLEf4q2s=; b=f8aP+RFjS52Fxxq6I01TNC2w1E 5jN4u+I+N01Ci4f09xlt4KIJ9tHTmfAO94SuJcbvTn+zcMt2w1+YFr6fZ95HwKKK+UOcnIW3lR/Na avmtpoKYS12t4vAMr2NH+kvHUs67h2uIgoj8frrP7vZpAyZvX1vYVex+XFUw+cOybgPPhpLGFmIoi R66WcpMp9bytp0uBRp0STXT1B7yS5ICYN4CF/lpMzQVF+sphmviMwklrlVNOWmGNKZth8+B40kAHR exuq2dSOhDPlMNBzcyDKhLQ4SOxDXHlREa2CnYup1aWTuoimj2nDXOXIs5hkOeRNUxBuJuqYIgBd3 Gp0Gi63Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMW1Q-00ASYH-IK; Mon, 30 Jan 2023 15:24:40 +0000 Date: Mon, 30 Jan 2023 15:24:40 +0000 From: Matthew Wilcox To: "Lad, Prabhakar" Cc: Linux-MM , linux-riscv , Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Palmer Dabbelt , Arnd Bergmann , Rob Herring , Krzysztof Kozlowski , Jessica Clarke , Geert Uytterhoeven , Fabrizio Castro , Biju Das , Chris Paterson Subject: Re: [QUERY]: Block region to mmap Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: BE95DC0015 X-Rspamd-Server: rspam01 X-Stat-Signature: uumo6z6zjd6tqt35zofwo4fdof9mrs1p X-HE-Tag: 1675092288-487150 X-HE-Meta: U2FsdGVkX18e9Zmm26cUeKw6lCQ4hEcEd/neJ2QQb4cp9QsGKLhcniSFjsd3e2Xw9M0ouq5c8S3hqcDCo9MBXaSaSaStcz5ImnFyCmB7ular0Nu91STbXi8LnoTBuZYEDP3EwdzV9GKGRUmZtHJnKTxS6xcIOZ7UsLOOvwysZywRPU+PqJBHphAvbq3tPny6usf3w/du//tJZHV/7e5Oer70alTiV6nPqzuxZRLsMbEfPs/R6IKN8lNsdjYjPRE151GV3JDdBwfltIenbVH97rnRzKAYF3X5AGPRzDJH5j33026Xo0cbn4yTRU225hNT2BcO2w9ixwFYHtFFMO3a1Ch9qwoIp3S0pavHEO+4SMmLUWvzHR1QdBUvU+SCuZjF32Li9CmnXGA/8pp/c0aSvJCNLL7RKTFqjbWFNVBwFlzW6s/+ZCzbNDsvR7vCzMmiCqsARPRn5Bijv3rNulp4xG2DIICIEpi/1YaB4yLq3XHojmCLJSg4Tn0/qyCB1htwIKnZQYLfqNzE4EjklopmcHmlYZRQLvll/gteFATtkvRCX4GeNMUNapShgZ5aGLucG+EDC8DPHsQGJlN/qK785IHOZh/Vs1sIv1hQCNxFrmtuEPdvZXu52oxQmSad9aISWor017rbKvLY15wlfo9dQpyEhZgsadVKafdUe60bGvWsj/OdG1/d+OX7cqNPj36mq/PIjy2fiNv+CFFgVShR3fDEhUb4dJVBBILkVE+KNEoRh4VK5XB+RSnW+a8z3UGx5qEUK+qtGRC5P1inYWbRpHZ9JVVNRTP2XzU4f1w4Rvi9sKqkJzLu4OCtQYjAbapqlpxK6WURqbDn2YYocyLzZjLZ5MS2BDdbSttYpHcUt/w73UBz0bjX+9IKwySWark89v8wP/IwjeOHZAy7e7rO4nTtc3Lih3IgKX54qfGpm1pzDCx2NWWlFs3qXXHdS4jYyrVRnnyCkxGDZu5hBLI HtwYjOxo 6EtQYfvTVEpSFp+Qy+G2T35pSvwzKtrdCqMK8J0himO54uQg7N679m+Nl9uKFHAJVZ7OWTgg6lxeV5Hfz8cSfe2E1glnDRZvfNxJcp4S+q/bYsZcUMQ0hA7mOq1ne1R0wmiTTrAyPgKwyrjvYZxJUL89ILtY6iAALaK5/SzYLtL83lEaa6DPkrVS5v4PLKhUQV29a X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 30, 2023 at 10:53:28AM +0000, Lad, Prabhakar wrote: > > > To avoid this the ILM/DLM memory regions are now added to the root > > > domain region of the PMPU with permissions set to 0x0 for S/U modes so > > > that any access to these regions gets blocked and for M-mode we grant > > > full access (R/W/X). This prevents any users from accessing these > > > regions by triggering an unhandled signal 11 in S/U modes. > > > > I have no idea what any of this means. > > > Basically we are making use of the memory protection unit (MPU) so > that only M-mode is allowed to access this region and S/U modes are > blocked. This sounds like RISC-V terminology. I have no idea what M, S or U modes are (Supervisor and User, I'd guess for the last two?) > > > This works as expected but for applications say for example when doing > > > mmap to this region would still succeed and later down the path when > > > doing a read/write to this location would cause unhandled signal 11. > > > To handle this case gracefully we might want mmap() itself to fail if > > > the addr/offset falls in this local memory region. > > > > No, that's not what you want. You want mmap to avoid allocating address > > space in that virtual address range. I don't know if we have a good > > way to do that at the moment; like I said I've never seen such broken > > hardware before. > > > > I'd say the right way to solve this is to add a new special kind of VMA > > to the address space that covers this range. > Do you have any pointers where I can look further into this? Before we go too deeply into it, how much would it cost to buy all of these parts and feed them into a shredder? I'm not entirely joking; if it's less than the software engineering time it'd take to develop and support this feature, we should do it.