Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2620559ybz; Mon, 27 Apr 2020 00:52:23 -0700 (PDT) X-Google-Smtp-Source: APiQypIrJCzAv/8gdqHX8HGOL+XY60Q3bKZRqW8HqNRbqRavP/iaih0VfU2/rqCk2cD5qEgegYoa X-Received: by 2002:a17:907:2719:: with SMTP id w25mr18937311ejk.107.1587973943864; Mon, 27 Apr 2020 00:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587973943; cv=none; d=google.com; s=arc-20160816; b=0gEriyjcHPxzVB7cr73pFxI9C3hvLjQsIjBRrNMyur6QZMnLhOvFELTm+twCnS7qAl QSQvXvBy3O5HUsBFVWpe5oD6Fwprc81C1mKrM2dkLBeCR9Kkf3uybbSnKLh8kyN911Lg eMr1RqsFs6b2aDvRU87RWNldAmzc0VTUVTo01rs1j7opZgqRbqxZ4guO3g/idhomqw/e DP7jSpfA8fe6wiwZNjgWguHfuCLmhWu9F5voIEDm0KwcY2sy148+q9aTQOCgfTrsxDpt WlBOYP19UhQDPHGfZMBNjraWIpULZKhTNee9wtWL7SBFG0R+4hfaQ98t2dw60sDKX3Vc UAoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eyWzZnW1G9YgvbOb4A45elJWOnYyaLIsm09HE/vkfPY=; b=TSJPdSa4esqJulL0a5X5CDet5wJUzv5dtlGE9l4HJe+YORYXH5xDaJS4gR8Ab8BbEd n4fED3SzR5D+J7N9jIJ8LV5yMmWUwgfFVoL8rQcu6Nrlst2wDgV0emLwINwq4LWMuSPd ltsYpLFvMOlft1oG2Nm4q1c0JpEu88kf+wQpakfrmSmKO4UOgxohZVxn9ohvvfCtM2Y8 mt56HQxYGn2g+4BlHnvtaDp/Bimw2hZGioc8cFjhpILeMnpAuIxMFcNhJv0ZcKUj/xYw gCxFISiJP8sasb13trb8u20URswJS6LPqfRBR80+3ArlQZ0y7Zb6vvEAvovz5+GptBDb mAOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tM0MCyqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si7180222edy.66.2020.04.27.00.52.00; Mon, 27 Apr 2020 00:52:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tM0MCyqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726784AbgD0HtW (ORCPT + 99 others); Mon, 27 Apr 2020 03:49:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:40032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726339AbgD0HtW (ORCPT ); Mon, 27 Apr 2020 03:49:22 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8EC0B20728; Mon, 27 Apr 2020 07:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587973761; bh=gUEF4e+I+5LtkJ+KR7VccemOQ0DrTjrOVZmMSY/BJKo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tM0MCyqEbiKAHZFfSbvrulUKGmf63KAanMfop+yxY/F6lhWkM0zaQHm6rQTTcpbFO HOLa2VqGqzrsyLsi9beTUDK/YUbfTbFXhIaq0lXicUQ2nltnRNrmYVf2nEyZ5hYtxm L4qNVWY1RZq3IAt1JnQvY/wDdHSjRRAJ1cpgYvGY= Date: Mon, 27 Apr 2020 08:49:16 +0100 From: Will Deacon To: Zong Li Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, linux-riscv@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/4] mm: add DEBUG_WX support Message-ID: <20200427074915.GA11787@willie-the-truck> References: <23980cd0f0e5d79e24a92169116407c75bcc650d.1587455584.git.zong.li@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23980cd0f0e5d79e24a92169116407c75bcc650d.1587455584.git.zong.li@sifive.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 21, 2020 at 04:17:12PM +0800, Zong Li wrote: > Some architectures support DEBUG_WX function, it's verbatim from each > others. Extract to mm/Kconfig.debug for shared use. > > Signed-off-by: Zong Li > Suggested-by: Palmer Dabbelt > --- > mm/Kconfig.debug | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug > index 0271b22e063f..077458ad968d 100644 > --- a/mm/Kconfig.debug > +++ b/mm/Kconfig.debug > @@ -118,6 +118,39 @@ config DEBUG_RODATA_TEST > ---help--- > This option enables a testcase for the setting rodata read-only. > > +config ARCH_HAS_DEBUG_WX > + bool > + > +config DEBUG_WX > + bool "Warn on W+X mappings at boot" > + depends on ARCH_HAS_DEBUG_WX > + select PTDUMP_CORE > + help > + Generate a warning if any W+X mappings are found at boot. > + > + This is useful for discovering cases where the kernel is leaving > + W+X mappings after applying NX, as such mappings are a security risk. > + This check also includes UXN, which should be set on all kernel > + mappings. "UXN" is the name of a bit in the arm64 page-table descriptors, so this should be reworded now that it's in generic help text. Will