Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751345AbaKPV0s (ORCPT ); Sun, 16 Nov 2014 16:26:48 -0500 Received: from www.linutronix.de ([62.245.132.108]:58780 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbaKPV0r (ORCPT ); Sun, 16 Nov 2014 16:26:47 -0500 Date: Sun, 16 Nov 2014 22:26:41 +0100 (CET) From: Thomas Gleixner To: Yinghai Lu cc: Kees Cook , Linux Kernel Mailing List , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , Andrew Morton , Andy Lutomirski , Yasuaki Ishimatsu , Wang Nan , David Vrabel Subject: Re: [PATCH v2] x86, mm: set NX across entire PMD at boot In-Reply-To: Message-ID: References: <20141114204517.GA24402@www.outflux.net> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 15 Nov 2014, Yinghai Lu wrote: > +static pmd_t *last_pmd; > /* > * The head.S code sets up the kernel high mapping: > * > @@ -408,9 +409,26 @@ void __init cleanup_highmap(void) > continue; > if (vaddr < (unsigned long) _text || vaddr > end) > set_pmd(pmd, __pmd(0)); > + else > + last_pmd = pmd; Why do you need to store this? You can compute this. > +static void __init cleanup_highmap_tail(unsigned long addr) Brilliant stuff. mark_rodata_ro() is called AFTER free_initmem() which will free exactly that code. > +{ > + int i; > + pte_t *pte; > + > + if (!last_pmd || pmd_none(*last_pmd)) > + return; Aside of the above: This is complete and utter crap. Just another useless function which can be avoided by switching on brain before coding. > Index: linux-2.6/arch/x86/mm/pageattr.c > =================================================================== > --- linux-2.6.orig/arch/x86/mm/pageattr.c > +++ linux-2.6/arch/x86/mm/pageattr.c > @@ -100,7 +100,7 @@ static inline unsigned long highmap_star > > static inline unsigned long highmap_end_pfn(void) > { > - return __pa_symbol(roundup(_brk_end, PMD_SIZE)) >> PAGE_SHIFT; > + return __pa_symbol(PFN_ALIGN(_brk_end)) >> PAGE_SHIFT; > } Wrong as well for CONFIG_DEBUG_RODATA=n for obvious reasons. I know why I have your patches on blacklist .... Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/