lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080125084633.GA23708@elte.hu>
Date:	Fri, 25 Jan 2008 09:46:33 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	"Huang, Ying" <ying.huang@...el.com>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>, Andi Kleen <ak@...e.de>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/6] x86: fix NX bit handling in change_page_attr


* Jeremy Fitzhardinge <jeremy@...p.org> wrote:

> Huang, Ying wrote:

>> This patch fixes a bug of change_page_attr/change_page_attr_addr on 
>> Intel i386/x86_64 CPUs.  After changing page attribute to be 
>> executable with these functions, the page remains un-executable on 
>> Intel i386/x86_64 CPU.  Because on Intel i386/x86_64 CPU, only if the 
>> "NX" bits of all three level page tables are cleared (PAE is 
>> enabled), the corresponding page is executable (refer to section 
>> 4.13.2 of Intel 64 and IA-32 Architectures Software Developer's 
>> Manual).  So, the bug is fixed through clearing the "NX" bit of PMD 
>> when splitting the huge PMD.

oops, nice detail!

>> Signed-off-by: Huang Ying <ying.huang@...el.com>
>>
>> ---
>>  arch/x86/mm/pageattr.c |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> --- a/arch/x86/mm/pageattr.c
>> +++ b/arch/x86/mm/pageattr.c
>> @@ -124,6 +124,7 @@ static int split_large_page(pte_t *kpte,
>>  	/*
>>  	 * Install the new, split up pagetable:
>>  	 */
>> +	pgprot_val(ref_prot) &= ~_PAGE_NX;
>>   
>
> I don't think its a good idea to treat pgprot_val() as an lvalue - it 
> precludes it from being turned into an inline function.  I know there 
> are numerous other places which do, but we should avoid making it 
> worse.

applied it with the following cleanup from Thomas:

 static int split_large_page(pte_t *kpte, unsigned long address)
 {
-       pgprot_t ref_prot = pte_pgprot(pte_clrhuge(*kpte));
+       pgprot_t ref_prot;
...
+       ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte)));

i.e. it now goes through all the proper accessors.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ