From patchwork Tue Aug 24 09:12:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12454321 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 DB805C432BE for ; Tue, 24 Aug 2021 09:17:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 73CC561178 for ; Tue, 24 Aug 2021 09:17:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 73CC561178 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1CC0B6B006C; Tue, 24 Aug 2021 05:17:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17BCC6B0071; Tue, 24 Aug 2021 05:17:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 091B0900002; Tue, 24 Aug 2021 05:17:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id E50D26B006C for ; Tue, 24 Aug 2021 05:17:37 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8A1BA8249980 for ; Tue, 24 Aug 2021 09:17:37 +0000 (UTC) X-FDA: 78509421354.36.CFA5A3B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id 46E22801A88D for ; Tue, 24 Aug 2021 09:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ti5A/ILf1WJ2CVbEVdaMaP5K64yHTjJmYJcdIRgT4r8=; b=cmMZmmlzsKVAb1WsZzJmBctNta JElthLUHejS1Bk9uTGAQL/8RXsl4qvXXFQz0fkLmojyKfUwfIDrYIsBISrk46s5gpb49mqvxOsbmG romH7HFI+3GBB35QTyFwg/Ic5S3qnFsKUygkxrmZns/TSzTdgst4VLSsW4aHOEuQH6332YiaedSZP o6Cug3YfZRVkYxVPgYPlOZeWMcAvscK4WiaCeAbIodrumWhWUMrBYgpK2i3PInK8hQnBZ8J/q0fGk hKQyDyLeaGi4mhLxBUHYA9N0XKOD7wnILJlLvQ0DhcsQJSy9QT+Z/49CuKETjybBiRnA3bQmNgXLD j4466HSA==; Received: from [2001:4bb8:193:fd10:f8c0:1a4c:b688:f5a6] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mISXM-00Aq2J-7b; Tue, 24 Aug 2021 09:16:27 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Nicholas Piggin , Peter Zijlstra , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm: don't allow executable ioremap mappings Date: Tue, 24 Aug 2021 11:12:59 +0200 Message-Id: <20210824091259.1324527-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824091259.1324527-1-hch@lst.de> References: <20210824091259.1324527-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cmMZmmlz; spf=none (imf06.hostedemail.com: domain of BATV@casper.srs.infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=BATV@casper.srs.infradead.org; dmarc=none X-Stat-Signature: cqf5gq6xne5c57hir3ebst1mo4s93x5w X-Rspamd-Queue-Id: 46E22801A88D X-Rspamd-Server: rspam04 X-HE-Tag: 1629796657-50105 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: There is no need to execute from iomem (and most platforms it is impossible anyway), so add the pgprot_nx() call similar to vmap. Signed-off-by: Christoph Hellwig --- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e44983fb2d15..3055f04b486b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -316,7 +316,7 @@ int ioremap_page_range(unsigned long addr, unsigned long end, { int err; - err = vmap_range_noflush(addr, end, phys_addr, prot, + err = vmap_range_noflush(addr, end, phys_addr, pgprot_nx(prot), ioremap_max_page_shift); flush_cache_vmap(addr, end); return err;