From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] kvm: bios: end AP boot code execution in rombios Date: Mon, 18 Aug 2008 13:21:20 +0300 Message-ID: <48A94D20.2080406@qumranet.com> References: <200807311043.20880.sheng.yang@intel.com> <1219012543$2777@local> <48A8DF67.90600@codemonkey.ws> <200808181045.30451.sheng.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , Sebastian Herbszt , kvm@vger.kernel.org To: "Yang, Sheng" Return-path: Received: from il.qumranet.com ([212.179.150.194]:50772 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751453AbYHRKVV (ORCPT ); Mon, 18 Aug 2008 06:21:21 -0400 In-Reply-To: <200808181045.30451.sheng.yang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Yang, Sheng wrote: > On Monday 18 August 2008 10:33:11 Anthony Liguori wrote: > >> Sebastian Herbszt wrote: >> >>> Jump to rombios before executing the halt loop. >>> >> Why? More importantly, why is this specific to KVM? >> > > The bios copy AP boot up code to 0x10000 now in KVM, so it can be > overwrite by userspace program like grub. I found it caused > stop/cont/info cpus in grub corrupt AP. Please refer to " > KVM: Fix exiting from HLT emulation with MP_STATE_HALTED" > (well, I found the patch duplicated with Marcelo's patch later, then > drop it...) > > Yeah, I am agree this should not be a specific issue to KVM. > It is actually kvm specific. The SIPI code runs with interrupts disabled, so the 'hlt' instruction cannot be resumed due to an interrupt (and as the apic hasn't been configured yet, no nmis either). But due to a bug in kvm, an exit to userspace (like the one caused by 'info cpus' or stop+cont) can cause kvm to resume executing after the hlt instruction, which is now arbitrary application code. Marcelo has a patch that addresses this, unfortunately with a regression, so hopefully the kvm bug will be closed soon. That's not to say running out of ROM space is a bad idea, so I'll apply this. (would be even better not to copy the code at all) -- error compiling committee.c: too many arguments to function