From patchwork Wed Sep 8 02:56:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12479899 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 F0E35C433EF for ; Wed, 8 Sep 2021 02:56:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BDC6561102 for ; Wed, 8 Sep 2021 02:56:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDC6561102 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5EA83900009; Tue, 7 Sep 2021 22:56:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 59ABD900003; Tue, 7 Sep 2021 22:56:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 488D3900009; Tue, 7 Sep 2021 22:56:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 34262900003 for ; Tue, 7 Sep 2021 22:56:06 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E6269180FEACE for ; Wed, 8 Sep 2021 02:56:05 +0000 (UTC) X-FDA: 78562891890.37.69CCC7C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf03.hostedemail.com (Postfix) with ESMTP id 774103000096 for ; Wed, 8 Sep 2021 02:56:05 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 7951661100; Wed, 8 Sep 2021 02:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1631069764; bh=XNahHEED0dv6D5JHiqZXWfyh6iSLlm+nqYHpDiwzbDA=; h=Date:From:To:Subject:In-Reply-To:From; b=SiCIdy0P+jl/WLClD+IevWFwbfi1+1KWXSv3SaBEChlYZ94XKj1vrXA9EwsIqIVCE ++GjYM1ASPejpA9wtsSxmP/P7YFbjVj+hH8K4n5hO9cRxuN+mKQ/v8bhfSQHy102cH ACdKvvlWMW/QrQjJJqm7OlATBlo8i7kDLLeQ7uLo= Date: Tue, 07 Sep 2021 19:56:04 -0700 From: Andrew Morton To: akpm@linux-foundation.org, hch@lst.de, linux-mm@kvack.org, mm-commits@vger.kernel.org, npiggin@gmail.com, peterz@infradead.org, torvalds@linux-foundation.org Subject: [patch 055/147] mm: don't allow executable ioremap mappings Message-ID: <20210908025604.WeTOgRzRO%akpm@linux-foundation.org> In-Reply-To: <20210907195226.14b1d22a07c085b22968b933@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=SiCIdy0P; dmarc=none; spf=pass (imf03.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 774103000096 X-Stat-Signature: 5mpxq3e93c8zrmapbjym51ujw69kg879 X-HE-Tag: 1631069765-236212 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: From: Christoph Hellwig Subject: mm: don't allow executable ioremap mappings There is no need to execute from iomem (and most platforms it is impossible anyway), so add the pgprot_nx() call similar to vmap. Link: https://lkml.kernel.org/r/20210824091259.1324527-3-hch@lst.de Signed-off-by: Christoph Hellwig Cc: Nicholas Piggin Cc: Peter Zijlstra Signed-off-by: Andrew Morton --- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/vmalloc.c~mm-dont-allow-executable-ioremap-mappings +++ a/mm/vmalloc.c @@ -316,7 +316,7 @@ int ioremap_page_range(unsigned long add { 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;