Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5727CD69.7040901@linux.intel.com>
Date: Mon, 2 May 2016 14:58:01 -0700
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: Thomas Garnier <thgarnie@...gle.com>, "H . Peter Anvin" <hpa@...or.com>,
 Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...e.de>, Andy Lutomirski <luto@...nel.org>,
 Dmitry Vyukov <dvyukov@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>,
 Dan Williams <dan.j.williams@...el.com>, Kees Cook <keescook@...omium.org>,
 Stephen Smalley <sds@...ho.nsa.gov>, Kefeng Wang
 <wangkefeng.wang@...wei.com>, Jonathan Corbet <corbet@....net>,
 Matt Fleming <matt@...eblueprint.co.uk>, Toshi Kani <toshi.kani@....com>,
 Alexander Kuleshov <kuleshovmail@...il.com>,
 Alexander Popov <alpopov@...ecurity.com>, Joerg Roedel <jroedel@...e.de>,
 Dave Young <dyoung@...hat.com>, Baoquan He <bhe@...hat.com>,
 Mark Salter <msalter@...hat.com>,
 Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
 gthelen@...gle.com, kernel-hardening@...ts.openwall.com
Subject: Re: [PATCH v2 2/4] x86, boot: PUD VA support for physical mapping
 (x86_64)

On 05/02/2016 02:41 PM, Thomas Garnier wrote:
> Minor change that allows early boot physical mapping of PUD level virtual
> addresses. This change prepares usage of different virtual addresses for
> KASLR memory randomization. It has no impact on default usage.
...
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 89d9747..6adfbce 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -526,10 +526,10 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
>  {
>  	unsigned long pages = 0, next;
>  	unsigned long last_map_addr = end;
> -	int i = pud_index(addr);
> +	int i = pud_index((unsigned long)__va(addr));
>  
>  	for (; i < PTRS_PER_PUD; i++, addr = next) {
> -		pud_t *pud = pud_page + pud_index(addr);
> +		pud_t *pud = pud_page + pud_index((unsigned long)__va(addr));
>  		pmd_t *pmd;
>  		pgprot_t prot = PAGE_KERNEL;

pud_index() is supposed to take a virtual address.  We were passing a
physical address in here, and it all just worked because PAGE_OFFSET is
PUD-aligned.  Now that you are moving PAGE_OFFSET around a bit and not
PUD-aligning it, this breaks.  Right?

Could you spell this out a bit more the changelog?

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.