From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754089AbbCBKcx (ORCPT ); Mon, 2 Mar 2015 05:32:53 -0500 Received: from ozlabs.org ([103.22.144.67]:40179 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751550AbbCBKcq (ORCPT ); Mon, 2 Mar 2015 05:32:46 -0500 From: Rusty Russell To: Denys Vlasenko , Linux Kernel Mailing List Subject: Re: lguest: bug in lg_irq_enable? In-Reply-To: References: User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Mon, 02 Mar 2015 10:44:55 +1030 Message-ID: <874mq4l0g0.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Denys Vlasenko writes: > ENTRY(lg_irq_enable) > /* > * The reverse of irq_disable, this sets lguest_data.irq_enabled to > * X86_EFLAGS_IF (ie. "Interrupts enabled"). > */ > movl $X86_EFLAGS_IF, lguest_data+LGUEST_DATA_irq_enabled > /* > * But now we need to check if the Host wants to know: there might have > * been interrupts waiting to be delivered, in which case it will have > * set lguest_data.irq_pending to X86_EFLAGS_IF. If it's not zero, we > * jump to send_interrupts, otherwise we're done. > */ > testl $0, lguest_data+LGUEST_DATA_irq_pending > ^^^^^^^^^^^^^^^^^?????????? Heh, that should be cmpl! Nice catch! Cheers, Rusty. Subject: lguest: fix pending interrupt test. Denys says: TEST with zero will always set ZF. Thus, "jnz send_interrupts" never jumps. We get interrupts regularly enough that this didn't cause immediate problems. Reported-by: Denys Vlasenko Signed-off-by: Rusty Russell diff --git a/arch/x86/lguest/head_32.S b/arch/x86/lguest/head_32.S index 6ddfe4fc23c3..05b0a85507ce 100644 --- a/arch/x86/lguest/head_32.S +++ b/arch/x86/lguest/head_32.S @@ -84,7 +84,7 @@ ENTRY(lg_irq_enable) * set lguest_data.irq_pending to X86_EFLAGS_IF. If it's not zero, we * jump to send_interrupts, otherwise we're done. */ - testl $0, lguest_data+LGUEST_DATA_irq_pending + cmpl $0, lguest_data+LGUEST_DATA_irq_pending jnz send_interrupts /* * One cool thing about x86 is that you can do many things without using