xen/24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch

69 lines
2.6 KiB
Diff
Raw Normal View History

- fate#310510 - fix xenpaging 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch 24270-Free_d-mem_event_on_domain_destruction..patch - fate#310510 - fix xenpaging 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch - fate#310510 - fix xenpaging 23949-constify_vcpu_set_affinitys_second_parameter.patch - fate#310510 - fix xenpaging 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch 24106-mem_event_check_capabilities_only_once.patch - fate#310510 - fix xenpaging 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch - bnc#727081 - xend domains don't work anymore since update from 12.1 beta to 12.1 RC 1 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch 24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch - bnc#733449 - Panic in mcfg_ioremap when booting xen-dbg.gz on Xeon E3-1230 24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch - fate#310510 - fix xenpaging backport waitqueue changes from xen-unstable 24104-waitqueue_Double_size_of_x86_shadow_stack..patch 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch 24231-waitqueue_Implement_wake_up_nroneall..patch 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch - fate#310510 - fix xenpaging 24227-xenpaging_restrict_pagefile_permissions.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24218-libxc_add_bitmap_clear_function.patch remove old versions: xenpaging.bitmap_clear.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24138-xenpaging_munmap_all_pages_after_page-in.patch 24208-xenpaging_remove_filename_from_comment.patch 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch 24210-xenpaging_use_PERROR_to_print_errno.patch 24211-xenpaging_simplify_file_op.patch 24212-xenpaging_print_gfn_in_failure_case.patch 24213-xenpaging_update_xenpaging_init.patch 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch 24215-xenpaging_track_the_number_of_paged-out_pages.patch 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch 24217-xenpaging_improve_mainloop_exit_handling.patch 24219-xenpaging_retry_unpageable_gfns.patch 24220-xenpaging_install_into_LIBEXEC_dir.patch 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch 24222-xenpaging_use_guests_tot_pages_as_working_target.patch 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch 24224-xenpaging_add_cmdline_interface_for_pager.patch 24225-xenpaging_improve_policy_mru_list_handling.patch 24226-xenpaging_add_debug_to_show_received_watch_event..patch remove old versions: xenpaging.XEN_PAGING_DIR.patch xenpaging.add_evict_pages.patch xenpaging.cmdline-interface.patch xenpaging.encapsulate_domain_info.patch xenpaging.file_op-return-code.patch xenpaging.install-to-libexec.patch xenpaging.low_target_policy_nomru.patch xenpaging.main-loop-exit-handling.patch xenpaging.misleading-comment.patch xenpaging.page_in-munmap-size.patch xenpaging.print-gfn.patch xenpaging.record-numer-paged-out-pages.patch xenpaging.reset-uncomsumed.patch xenpaging.stale-comments.patch xenpaging.target-tot_pages.patch xenpaging.use-PERROR.patch xenpaging.watch-target-tot_pages.patch xenpaging.watch_event-DPRINTF.patch xenpaging.xc_interface_open-comment.patch - bnc#733348 - Use 'xm' in various scripts if xend is running. Modified xmclone.sh and xen-updown.sh - Only emit xl warning when xend is running and -f (force) flag is not specified. Modified disable-xl-when-using-xend.patch - Upstream patches from Jan 24190-hap-log-dirty-disable-rc.patch 24193-hap-track-dirty-vram-rc.patch 24201-x86-pcpu-platform-op.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=161
2011-12-02 21:25:29 +01:00
changeset: 24195:9b65336f688f
user: Keir Fraser <keir@xen.org>
date: Thu Nov 24 15:48:10 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Detect saved-stack overflow and crash the guest.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -106,13 +106,16 @@ void wake_up(struct waitqueue_head *wq)
- fate#310510 - fix xenpaging 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch 24270-Free_d-mem_event_on_domain_destruction..patch - fate#310510 - fix xenpaging 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch - fate#310510 - fix xenpaging 23949-constify_vcpu_set_affinitys_second_parameter.patch - fate#310510 - fix xenpaging 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch 24106-mem_event_check_capabilities_only_once.patch - fate#310510 - fix xenpaging 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch - bnc#727081 - xend domains don't work anymore since update from 12.1 beta to 12.1 RC 1 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch 24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch - bnc#733449 - Panic in mcfg_ioremap when booting xen-dbg.gz on Xeon E3-1230 24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch - fate#310510 - fix xenpaging backport waitqueue changes from xen-unstable 24104-waitqueue_Double_size_of_x86_shadow_stack..patch 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch 24231-waitqueue_Implement_wake_up_nroneall..patch 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch - fate#310510 - fix xenpaging 24227-xenpaging_restrict_pagefile_permissions.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24218-libxc_add_bitmap_clear_function.patch remove old versions: xenpaging.bitmap_clear.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24138-xenpaging_munmap_all_pages_after_page-in.patch 24208-xenpaging_remove_filename_from_comment.patch 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch 24210-xenpaging_use_PERROR_to_print_errno.patch 24211-xenpaging_simplify_file_op.patch 24212-xenpaging_print_gfn_in_failure_case.patch 24213-xenpaging_update_xenpaging_init.patch 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch 24215-xenpaging_track_the_number_of_paged-out_pages.patch 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch 24217-xenpaging_improve_mainloop_exit_handling.patch 24219-xenpaging_retry_unpageable_gfns.patch 24220-xenpaging_install_into_LIBEXEC_dir.patch 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch 24222-xenpaging_use_guests_tot_pages_as_working_target.patch 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch 24224-xenpaging_add_cmdline_interface_for_pager.patch 24225-xenpaging_improve_policy_mru_list_handling.patch 24226-xenpaging_add_debug_to_show_received_watch_event..patch remove old versions: xenpaging.XEN_PAGING_DIR.patch xenpaging.add_evict_pages.patch xenpaging.cmdline-interface.patch xenpaging.encapsulate_domain_info.patch xenpaging.file_op-return-code.patch xenpaging.install-to-libexec.patch xenpaging.low_target_policy_nomru.patch xenpaging.main-loop-exit-handling.patch xenpaging.misleading-comment.patch xenpaging.page_in-munmap-size.patch xenpaging.print-gfn.patch xenpaging.record-numer-paged-out-pages.patch xenpaging.reset-uncomsumed.patch xenpaging.stale-comments.patch xenpaging.target-tot_pages.patch xenpaging.use-PERROR.patch xenpaging.watch-target-tot_pages.patch xenpaging.watch_event-DPRINTF.patch xenpaging.xc_interface_open-comment.patch - bnc#733348 - Use 'xm' in various scripts if xend is running. Modified xmclone.sh and xen-updown.sh - Only emit xl warning when xend is running and -f (force) flag is not specified. Modified disable-xl-when-using-xend.patch - Upstream patches from Jan 24190-hap-log-dirty-disable-rc.patch 24193-hap-track-dirty-vram-rc.patch 24201-x86-pcpu-platform-op.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=161
2011-12-02 21:25:29 +01:00
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
{
char *cpu_info = (char *)get_cpu_info();
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
"push %%rbp; push %%r8; push %%r9; push %%r10; push %%r11; "
"push %%r12; push %%r13; push %%r14; push %%r15; call 1f; "
"1: mov 80(%%rsp),%%rdi; mov 96(%%rsp),%%rcx; mov %%rsp,%%rsi; "
- "sub %%rsi,%%rcx; rep movsb; mov %%rsp,%%rsi; pop %%rax; "
+ "sub %%rsi,%%rcx; cmp %3,%%rcx; jbe 2f; "
+ "xor %%esi,%%esi; jmp 3f; "
+ "2: rep movsb; mov %%rsp,%%rsi; 3: pop %%rax; "
"pop %%r15; pop %%r14; pop %%r13; pop %%r12; "
"pop %%r11; pop %%r10; pop %%r9; pop %%r8; "
"pop %%rbp; pop %%rdi; pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax"
@@ -120,13 +123,20 @@ static void __prepare_to_wait(struct wai
- fate#310510 - fix xenpaging 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch 24270-Free_d-mem_event_on_domain_destruction..patch - fate#310510 - fix xenpaging 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch - fate#310510 - fix xenpaging 23949-constify_vcpu_set_affinitys_second_parameter.patch - fate#310510 - fix xenpaging 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch 24106-mem_event_check_capabilities_only_once.patch - fate#310510 - fix xenpaging 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch - bnc#727081 - xend domains don't work anymore since update from 12.1 beta to 12.1 RC 1 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch 24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch - bnc#733449 - Panic in mcfg_ioremap when booting xen-dbg.gz on Xeon E3-1230 24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch - fate#310510 - fix xenpaging backport waitqueue changes from xen-unstable 24104-waitqueue_Double_size_of_x86_shadow_stack..patch 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch 24231-waitqueue_Implement_wake_up_nroneall..patch 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch - fate#310510 - fix xenpaging 24227-xenpaging_restrict_pagefile_permissions.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24218-libxc_add_bitmap_clear_function.patch remove old versions: xenpaging.bitmap_clear.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24138-xenpaging_munmap_all_pages_after_page-in.patch 24208-xenpaging_remove_filename_from_comment.patch 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch 24210-xenpaging_use_PERROR_to_print_errno.patch 24211-xenpaging_simplify_file_op.patch 24212-xenpaging_print_gfn_in_failure_case.patch 24213-xenpaging_update_xenpaging_init.patch 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch 24215-xenpaging_track_the_number_of_paged-out_pages.patch 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch 24217-xenpaging_improve_mainloop_exit_handling.patch 24219-xenpaging_retry_unpageable_gfns.patch 24220-xenpaging_install_into_LIBEXEC_dir.patch 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch 24222-xenpaging_use_guests_tot_pages_as_working_target.patch 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch 24224-xenpaging_add_cmdline_interface_for_pager.patch 24225-xenpaging_improve_policy_mru_list_handling.patch 24226-xenpaging_add_debug_to_show_received_watch_event..patch remove old versions: xenpaging.XEN_PAGING_DIR.patch xenpaging.add_evict_pages.patch xenpaging.cmdline-interface.patch xenpaging.encapsulate_domain_info.patch xenpaging.file_op-return-code.patch xenpaging.install-to-libexec.patch xenpaging.low_target_policy_nomru.patch xenpaging.main-loop-exit-handling.patch xenpaging.misleading-comment.patch xenpaging.page_in-munmap-size.patch xenpaging.print-gfn.patch xenpaging.record-numer-paged-out-pages.patch xenpaging.reset-uncomsumed.patch xenpaging.stale-comments.patch xenpaging.target-tot_pages.patch xenpaging.use-PERROR.patch xenpaging.watch-target-tot_pages.patch xenpaging.watch_event-DPRINTF.patch xenpaging.xc_interface_open-comment.patch - bnc#733348 - Use 'xm' in various scripts if xend is running. Modified xmclone.sh and xen-updown.sh - Only emit xl warning when xend is running and -f (force) flag is not specified. Modified disable-xl-when-using-xend.patch - Upstream patches from Jan 24190-hap-log-dirty-disable-rc.patch 24193-hap-track-dirty-vram-rc.patch 24201-x86-pcpu-platform-op.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=161
2011-12-02 21:25:29 +01:00
"push %%eax; push %%ebx; push %%ecx; push %%edx; push %%edi; "
"push %%ebp; call 1f; "
"1: mov 8(%%esp),%%edi; mov 16(%%esp),%%ecx; mov %%esp,%%esi; "
- "sub %%esi,%%ecx; rep movsb; mov %%esp,%%esi; pop %%eax; "
+ "sub %%esi,%%ecx; cmp %3,%%ecx; jbe 2f; "
+ "xor %%esi,%%esi; jmp 3f; "
+ "2: rep movsb; mov %%esp,%%esi; 3: pop %%eax; "
"pop %%ebp; pop %%edi; pop %%edx; pop %%ecx; pop %%ebx; pop %%eax"
#endif
: "=S" (wqv->esp)
- : "c" (cpu_info), "D" (wqv->stack)
+ : "c" (cpu_info), "D" (wqv->stack), "i" (PAGE_SIZE)
: "memory" );
- BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE);
+
+ if ( unlikely(wqv->esp == 0) )
+ {
+ gdprintk(XENLOG_ERR, "Stack too large in %s\n", __FUNCTION__);
+ domain_crash_synchronous();
+ }
}
static void __finish_wait(struct waitqueue_vcpu *wqv)
@@ -162,6 +172,7 @@ void prepare_to_wait(struct waitqueue_he
- fate#310510 - fix xenpaging 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch 24270-Free_d-mem_event_on_domain_destruction..patch - fate#310510 - fix xenpaging 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch - fate#310510 - fix xenpaging 23949-constify_vcpu_set_affinitys_second_parameter.patch - fate#310510 - fix xenpaging 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch 24106-mem_event_check_capabilities_only_once.patch - fate#310510 - fix xenpaging 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch - bnc#727081 - xend domains don't work anymore since update from 12.1 beta to 12.1 RC 1 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch 24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch - bnc#733449 - Panic in mcfg_ioremap when booting xen-dbg.gz on Xeon E3-1230 24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch - fate#310510 - fix xenpaging backport waitqueue changes from xen-unstable 24104-waitqueue_Double_size_of_x86_shadow_stack..patch 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch 24231-waitqueue_Implement_wake_up_nroneall..patch 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch - fate#310510 - fix xenpaging 24227-xenpaging_restrict_pagefile_permissions.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24218-libxc_add_bitmap_clear_function.patch remove old versions: xenpaging.bitmap_clear.patch - fate#310510 - fix xenpaging merge upstream version of our existing patches: 24138-xenpaging_munmap_all_pages_after_page-in.patch 24208-xenpaging_remove_filename_from_comment.patch 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch 24210-xenpaging_use_PERROR_to_print_errno.patch 24211-xenpaging_simplify_file_op.patch 24212-xenpaging_print_gfn_in_failure_case.patch 24213-xenpaging_update_xenpaging_init.patch 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch 24215-xenpaging_track_the_number_of_paged-out_pages.patch 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch 24217-xenpaging_improve_mainloop_exit_handling.patch 24219-xenpaging_retry_unpageable_gfns.patch 24220-xenpaging_install_into_LIBEXEC_dir.patch 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch 24222-xenpaging_use_guests_tot_pages_as_working_target.patch 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch 24224-xenpaging_add_cmdline_interface_for_pager.patch 24225-xenpaging_improve_policy_mru_list_handling.patch 24226-xenpaging_add_debug_to_show_received_watch_event..patch remove old versions: xenpaging.XEN_PAGING_DIR.patch xenpaging.add_evict_pages.patch xenpaging.cmdline-interface.patch xenpaging.encapsulate_domain_info.patch xenpaging.file_op-return-code.patch xenpaging.install-to-libexec.patch xenpaging.low_target_policy_nomru.patch xenpaging.main-loop-exit-handling.patch xenpaging.misleading-comment.patch xenpaging.page_in-munmap-size.patch xenpaging.print-gfn.patch xenpaging.record-numer-paged-out-pages.patch xenpaging.reset-uncomsumed.patch xenpaging.stale-comments.patch xenpaging.target-tot_pages.patch xenpaging.use-PERROR.patch xenpaging.watch-target-tot_pages.patch xenpaging.watch_event-DPRINTF.patch xenpaging.xc_interface_open-comment.patch - bnc#733348 - Use 'xm' in various scripts if xend is running. Modified xmclone.sh and xen-updown.sh - Only emit xl warning when xend is running and -f (force) flag is not specified. Modified disable-xl-when-using-xend.patch - Upstream patches from Jan 24190-hap-log-dirty-disable-rc.patch 24193-hap-track-dirty-vram-rc.patch 24201-x86-pcpu-platform-op.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=161
2011-12-02 21:25:29 +01:00
struct vcpu *curr = current;
struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
+ ASSERT(!in_atomic());
ASSERT(list_empty(&wqv->list));
spin_lock(&wq->lock);