Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4137068imm; Tue, 29 May 2018 23:08:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKLr5So2y6mzTMuoE2iDk9RI3q4f7qQCFRXcm0nxWXQHuG1c9aNFLF+uBwasDM01mj+ilc6 X-Received: by 2002:a63:43c6:: with SMTP id q189-v6mr1175095pga.123.1527660501106; Tue, 29 May 2018 23:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527660501; cv=none; d=google.com; s=arc-20160816; b=BiWQQk4OxjAsjrnU/suVfcT9TBtN/qhPKFUbQC5a77v3ZLYLF5+G9HruO9sp3UwMSE XmZZ3fBm6RDITTqaUwiA/wW6sdfRjTl3ePs9pJIIlS9AyqITc+ls42ur8+xdhOIQpJXK D7eL/afv7u86/pNF/cjPQGDR16/d86njsNKtdveBWjl7iYGIfhfvZSL0HL37CvW1M2vk Xd2XOpu9rS2IbtHuY3rYXRF6xarXmqeH9tMCDh4jttcxBi2l83qpN/QfD80IOlXmufAM PS9LRVL9TZFxZV6Yuob3q4Pb9E/nX2XkTNTkRw/5aOu91snr5ME6qiSc30V37b2oZioT uhXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=373yWMJuRrzRlAiSFMiHE4B5R9qWiuom+2++aj8QUCo=; b=C9rQfNadDzsybvxwkivATrGtgJLVGal16++S8nr20F9t41OUFgPq+T5At6LAH1VxTw AGmV5flKjTUI9EpXMJM2psNGP5vPNYev+zVRXnLAJfck6m+onqBuCoYXA70sBX6jMkEs 9kOmN7u/I+W2BzXBjP14mmBjUklzNhHe5n0yoXDu16eQ6HsvYwBVHnOXUdyspiIfAcrz zj1UHIa5U4d/iRzN/8JfmmwFhZWF2P+5S4N9t8WghklEtDSTmb1INwyu6TEkHSG4pCNE ahgtPA8vPzkZOcy/UBECW2s837lHUx1z1dHAOHny3gAM6bleZbbgijuoPzfIVi6wX/9T tLkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JD+XF/iB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si36141233pln.349.2018.05.29.23.08.07; Tue, 29 May 2018 23:08:21 -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; dkim=pass header.i=@linaro.org header.s=google header.b=JD+XF/iB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935672AbeE3GHO (ORCPT + 99 others); Wed, 30 May 2018 02:07:14 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:36140 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934498AbeE3GHM (ORCPT ); Wed, 30 May 2018 02:07:12 -0400 Received: by mail-io0-f194.google.com with SMTP id d73-v6so20293258iog.3 for ; Tue, 29 May 2018 23:07:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=373yWMJuRrzRlAiSFMiHE4B5R9qWiuom+2++aj8QUCo=; b=JD+XF/iBdYEQ4qA4STcNAFFlSuFdnHC7cKMSYmQRPj1LJAd2bKiw/F+DPKFuCvcv8u /5TDS3q2vHP6MlqCV1rarN53Wdp8VqjUmHGTEiEfTV7QKgWGXQ5fUBcNh4hfQkpXDnno dLFQKBmpnYqCB+GAXeeXfBu8yGEKFpTRrlrH4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=373yWMJuRrzRlAiSFMiHE4B5R9qWiuom+2++aj8QUCo=; b=Wn4OYZk1LsQo7Tg/bZVR0tDmPH5LxuDmPkGfi2gZZMDciuf0oCC+rRK8KnCf4Wusyb 2BV3mbZr6W10C5Y9i1Z6ZQ0KbLOSvyvxaIudsu8AUXQUS3o0UmoR+HugW8StSMjXVr2U 7yKtlAG+lAN2DoeCuC4KTMm5cDDwFkrL+G9bkalp2dVIQExl6NpMGaVUfDfyC48b9jCx 2of65MFjyJWFKdIOXOSueZzhcLfxwUbhon+6uK6ytq7R1EofgOeJFx1Am/zqghkIkX+n IDKautvUHjIoHcbhxFhpohuX8HS4J2Z0UrW+3Kxah83FSF6bL4are7GmVSZ00K5Uthzm j2OQ== X-Gm-Message-State: APt69E0tNkeS8DBxA3asPW1wy7OloHBa+daXGGTykCdYPB3gM+uX0GeA /L2wNKzYV3FKOszUsMMpOR1UJwo/nmlztFjTQYikfA== X-Received: by 2002:a6b:4014:: with SMTP id k20-v6mr966939ioa.277.1527660431346; Tue, 29 May 2018 23:07:11 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bb86:0:0:0:0:0 with HTTP; Tue, 29 May 2018 23:07:10 -0700 (PDT) In-Reply-To: <20180530055815.GB6463@gmail.com> References: <20180529133622.26982-1-nixiaoming@huawei.com> <20180530055815.GB6463@gmail.com> From: Ard Biesheuvel Date: Wed, 30 May 2018 08:07:10 +0200 Message-ID: Subject: Re: [PATCH 2/3] x86:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro To: Ingo Molnar Cc: nixiaoming , Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Kristina Martsenko , Steve Capper , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrew Morton , Vlastimil Babka , Michal Hocko , Dave Hansen , "Williams, Dan J" , "Kirill A. Shutemov" , zhang.jia@linux.alibaba.com, Martin Schwidefsky , Heiko Carstens , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-arm-kernel , "the arch/x86 maintainers" , linux-s390 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30 May 2018 at 07:58, Ingo Molnar wrote: > > * nixiaoming wrote: > >> 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 > > NAK, this is very ugly and the changelog doesn't appear to be true: the build > warning does not trigger in the default build, correct? > I don't see how the build warning could trigger at all, given that mark_rodata_ro() has external linkage.