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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 C9D14C2D0E2 for ; Tue, 22 Sep 2020 12:03:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 7D0E42388B for ; Tue, 22 Sep 2020 12:03:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0IV7rioc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D0E42388B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tinet.cat Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=PzJO9HVBIt9UfDcGnYyTIc4RAa6QL7PJkG7mAye4QZQ=; b=0IV7riocSVs9fX4cJEiw7t5Q+ 6FXRzw8TAkCZePSy9EE5EHJmHqPfqMRyySHLEBIqTEtCDcZPhcVa7wM/CM8+X8EJLfRbRGRX+MpRg ynCzWbwamHUNQ7yEGoTTcb/a65TgiPZwgTMwXWMSRK0UddQjuOicNZcFHSXtrolO5pRs0O0PVTQRO GBur6IlK+e4sT9+9t68P5evf5ni7X2gL/c1yh8M8WNO8hlrf1W86ZQxbBbq2A8zMMi3TgushGloAM mqc8kNVqLTgPUVfuyKlC18IJB8EosYqYr+TjSlQo2yMiRBE7de4WY+pPwj8FIAwsPAR4Pgb3ZKLG7 ugLBAGF9g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKh00-00029m-Id; Tue, 22 Sep 2020 12:02:20 +0000 Received: from mx1.dipta.cat ([195.76.233.59] helo=mx1.tinet.cat) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKgzv-00027p-7V for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2020 12:02:16 +0000 X-ASG-Debug-ID: 1600776128-12aaf22b2344a21b0001-tbGyMd Received: from smtp01.tinet.cat (smtp01.tinet.cat [195.77.216.131]) by mx1.tinet.cat with ESMTP id 5q0ZyTHZgB8K8VJ8; Tue, 22 Sep 2020 14:02:08 +0200 (CEST) X-Barracuda-Envelope-From: xdrudis@tinet.cat X-Barracuda-Effective-Source-IP: smtp01.tinet.cat[195.77.216.131] X-Barracuda-Apparent-Source-IP: 195.77.216.131 Received: from martinet.casa.ct (155.red-83-36-226.dynamicip.rima-tde.net [83.36.226.155]) by smtp01.tinet.cat (Postfix) with ESMTPSA id 03937603D1C0; Tue, 22 Sep 2020 14:02:08 +0200 (CEST) Received: from xdrudis by martinet.casa.ct with local (Exim 4.92) (envelope-from ) id 1kKgzn-0001Ig-FH; Tue, 22 Sep 2020 14:02:07 +0200 Date: Tue, 22 Sep 2020 14:02:07 +0200 From: Xavi Drudis Ferran To: Shawn Guo Subject: Re: [PATCH v2] ARM: imx: W+X ocram page in imx6q Message-ID: <20200922120207.GA3308@martinet.casa.ct> X-ASG-Orig-Subj: Re: [PATCH v2] ARM: imx: W+X ocram page in imx6q References: <20200915203037.GA13650@martinet.casa.ct> <20200922071537.GI25109@dragon> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200922071537.GI25109@dragon> User-Agent: Mutt/1.10.1 (2018-07-13) X-Barracuda-Connect: smtp01.tinet.cat[195.77.216.131] X-Barracuda-Start-Time: 1600776128 X-Barracuda-URL: https://195.76.233.59:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at tinet.cat X-Barracuda-Scan-Msg-Size: 2051 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: SPAM GLOBAL 1.0000 1.0000 4.3430 X-Barracuda-Spam-Score: 4.34 X-Barracuda-Spam-Status: No, SCORE=4.34 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=6.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.84798 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_080215_590337_5831458B X-CRM114-Status: GOOD ( 16.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sascha Hauer , NXP Linux Team , linux-arm-kernel@lists.infradead.org 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 El Tue, Sep 22, 2020 at 03:15:38PM +0800, Shawn Guo deia: > I tested it on my imx6q-sabresd board with v5.9-rc6 kernel, and > suspend/resume still works with your patch applied. > Thank you very much. > There is a build warning with your patch though. > Silly me. I'm sorry about that. This new version removes the warning. I've tested on linux-libre-5.8.10 on a wandboard quad (imx6q) and it works the same with or without the patch. Hibernate gives a runtine warning less in 5.8.10 than 5.8.9 (both with or without patch), but suspend still fails to resume the eth phy (both with or without the patch). imx6q: Mark the SRAM page for resume code read-only,executable (once written) The code used for resume after suspend in imx6 is copied to a SRAM on chip, so that it stays in the CPU chip while the system is partially powered down. The page mapping that SRAM was marked as RW+X, which gave a warning when CONFIG_DEBUG_WX=y. Mark it read-only and executable once the writting from kernel text is done to get rid of the warning and prevent possible exploitation. Signed-off-by: Xavier Drudis Ferran diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 40c74b4c4..8baa1307f 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -570,6 +571,13 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata) &imx6_suspend, MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info)); + ret = set_memory_ro((unsigned long)suspend_ocram_base, + __KERNEL_DIV_ROUND_UP(MX6Q_SUSPEND_OCRAM_SIZE, PAGE_SIZE)); + if (ret) { + pr_warn("%s: failed to mark executable on chip SRAM as read only after writing to it: %d!\n", + __func__, ret); + } + goto put_device; pl310_cache_map_failed: _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel