From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>, Andi Kleen <ak@suse.de>,
Glauber de Oliveira Costa <glommer@gmail.com>,
Jan Beulich <jbeulich@novell.com>
Subject: Re: [PATCH 00 of 10] x86: unify asm/pgtable.h
Date: Tue, 08 Jan 2008 16:55:03 -0800 [thread overview]
Message-ID: <47841B67.1030902@goop.org> (raw)
In-Reply-To: <20080109004329.GA6603@elte.hu>
Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
>
>
>> * Ingo Molnar <mingo@elte.hu> wrote:
>>
>>
>>>>>>> #define __PAGE_KERNEL_EXEC \
>>>>>>> - (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
>>>>>>> + (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
>>>>>>>
>>>>>>>
>>>>> This shouldn't be necessary. The old 64-bit code defined everything
>>>>> without _PAGE_GLOBAL, but then used a MAKE_GLOBAL() macro to OR it
>>>>> in later. This seemed a bit roundabout to me, so I just put it in
>>>>> from the outset.
>>>>>
>>> actually, this is wrong.
>>>
>>> a couple of places use __PAGE_* values, which you've now changed to
>>> include the _PAGE_GLOBAL flag.
>>>
>> yep, fixing this resolves the crash.
>>
>
> but then it crashes init:
>
> init[1]: segfault at ffffffffff600400 ip ffffffffff600400 sp
> 7fff81bedda8 error5printk: 7740690 messages suppressed.
>
> because you changed __PAGE_KERNEL_VSYSCALL as well, from:
>
> #define __PAGE_KERNEL_VSYSCALL \
> (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
>
> to:
>
> #define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RO | _PAGE_USER)
>
> but __PAGE_KERNEL_RO is an NX one, so the vsyscall cannot execute
> instructions.
>
> so this wants to be:
>
> #define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
>
> this was the last bug and the resulting kernel boots fine. 3 nasty bugs
> in one patch :-/
>
:-/ indeed. One #ifdef/include-hell bug, one typo, and one... well, see
my other mail. I think my _PAGE_GLOBAL change is actually valid, and
the bug is in change_page_attr after all.
J
> Ingo
>
> ---------------->
> Subject: x86: move all asm/pgtable constants into one place, fix
> From: Ingo Molnar <mingo@elte.hu>
>
> fix.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
> include/asm-x86/pgtable.h | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> Index: linux-x86.q/include/asm-x86/pgtable.h
> ===================================================================
> --- linux-x86.q.orig/include/asm-x86/pgtable.h
> +++ linux-x86.q/include/asm-x86/pgtable.h
> @@ -68,27 +68,27 @@ extern unsigned long long __PAGE_KERNEL,
> #endif /* __ASSEMBLER__ */
> #else
> #define __PAGE_KERNEL_EXEC \
> - (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
> + (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
> #define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
> #endif
>
> #define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW)
> #define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
> #define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
> -#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RO | _PAGE_USER)
> +#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
> #define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
> #define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
> #define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
>
> -#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
> -#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
> -#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
> -#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX)
> -#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
> -#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
> -#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
> -#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL)
> -#define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE)
> +#define PAGE_KERNEL __pgprot(__PAGE_KERNEL | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL | _PAGE_GLOBAL)
> +#define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE | _PAGE_GLOBAL)
>
> /* xwr */
> #define __P000 PAGE_NONE
>
next prev parent reply other threads:[~2008-01-09 1:04 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-08 22:00 Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 01 of 10] x86: move all asm/pgtable constants into one place Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 02 of 10] x86: avoid name conflict for Voyager leave_mm Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 03 of 10] x86/pgtable: unify pagetable accessors Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 04 of 10] x86: unify pgtable accessors which use supported_pte_mask Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 05 of 10] x86: page.h: make pte_t a union to always include pte element Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 06 of 10] x86/vmi: fix compilation as a result of pte_t changes Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 07 of 10] x86: pgtable: unify pte accessors Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 08 of 10] x86: unify zero_page definition Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 09 of 10] x86: unify paravirt pagetable accessors Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 10 of 10] xen: mask out PWT too Jeremy Fitzhardinge
2008-01-09 9:17 ` Jan Beulich
2008-01-09 19:04 ` Jeremy Fitzhardinge
2008-01-08 22:42 ` [PATCH 00 of 10] x86: unify asm/pgtable.h Ingo Molnar
2008-01-08 23:12 ` Ingo Molnar
2008-01-08 23:23 ` Jeremy Fitzhardinge
2008-01-08 23:28 ` Ingo Molnar
2008-01-08 23:44 ` Ingo Molnar
2008-01-08 23:51 ` Ingo Molnar
2008-01-09 0:01 ` Ingo Molnar
2008-01-09 0:13 ` Jeremy Fitzhardinge
2008-01-09 0:20 ` Ingo Molnar
2008-01-09 0:28 ` Ingo Molnar
2008-01-09 0:30 ` Ingo Molnar
2008-01-09 0:43 ` Ingo Molnar
2008-01-09 0:55 ` Jeremy Fitzhardinge [this message]
2008-01-09 1:09 ` Jeremy Fitzhardinge
2008-01-09 1:16 ` Ingo Molnar
2008-01-09 1:18 ` Andi Kleen
2008-01-09 1:22 ` Ingo Molnar
2008-01-09 1:37 ` Andi Kleen
2008-01-09 1:21 ` Jeremy Fitzhardinge
2008-01-09 1:37 ` Ingo Molnar
2008-01-09 0:53 ` Jeremy Fitzhardinge
2008-01-09 0:59 ` Ingo Molnar
2008-01-09 1:07 ` Jeremy Fitzhardinge
2008-01-09 1:12 ` Andi Kleen
2008-01-09 1:20 ` Ingo Molnar
2008-01-09 1:35 ` Jeremy Fitzhardinge
2008-01-09 1:42 ` Andi Kleen
2008-01-09 1:56 ` Jeremy Fitzhardinge
2008-01-09 2:11 ` Andi Kleen
2008-01-09 3:22 ` Jeremy Fitzhardinge
2008-01-09 10:48 ` Ingo Molnar
2008-01-09 10:47 ` Ingo Molnar
2008-01-09 14:26 ` Andi Kleen
2008-01-09 9:37 ` Jan Beulich
2008-01-09 1:11 ` Andi Kleen
2008-01-09 0:07 ` Jeremy Fitzhardinge
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=47841B67.1030902@goop.org \
--to=jeremy@goop.org \
--cc=ak@suse.de \
--cc=glommer@gmail.com \
--cc=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
Powered by JetHome