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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 B007CC55185 for ; Sun, 26 Apr 2020 01:05:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 73A0720724 for ; Sun, 26 Apr 2020 01:05:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xyssavs7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73A0720724 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=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E76728E0005; Sat, 25 Apr 2020 21:05:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E27758E0003; Sat, 25 Apr 2020 21:05:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3C8F8E0005; Sat, 25 Apr 2020 21:05:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id B95F98E0003 for ; Sat, 25 Apr 2020 21:05:39 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 72EB96115 for ; Sun, 26 Apr 2020 01:05:39 +0000 (UTC) X-FDA: 76748213598.04.star90_143d64edf3e36 X-HE-Tag: star90_143d64edf3e36 X-Filterd-Recvd-Size: 2881 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Sun, 26 Apr 2020 01:05:38 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 9BEDC206DD; Sun, 26 Apr 2020 01:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587863138; bh=TW9WOI1NaKEA7K+nsipDf0IuvMnVChZsi71PeMPMFD0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=xyssavs7qBvNOpyHvBtiegJkq8Wqg9HwnL8VSZPm/f8KpEORw/jy4AReSAPnbTyaS c0Cw8kBn/g+AbZeu0VCV07nAEV8i657DrVx4QfURgeCFg0zIN8wLlvc0ertQQb0mih zxkGvbWu7NndBLJ4agHVO4dFK7txamla8RvIHWDs= Date: Sat, 25 Apr 2020 18:05:37 -0700 From: Andrew Morton To: Zong Li Cc: 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, will@kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/4] riscv: support DEBUG_WX Message-Id: <20200425180537.063e976b232f8771e22f7ee1@linux-foundation.org> In-Reply-To: <282e266311bced080bc6f7c255b92f87c1eb65d6.1587455584.git.zong.li@sifive.com> References: <282e266311bced080bc6f7c255b92f87c1eb65d6.1587455584.git.zong.li@sifive.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: On Tue, 21 Apr 2020 16:17:13 +0800 Zong Li wrote: > Support DEBUG_WX to check whether there are mapping with write and > execute permission at the same time. > > --- a/arch/riscv/include/asm/ptdump.h > +++ b/arch/riscv/include/asm/ptdump.h > @@ -8,4 +8,10 @@ > > void ptdump_check_wx(void); > > +#ifdef CONFIG_DEBUG_WX > +#define debug_checkwx() ptdump_check_wx() > +#else > +#define debug_checkwx() do { } while (0) > +#endif > + > #endif /* _ASM_RISCV_PTDUMP_H */ It's preferred to implement things in regular C, unless they MUST be implemented in the preprocessor. So... --- a/arch/riscv/include/asm/ptdump.h~riscv-support-debug_wx-fix +++ a/arch/riscv/include/asm/ptdump.h @@ -9,9 +9,14 @@ void ptdump_check_wx(void); #ifdef CONFIG_DEBUG_WX -#define debug_checkwx() ptdump_check_wx() +static inline void debug_checkwx(void) +{ + ptdump_check_wx(); +} #else -#define debug_checkwx() do { } while (0) +static inline void debug_checkwx(void) +{ +} #endif #endif /* _ASM_RISCV_PTDUMP_H */ _