Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270306

Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers

From Dave Hansen <dave.hansen@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers
Date 2015-11-16 17:00 +0100
Message-ID <qvumf-M6-29@gated-at.bofh.it> (permalink)
References <quRbc-1jj-11@gated-at.bofh.it> <quRbc-1jj-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


I'm glad you're looking at this. It obviously needed some love. :)

On 11/14/2015 02:00 PM, Matt Fleming wrote:
> +	npages = (_end - _text) >> PAGE_SHIFT;
> +	text = __pa(_text);
> +	pfn = text >> PAGE_SHIFT;
> +
> +	if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, 0)) {
> +		pr_err("Failed to map kernel text 1:1\n");
> +		return 1;
> +	}

Are _end and _text guaranteed to be aligned?  If not, I think the
calculation might be wrong.  Just for fun, imagine that _end=0xfff and
_text=0x1001.  npages would be 0.

Some other code like set_kernel_text_rw() does alignment on _text.

One nit is that there's quite a bit going on here, like rearranging the
phys_stack arithmetic ordering that is far beyond just simplifying the
paddr vs. pfn issue, but that isn't called out in the changelog at all.

Your fixes all look correct to me, fwiw.
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-14 23:10 +0100
  Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Dave Hansen <dave.hansen@intel.com> - 2015-11-16 17:00 +0100
    Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-17 10:50 +0100
  Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Thomas Gleixner <tglx@linutronix.de> - 2015-11-16 21:30 +0100
    Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Borislav Petkov <bp@suse.de> - 2015-11-16 22:30 +0100
      Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Thomas Gleixner <tglx@linutronix.de> - 2015-11-16 22:50 +0100
        Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Thomas Gleixner <tglx@linutronix.de> - 2015-11-17 10:00 +0100
    Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-17 10:50 +0100
      Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Ingo Molnar <mingo@kernel.org> - 2015-11-18 09:20 +0100
        Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains  page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-20 13:10 +0100

csiph-web