mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Kees Cook <keescook@chromium.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
	Wang Nan <wangnan0@huawei.com>,
	David Vrabel <david.vrabel@citrix.com>
Subject: Re: [PATCH v2] x86, mm: set NX across entire PMD at boot
Date: Sun, 16 Nov 2014 22:26:41 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1411162216180.3909@nanos> (raw)
In-Reply-To: <CAE9FiQWFa3e=XBzQOHQWv68L_H8OpH=k2fxcN-tJy4o0MccBGQ@mail.gmail.com>

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

  reply	other threads:[~2014-11-16 21:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 20:45 Kees Cook
2014-11-15  1:29 ` Yinghai Lu
2014-11-15  2:29   ` Yinghai Lu
2014-11-15  2:46     ` Kees Cook
2014-11-15  3:38       ` Yinghai Lu
2014-11-15  9:43         ` Yinghai Lu
2014-11-16 21:26           ` Thomas Gleixner [this message]
2014-11-17  3:30             ` Yinghai Lu
2014-11-16 18:52         ` Thomas Gleixner
2014-11-17  3:26           ` Yinghai Lu
2014-11-16 23:44       ` Thomas Gleixner
2014-11-17  4:00         ` Yinghai Lu
2014-11-17 20:27         ` Kees Cook
2014-11-17 20:32           ` Russell King - ARM Linux
2014-11-17 20:43             ` Kees Cook
2014-11-18  7:39           ` Yinghai Lu
2014-11-18 17:11       ` Thomas Gleixner
2014-11-15  3:06   ` Kees Cook
2014-11-15  3:34     ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1411162216180.3909@nanos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=wangnan0@huawei.com \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®