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=-10.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 56216C433FE for ; Tue, 21 Sep 2021 15:15:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 26F9060F41 for ; Tue, 21 Sep 2021 15:15:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 26F9060F41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PL4MEirdPOqAbyRvpHnHOsdAJ+jMPE5wnurxnC4ALZM=; b=xmMQQ3ZWcb6Ioo 64MW9RvvTSRaVE98z3mUpuifbFEwHOjNb1EISfb+nL7JUlu5rrhFltDhfe2YXcTgy4SaDJsC6Hl8s hhZc1a8wiRKbfyHVVNGETasF6XZ1T6Yh2AZth5dorjK+DRl4RBRd3Pe+Jwg1LcHTgmjpZtiqHkOb1 6XoWiQspD7bKl0AXI5ewGnNZ64FbHsNAKK0+SxbfQWZrSFWbuO/GYciaV8SWjk6AI+2wRGqibFdp1 sWMUaSnMWz25U5YyI706ktNkvEi/3yri60b24eoGYJv7wM2HpxT+IXyHWUKAg3x+h1rgQsay1WGtv xN4b5obOO3oAWP8h3S/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mShT0-004qoW-Ns; Tue, 21 Sep 2021 15:13:54 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mShSx-004qnX-N7 for linux-arm-kernel@lists.infradead.org; Tue, 21 Sep 2021 15:13:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Vzkfg4jvgQLCYHaotsuE7exTwYcWVEGa0HPcmT7aT4g=; b=okIXygUB7aqOK1aoe3UddkpBNU H4poQmmqYtQP61ZI/OAzYVr/ofYm5BTPoREvRdENJw7UZ8EptkEalJdzAZ7CoBiTiys4bFfeELKoT ErOleJKXW/cKkIvA7gLjDjecx5RoX8G57wAR2MFVSUeo1BTx7v+IQZB/7e3xPViRaN+Wj5HGZjKTp 2oub3hGIYxY4WL1aEZvLA0svELS2e6EINsryd8HxaXgeYXWp5wvxYqrbNOyXx2PPvK7DgBo0aIilf iq2D6iEX2Qm1YOJxxP17rs4ymwdBdStdZJD5qN2RvjWcX5vGQ1fZuZqD+SO+ac6E/KJ+I1nVgQZjf 5dt9CFSA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:54710) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mShSt-0002m8-OV; Tue, 21 Sep 2021 16:13:47 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mShSs-0003Li-A2; Tue, 21 Sep 2021 16:13:46 +0100 Date: Tue, 21 Sep 2021 16:13:46 +0100 From: "Russell King (Oracle)" To: Fabio Estevam , Shawn Guo Cc: Tim Harvey , Pengutronix Kernel Team , Linux ARM Mailing List , Lee Jones , Robin Murphy , NXP Linux Team Subject: Re: arm32 insecure W+X mapping Message-ID: References: <381afc78-5a7f-8286-76ea-2e6c7867972d@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210921_081351_804791_261E8EA3 X-CRM114-Status: GOOD ( 21.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 20, 2021 at 09:21:53PM -0300, Fabio Estevam wrote: > Hi Russell, > > On Mon, Sep 20, 2021 at 8:19 PM Russell King (Oracle) > wrote: > > > I think what I'd like to see is a wrapper around set_memory_ro() that > > gets passed the __iomem pointer and size. change_memory_common() > > should accept it as the ioremap() will be located in the vmalloc > > area which change_memory_common() accepts. > > > > Probably something like: > > > > void __arm_iomem_set_ro(void __iomem *ptr, size_t size) > > { > > set_memory_ro((unsigned long)ptr, PAGE_ALIGN(size) / PAGE_SIZE); > > } > > > > in arch/arm/mm/ioremap.c would be nice, just after __arm_ioremap_exec(). > > I've probably just written the patch in wordy words. :) Something like > > this (untested): > > Just tested your patch and DEBUG_WX is happy now: > > [ 5.610346] Checked W+X mappings: passed, no W+X pages found > > Thanks a lot, appreciate it! > > Tested-by: Fabio Estevam Thanks, I've split the patch into two parts - one for generic ARM bits and the other touching imx6 bits. They'll probably be in linux-next this evening. I would like an Ack from Shawn on the imx6 part of the patch before I sent it to Linus at the next merge window. At some point, I will be rebuilding my "misc" branch - I've just thrown a bunch of commits on top of the 5.14-rc based branch from the last cycle as a temporary measure. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel