x86: Make sure IDT is page aligned
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 29 lines · Linux Kernel Mailing List
Gitweb: http://git.kernel.org/linus/;a=commit;h=4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Commit: 4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Parent: 5ff560fd48d5b3d82fa0c3aff625c9da1a301911 Author: Kees Cook <[email protected]> AuthorDate: Tue Jul 16 11:34:41 2013 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Tue Jul 16 15:14:48 2013 -0700x86: Make sure IDT is page aligned
Since the IDT is referenced from a fixmap, make sure it is page aligned. Merge with 32-bit one, since it was already aligned to deal with F00F bug. Since bss is cleared before IDT setup, it can live there. This also moves the other
*_idt_tablevariables into common locations.This avoids the risk of the IDT ever being moved in the bss and having the mapping be offset, resulting in calling incorrect handlers. In the current upstream kernel this is not a manifested bug, but heavily patched kernels (such as those using the PaX patch series) did encounter this bug.
The tables other than
idt_tabletechnically do not need to be page aligned, at least not at the current time, but using a common declaration avoids mistakes. On 64 bits the table is exactly one page long, anyway.Signed-off-by Kees Cook <[email protected]>Reported-by PaX Team <[email protected]>Signed-off-by H. Peter Anvin <[email protected]>
Quoted 5 lines
--- arch/x86/kernel/head_64.S | 15 --------------- arch/x86/kernel/tracepoint.c | 6 ++---- arch/x86/kernel/traps.c | 12 ++++++------ 3 files changed, 8 insertions(+), 25 deletions(-)
This patch is now in Linus's tree. Kees, did you also want this in the -stable tree(s)?
thanks,
greg k-h
Quoted 78 lines
arch/x86/kernel/head_64.S +0
-15@@ -512,21 +512,6 @@ ENTRY(phys_base) #include "../../x86/xen/xen-head.S" - .section .bss, "aw", @nobits - .align L1_CACHE_BYTES -ENTRY(idt_table) - .skip IDT_ENTRIES * 16 - - .align L1_CACHE_BYTES -ENTRY(debug_idt_table) - .skip IDT_ENTRIES * 16 - -#ifdef CONFIG_TRACING - .align L1_CACHE_BYTES -ENTRY(trace_idt_table) - .skip IDT_ENTRIES * 16 -#endif - __PAGE_ALIGNED_BSS NEXT_PAGE(empty_zero_page) .skip PAGE_SIZEarch/x86/kernel/tracepoint.c +2
-4@@ -12,10 +12,8 @@ atomic_t trace_idt_ctr = ATOMIC_INIT(0);struct desc_ptr trace_idt_descr = {NR_VECTORS *16 -1 , (unsigned long ) trace_idt_table }; -#ifndef CONFIG_X86_64 -gate_desc trace_idt_table[NR_VECTORS] __page_aligned_data - = { { { {0 ,0 } } }, }; -#endif +/* No need to be aligned, but done to keep all IDTs defined the same way. */ +gate_desc trace_idt_table[NR_VECTORS] __page_aligned_bss;static int trace_irq_vector_refcount;static DEFINE_MUTEX (irq_vector_mutex);arch/x86/kernel/traps.c +6
-7@@ -63,19 +63,19 @@#include <asm/x86_init.h> #include <asm/pgalloc.h> #include <asm/proto.h> + +/* No need to be aligned, but done to keep all IDTs defined the same way. */ +gate_desc debug_idt_table[NR_VECTORS] __page_aligned_bss;#else #include <asm/processor-flags.h> #include <asm/setup.h> asmlinkage int system_call(void); - -/* -* The IDT has to be page-aligned to simplify the Pentium -* F0 0F bug workaround. -*/ -gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };#endif +/* Must be page-aligned because the real IDT is used in a fixmap. */ +gate_desc idt_table[NR_VECTORS] __page_aligned_bss; +DECLARE_BITMAP (used_vectors,NR_VECTORS );EXPORT_SYMBOL_GPL (used_vectors); --To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 36 lines · Greg KH
Quoted 29 lines · Linux Kernel Mailing List
Gitweb: http://git.kernel.org/linus/;a=commit;h=4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Commit: 4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Parent: 5ff560fd48d5b3d82fa0c3aff625c9da1a301911 Author: Kees Cook <[email protected]> AuthorDate: Tue Jul 16 11:34:41 2013 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Tue Jul 16 15:14:48 2013 -0700x86: Make sure IDT is page aligned
Since the IDT is referenced from a fixmap, make sure it is page aligned. Merge with 32-bit one, since it was already aligned to deal with F00F bug. Since bss is cleared before IDT setup, it can live there. This also moves the other
*_idt_tablevariables into common locations.This avoids the risk of the IDT ever being moved in the bss and having the mapping be offset, resulting in calling incorrect handlers. In the current upstream kernel this is not a manifested bug, but heavily patched kernels (such as those using the PaX patch series) did encounter this bug.
The tables other than
idt_tabletechnically do not need to be page aligned, at least not at the current time, but using a common declaration avoids mistakes. On 64 bits the table is exactly one page long, anyway.Signed-off-by Kees Cook <[email protected]>Reported-by PaX Team <[email protected]>Signed-off-by H. Peter Anvin <[email protected]>Quoted 5 lines
--- arch/x86/kernel/head_64.S | 15 --------------- arch/x86/kernel/tracepoint.c | 6 ++---- arch/x86/kernel/traps.c | 12 ++++++------ 3 files changed, 8 insertions(+), 25 deletions(-)
Quoted 2 lines
This patch is now in Linus's tree. Kees, did you also want this in the -stable tree(s)?
The potential problem was introduced with 4eefbe792baedb474e256d35370849992fcf1c79, so 3.10 needs it, yes. I had also sent a much smaller version here:
http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/commit/?h=idt-stable&id=794c1e0df641e13050cfc4af340fc3c85bed4ea3
Either will address the problem. If there is no problem with taking the larger clean-up for stable, then that's probably easiest.
Thanks!
-Kees
Quoted 80 lines
thanks,
greg k-h
Quoted 74 lines
arch/x86/kernel/head_64.S +0
-15@@ -512,21 +512,6 @@ ENTRY(phys_base) #include "../../x86/xen/xen-head.S" - .section .bss, "aw", @nobits - .align L1_CACHE_BYTES -ENTRY(idt_table) - .skip IDT_ENTRIES * 16 - - .align L1_CACHE_BYTES -ENTRY(debug_idt_table) - .skip IDT_ENTRIES * 16 - -#ifdef CONFIG_TRACING - .align L1_CACHE_BYTES -ENTRY(trace_idt_table) - .skip IDT_ENTRIES * 16 -#endif - __PAGE_ALIGNED_BSS NEXT_PAGE(empty_zero_page) .skip PAGE_SIZEarch/x86/kernel/tracepoint.c +2
-4@@ -12,10 +12,8 @@ atomic_t trace_idt_ctr = ATOMIC_INIT(0);struct desc_ptr trace_idt_descr = {NR_VECTORS *16 -1 , (unsigned long ) trace_idt_table }; -#ifndef CONFIG_X86_64 -gate_desc trace_idt_table[NR_VECTORS] __page_aligned_data - = { { { {0 ,0 } } }, }; -#endif +/* No need to be aligned, but done to keep all IDTs defined the same way. */ +gate_desc trace_idt_table[NR_VECTORS] __page_aligned_bss;static int trace_irq_vector_refcount;static DEFINE_MUTEX (irq_vector_mutex);arch/x86/kernel/traps.c +6
-6@@ -63,19 +63,19 @@#include <asm/x86_init.h> #include <asm/pgalloc.h> #include <asm/proto.h> + +/* No need to be aligned, but done to keep all IDTs defined the same way. */ +gate_desc debug_idt_table[NR_VECTORS] __page_aligned_bss;#else #include <asm/processor-flags.h> #include <asm/setup.h> asmlinkage int system_call(void); - -/* -* The IDT has to be page-aligned to simplify the Pentium -* F0 0F bug workaround. -*/ -gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };#endif +/* Must be page-aligned because the real IDT is used in a fixmap. */ +gate_desc idt_table[NR_VECTORS] __page_aligned_bss; +DECLARE_BITMAP (used_vectors,NR_VECTORS );EXPORT_SYMBOL_GPL (used_vectors);
Quoted 4 lines
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Kees Cook
Chrome OS Security
Quoted 40 lines · Kees Cook
Quoted 36 lines · Greg KH
Quoted 29 lines · Linux Kernel Mailing List
Gitweb: http://git.kernel.org/linus/;a=commit;h=4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Commit: 4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Parent: 5ff560fd48d5b3d82fa0c3aff625c9da1a301911 Author: Kees Cook <[email protected]> AuthorDate: Tue Jul 16 11:34:41 2013 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Tue Jul 16 15:14:48 2013 -0700x86: Make sure IDT is page aligned
Since the IDT is referenced from a fixmap, make sure it is page aligned. Merge with 32-bit one, since it was already aligned to deal with F00F bug. Since bss is cleared before IDT setup, it can live there. This also moves the other
*_idt_tablevariables into common locations.This avoids the risk of the IDT ever being moved in the bss and having the mapping be offset, resulting in calling incorrect handlers. In the current upstream kernel this is not a manifested bug, but heavily patched kernels (such as those using the PaX patch series) did encounter this bug.
The tables other than
idt_tabletechnically do not need to be page aligned, at least not at the current time, but using a common declaration avoids mistakes. On 64 bits the table is exactly one page long, anyway.Signed-off-by Kees Cook <[email protected]>Reported-by PaX Team <[email protected]>Signed-off-by H. Peter Anvin <[email protected]>Quoted 5 lines
--- arch/x86/kernel/head_64.S | 15 --------------- arch/x86/kernel/tracepoint.c | 6 ++---- arch/x86/kernel/traps.c | 12 ++++++------ 3 files changed, 8 insertions(+), 25 deletions(-)Quoted 2 lines
This patch is now in Linus's tree. Kees, did you also want this in the -stable tree(s)?
Quoted 7 lines
The potential problem was introduced with
4eefbe792baedb474e256d35370849992fcf1c79, so 3.10 needs it, yes. I had also sent a much smaller version here:
http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/commit/?h=idt-stable&id=794c1e0df641e13050cfc4af340fc3c85bed4ea3Either will address the problem. If there is no problem with taking the larger clean-up for stable, then that's probably easiest.
I'd prefer to stick with what ended up in Linus's tree, so I'll just queue this one up in a future stable 3.10 release, thanks.
greg k-h
Quoted 46 lines · Greg KH
Quoted 45 lines · Kees Cook
Quoted 36 lines · Greg KH
Quoted 29 lines · Linux Kernel Mailing List
Gitweb: http://git.kernel.org/linus/;a=commit;h=4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Commit: 4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 Parent: 5ff560fd48d5b3d82fa0c3aff625c9da1a301911 Author: Kees Cook <[email protected]> AuthorDate: Tue Jul 16 11:34:41 2013 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Tue Jul 16 15:14:48 2013 -0700x86: Make sure IDT is page aligned
Since the IDT is referenced from a fixmap, make sure it is page aligned. Merge with 32-bit one, since it was already aligned to deal with F00F bug. Since bss is cleared before IDT setup, it can live there. This also moves the other
*_idt_tablevariables into common locations.This avoids the risk of the IDT ever being moved in the bss and having the mapping be offset, resulting in calling incorrect handlers. In the current upstream kernel this is not a manifested bug, but heavily patched kernels (such as those using the PaX patch series) did encounter this bug.
The tables other than
idt_tabletechnically do not need to be page aligned, at least not at the current time, but using a common declaration avoids mistakes. On 64 bits the table is exactly one page long, anyway.Signed-off-by Kees Cook <[email protected]>Reported-by PaX Team <[email protected]>Signed-off-by H. Peter Anvin <[email protected]>Quoted 5 lines
--- arch/x86/kernel/head_64.S | 15 --------------- arch/x86/kernel/tracepoint.c | 6 ++---- arch/x86/kernel/traps.c | 12 ++++++------ 3 files changed, 8 insertions(+), 25 deletions(-)Quoted 2 lines
This patch is now in Linus's tree. Kees, did you also want this in the -stable tree(s)?
The potential problem was introduced with
4eefbe792baedb474e256d35370849992fcf1c79, so 3.10 needs it, yes. I had also sent a much smaller version here:
http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/commit/?h=idt-stable&id=794c1e0df641e13050cfc4af340fc3c85bed4ea3
Quoted 5 lines
Quoted 2 lines
Either will address the problem. If there is no problem with taking the larger clean-up for stable, then that's probably easiest.
I'd prefer to stick with what ended up in Linus's tree, so I'll just queue this one up in a future stable 3.10 release, thanks.
I ended up taking the smaller version, as this one doesn't apply to 3.10, you were right in the beginning :)
thanks,
greg k-h