From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Vrable Subject: [PATCH] Do not call BUG() in translated mode in xen_create_contiguous_region Date: Wed, 22 Feb 2006 13:45:06 -0800 Message-ID: <20060222214506.GA20180@vrable.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org I've encountered a kernel crash when running a domain in shadow translated mode with networking support: kernel BUG at arch/i386/mm/hypervisor.c:328! invalid opcode: 0000 [#1] SMP Modules linked in: CPU: 0 EIP: 0061:[] Not tainted VLI EFLAGS: 00010002 (2.6.16-rc4-xenU #1) EIP is at xen_create_contiguous_region+0x2ea/0x3f0 [...] [] show_stack_log_lvl+0xcd/0x120 [] show_registers+0x1ab/0x240 [] die+0x111/0x240 [] do_trap+0x98/0xe0 [] do_invalid_op+0xa1/0xb0 [] error_code+0x2b/0x30 [] skbuff_ctor+0x6c/0x80 [] cache_alloc_refill+0x524/0x570 [] kmem_cache_alloc+0x7c/0x90 [] alloc_skb_from_cache+0x58/0x110 [] __alloc_skb+0x48/0xa0 [] tcp_collapse+0x132/0x360 [] tcp_prune_queue+0x125/0x330 [] tcp_data_queue+0x5b5/0xca0 [] tcp_rcv_established+0x276/0x7e0 [] tcp_v4_do_rcv+0xda/0x320 [] tcp_v4_rcv+0x830/0x900 [] ip_local_deliver+0xae/0x1a0 [] ip_rcv+0x2e7/0x4a0 [] netif_receive_skb+0x197/0x220 [] netif_poll+0x3d3/0x7f0 [] net_rx_action+0xbe/0x1c0 [] __do_softirq+0x8c/0x120 [] do_softirq+0x85/0x90 [] irq_exit+0x39/0x50 [] do_IRQ+0x25/0x30 [] evtchn_do_upcall+0x9f/0xe0 [] hypervisor_callback+0x2c/0x34 [] cpu_idle+0x77/0xf0 [] rest_init+0x35/0x40 [] start_kernel+0x2ea/0x380 [] 0xc010005e The following patch against xen-unstable.hg should fix the problem. --Michael Vrable # HG changeset patch # User Michael Vrable # Node ID 5747b738b00a6322cd3b61220eb508c24183fa0a # Parent 697fac283c9e565b4c9697c70a5529d06a488df9 Return -ENOMEM in xen_create_contiguous_region when running translated. Previously, calling xen_create_contiguous_region with order > 0 while running in translated shadow mode (XENFEAT_auto_translated_physmap set) resulted in BUG() being called. This can cause a crash in Xen's skbuff_ctor. xen_create_contiguous_region does have a mechanism to signal failure to create a contiguous region: it returns -ENOMEM. Simply do this unconditionally for multi-page requests when in translated mode. Signed-off-by: Michael Vrable diff -r 697fac283c9e -r 5747b738b00a linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Wed Feb 22 19:11:23 2006 +0000 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Wed Feb 22 13:30:48 2006 -0800 @@ -325,7 +325,9 @@ int xen_create_contiguous_region( }; if (xen_feature(XENFEAT_auto_translated_physmap)) { - BUG_ON(order >= 1); + if (order >= 1) + return -ENOMEM; + return 0; }