From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HKjRC-0003WB-LB for qemu-devel@nongnu.org; Fri, 23 Feb 2007 18:02:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HKjRB-0003Vv-4Y for qemu-devel@nongnu.org; Fri, 23 Feb 2007 18:02:50 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HKjRB-0003Vs-0O for qemu-devel@nongnu.org; Fri, 23 Feb 2007 18:02:49 -0500 Received: from bache.ece.cmu.edu ([128.2.129.23]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HKjRA-0002kN-Gl for qemu-devel@nongnu.org; Fri, 23 Feb 2007 18:02:48 -0500 Received: from [128.2.134.191] (KIPPER.ECE.CMU.EDU [128.2.134.191]) by bache.ece.cmu.edu (Postfix) with ESMTP id 26F7559 for ; Fri, 23 Feb 2007 18:02:47 -0500 (EST) Message-ID: <45DF7296.7060502@ece.cmu.edu> Date: Fri, 23 Feb 2007 18:02:46 -0500 From: Heng Yin MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] On-demand taint tracking Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi Qemu developers, I have implemented a whole-system taint tracking system on Qemu. But the performance overhead is big. Now I want to optimize it by performing on-demand taint tracking. The idea is that Qemu runs in virtualization mode most of time (running with kqemu), and switches to emulation mode to propagate taint information when necessary. When taint information is not propagating for a while, I put Qemu into virtualization mode again. Before I put it into virtualization mode, I disable the tainted pages by removing their PG_PRESENT flags. So once kqemu accesses one of these pages, the page fault handler gets called, and qemu gets control. I have written something for this, but it does not work. The guest OS crashes immediately when I put Qemu into virtualization mode. Kqemu does not raise page fault before the target OS crashes. I list part of my code below. Can someone give any hints of what I did wrong here? /*this function disable all the tainted pages, and put it into virtualization mode */ int switch_e2v() { int i; uint32_t pte; //enable the pages for(i=0; ipte_addr) continue; //if this page is tainted, I get its pte, and clear //its PG_PRESENT flag pte = ldl_phys(page->pte_addr); pte &= ~PG_PRESENT_MASK; // I set the avail bits to all 1s, so that I know this //page is different from those actually not present pte |= 0xe00; stl_phys_notdirty(page->pte_addr, pte); } emulation_mode = 0; //indicate we are entering virtualization mode return 0; } Any comments are highly appreciated! Thanks a lot, Heng