Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3420279imm; Tue, 29 May 2018 07:01:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK7yX73QRZ9PpucwmAwxqs34KjIH/+k9/BnA6AwRMrJWXUv0swCFrHlBJz7lfiLbaq6ujI5 X-Received: by 2002:a65:4348:: with SMTP id k8-v6mr3276358pgq.341.1527602490433; Tue, 29 May 2018 07:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527602490; cv=none; d=google.com; s=arc-20160816; b=cJ8xi1vyCoK0vV4qI0YoZfzdF34eN/mW0dgOpnux7KF6/hkQwUv+wrtsLmvsr8MLEm hqtZQAK/SvSsetiCK13v6Xk63mR8UWqKyX4kla10xnGtLB/KJUhKHvnj1umQRguqYgNn 6V+tV32ZmdR/cl808ZlCiRYLsUgq2UVJuQLi9vfumg+YReCamP3NZv8+3zs3QTLacApl k6cLpSQu5RlbTBjONDPuNJYHrYEsET/hdanFoGIVd1JIn5d8doZahubpXrykjqVci4r+ 9F+j02aB5ZDu0/5OThK4KQuNKgZG8yiT+uIAku8+QhbynEpn3ItAXuhn8d35H2modBRk 6atg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=KzrVw4OnMFCKHKOrGUgvVefcx762GCgWmSnFwD5B1Do=; b=vg2oVoVG0nAd5EHfTKxtB6PFH0Y46snJFhyX+duudT3pIClkXgDqtKKiRmpOiWupp2 Sg2YlMfT0j2baQkBNaxBgDu2DUyC9Ku9JXDEhqenjj2uI2NnoRIsy2Wt5oCq1+He4cS3 H2F17S/kp1wXhDvw8N3NenQ9KsDlJL4W4ozwLwx2Y6+6Y61/rlej9i+O4AJK2x5nU47K WzT7I2wG7HD1BiV/pakeB0ykWA4HqcdLR0nyFrRbYSQP3g4cNHYzybnudwctqFq0k34N N9z05d9Wb0AyZ2P+AkS79h4JgNMCeX3tvQTlfbKzK9gF9bd0Hx88So5x/p/JvJEic4xF PdTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11-v6si25646358pgr.423.2018.05.29.07.01.16; Tue, 29 May 2018 07:01:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934369AbeE2OAR (ORCPT + 99 others); Tue, 29 May 2018 10:00:17 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8204 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934802AbeE2OAM (ORCPT ); Tue, 29 May 2018 10:00:12 -0400 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: , , , , , , , , , , , , , , , , , , , CC: , , , , 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 Content-Type: text/plain X-Originating-IP: [10.67.189.174] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.10.1