From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] kvm-unit-tests: Fix GCC's 4.8 labels as values for nVMX tests. Date: Tue, 25 Feb 2014 15:26:50 +0100 Message-ID: <530CA82A.5090600@redhat.com> References: <1393255552-7147-1-git-send-email-mv@sec.uni-passau.de> <530B6C35.2090605@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit To: Jan Kiszka , Marius Vlad , kvm@vger.kernel.org Return-path: Received: from mail-qc0-f180.google.com ([209.85.216.180]:35491 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753092AbaBYO0z (ORCPT ); Tue, 25 Feb 2014 09:26:55 -0500 Received: by mail-qc0-f180.google.com with SMTP id i17so11111668qcy.11 for ; Tue, 25 Feb 2014 06:26:54 -0800 (PST) In-Reply-To: <530B6C35.2090605@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 24/02/2014 16:58, Jan Kiszka ha scritto: > On 2014-02-24 16:25, Marius Vlad wrote: >> Commit 3b1274463fa8d074dd3bc77efe25b59a4ddd491e uses GCCs extension >> labels as values to handle exceptions, but GCC 4.8 ``mistakingly'' >> uses the next body function as a jump label, for functions which >> do not return. Fixed by returning a int value for those functions. >> >> See http://thread.gmane.org/gmane.comp.emulators.kvm.devel/119186 >> >> Signed-off-by: Marius Vlad >> --- >> x86/vmx.c | 10 +++++----- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/x86/vmx.c b/x86/vmx.c >> index fe950e6..0c895af 100644 >> --- a/x86/vmx.c >> +++ b/x86/vmx.c >> @@ -548,7 +548,7 @@ static void exception_handler(struct ex_regs *regs) >> regs->rip = (u64)exception_return; >> } >> >> -static int test_for_exception(unsigned int ex, void (*func)(void)) >> +static int test_for_exception(unsigned int ex, int (*func)(void)) >> { >> handle_exception(ex, exception_handler); >> exception = false; >> @@ -557,23 +557,23 @@ static int test_for_exception(unsigned int ex, void (*func)(void)) >> return exception; >> } >> >> -static void do_vmxon_off(void) >> +static int do_vmxon_off(void) >> { >> exception_return = &&resume; >> barrier(); >> vmx_on(); >> vmx_off(); >> resume: >> - return; >> + return 0; >> } >> >> -static void do_write_feature_control(void) >> +static int do_write_feature_control(void) >> { >> exception_return = &&resume; >> barrier(); >> wrmsr(MSR_IA32_FEATURE_CONTROL, 0); >> resume: >> - return; >> + return 0; >> } >> >> static int test_vmx_feature_control(void) >> > > Argh, getting old. I remembered that issue but forgot that I already had > a fix for this queued: > > http://thread.gmane.org/gmane.comp.emulators.kvm.devel/117866 > > I don't mind which version to pick, but maybe Paolo has mine already in > his queue. Yeah (I hadn't, but now I have). According to GCC developers this is invalid code. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28581 Perhaps we should rewrite this using something more similar to "normal" C setjmp/longjmp. Paolo