From patchwork Tue May 29 13:36:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 10435563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4E4E601E9 for ; Tue, 29 May 2018 14:04:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DFDE28821 for ; Tue, 29 May 2018 14:04:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 998B22885B; Tue, 29 May 2018 14:04:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1EE228DC6 for ; Tue, 29 May 2018 14:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jhnLfz1gE2couSeAhFUws2dW3bzyuMdmuPDy6poFrf0=; b=H1JRPt0xGcD9CW vpZa5HK6qeez6LGMxh06Jt5FHHbIFCQyYPAfiF5uFv3BFb1kwScYRm2wOUR+8xcKnrdcboD4pSYqk E32oDdtcc5lZ9CyjU3gpzbAWlmCrQK5T+tL97WBWKSafahXSW4MSixT9TLKbWIQgHHS9ThLF7EJcL 7rJXrtAqBF1n471Fdc+fGc2FWdgfVznhpZ/b/JSz1vvn6qWEsHF2FJEu0jHI6L//+i7OrDUyzf3oS 3qLGTtz+4yB2/9cOIOwVdQGeuUepYUoQIdclkp8mxV58lPIfV+hOstoM0TUlacmpIzez1vf2HYnf4 q8yKAocP+x6+RgtVbvnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNfBm-0005tU-Cc; Tue, 29 May 2018 14:01:26 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNfAh-0004Ku-Vh for linux-arm-kernel@lists.infradead.org; Tue, 29 May 2018 14:00:30 +0000 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9FC0A5498D3F0; Tue, 29 May 2018 21:59:53 +0800 (CST) Received: from linux-work.huawei.com (10.67.189.174) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.382.0; Tue, 29 May 2018 21:59:47 +0800 From: nixiaoming To: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 2/3] x86:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro Date: Tue, 29 May 2018 21:36:22 +0800 Message-ID: <20180529133622.26982-1-nixiaoming@huawei.com> X-Mailer: git-send-email 2.10.1 MIME-Version: 1.0 X-Originating-IP: [10.67.189.174] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180529_070020_211078_41CB2D18 X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, x86@kernel.org, nixiaoming@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP mark_rodata_ro is only called by the function mark_readonly when CONFIG_STRICT_KERNEL_RWX=y if CONFIG_STRICT_KERNEL_RWX is not set a compile warning may be triggered: unused function Signed-off-by: nixiaoming --- arch/x86/mm/init_32.c | 2 ++ arch/x86/mm/init_64.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c893c6a..121c567 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -920,6 +920,7 @@ static void mark_nxdata_nx(void) set_pages_nx(virt_to_page(start), size >> PAGE_SHIFT); } +#ifdef CONFIG_STRICT_KERNEL_RWX void mark_rodata_ro(void) { unsigned long start = PFN_ALIGN(_text); @@ -957,3 +958,4 @@ void mark_rodata_ro(void) if (__supported_pte_mask & _PAGE_NX) debug_checkwx(); } +#endif /*end of CONFIG_STRICT_KERNEL_RWX*/ diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 0a40060..1b7a1a7 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1245,6 +1245,7 @@ void set_kernel_text_ro(void) set_memory_ro(start, (end - start) >> PAGE_SHIFT); } +#ifdef CONFIG_STRICT_KERNEL_RWX void mark_rodata_ro(void) { unsigned long start = PFN_ALIGN(_text); @@ -1298,6 +1299,7 @@ void mark_rodata_ro(void) */ pti_clone_kernel_text(); } +#endif int kern_addr_valid(unsigned long addr) {