From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [kvm-unit-tests PATCH v3 1/6] x86: clean up exit use, use abort Date: Mon, 29 Feb 2016 19:53:18 +0100 Message-ID: <1456772003-27911-2-git-send-email-drjones@redhat.com> References: <1456772003-27911-1-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: pbonzini@redhat.com, rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59456 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbcB2Sxf (ORCPT ); Mon, 29 Feb 2016 13:53:35 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 8999FC0B78A2 for ; Mon, 29 Feb 2016 18:53:34 +0000 (UTC) In-Reply-To: <1456772003-27911-1-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Change all exit()'s for the purpose of aborts to abort()'s. This change= s a handful of exit(-1)'s, which resulted in a 255 exit status (putting the status in signal territory) to a 127 exit status (just below signal territory), as 127 is defined as the unittest abort. Yes, stdlib would use SIGABRT resulting in 134, but, well, we do what we can... Signed-off-by: Andrew Jones Reviewed-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- lib/x86/desc.c | 4 ++-- x86/hyperv_stimer.c | 9 +++------ x86/pku.c | 4 ++-- x86/smap.c | 4 ++-- x86/tscdeadline_latency.c | 4 ++-- x86/vmx.c | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/x86/desc.c b/lib/x86/desc.c index 1a80c01283853..dd07d2c91d769 100644 --- a/lib/x86/desc.c +++ b/lib/x86/desc.c @@ -54,7 +54,7 @@ static void check_exception_table(struct ex_regs *reg= s) } } printf("unhandled exception %d\n", regs->vector); - exit(7); + abort(); } =20 static void (*exception_handlers[32])(struct ex_regs *regs); @@ -78,7 +78,7 @@ void do_handle_exception(struct ex_regs *regs) printf("unhandled cpu exception %d\n", regs->vector); if (regs->vector =3D=3D 14) printf("PF at %p addr %p\n", regs->rip, read_cr2()); - exit(7); + abort(); } =20 #define EX(NAME, N) extern char NAME##_fault; \ diff --git a/x86/hyperv_stimer.c b/x86/hyperv_stimer.c index 767459e55cc0b..bf2e4294ddade 100644 --- a/x86/hyperv_stimer.c +++ b/x86/hyperv_stimer.c @@ -99,8 +99,7 @@ static void process_stimer_msg(struct svcpu *svcpu, msg->header.message_type !=3D HVMSG_NONE) { report("invalid Hyper-V SynIC msg type", false); report_summary(); - exit(-1); - return; + abort(); } =20 if (msg->header.message_type =3D=3D HVMSG_NONE) { @@ -110,8 +109,7 @@ static void process_stimer_msg(struct svcpu *svcpu, if (msg->header.payload_size < sizeof(*payload)) { report("invalid Hyper-V SynIC msg payload size", false); report_summary(); - exit(-1); - return; + abort(); } =20 /* Now process timer expiration message */ @@ -119,8 +117,7 @@ static void process_stimer_msg(struct svcpu *svcpu, if (payload->timer_index >=3D ARRAY_SIZE(svcpu->timer)) { report("invalid Hyper-V SynIC timer index", false); report_summary(); - exit(-1); - return; + abort(); } timer =3D &svcpu->timer[payload->timer_index]; process_stimer_expired(svcpu, timer, payload->expiration_time, diff --git a/x86/pku.c b/x86/pku.c index 0e00b9984d70d..bcc0d5970f8d3 100644 --- a/x86/pku.c +++ b/x86/pku.c @@ -90,8 +90,8 @@ int main(int ac, char **av) unsigned int pkru_wd =3D 0x20; =20 if (!(cpuid_indexed(7, 0).c & (1 << X86_FEATURE_PKU))) { - printf("PKU not enabled, exiting\n"); - exit(1); + printf("PKU not enabled, aborting\n"); + abort(); } =20 setup_vm(); diff --git a/x86/smap.c b/x86/smap.c index d8a7ae82dc00b..69e71864dc9bf 100644 --- a/x86/smap.c +++ b/x86/smap.c @@ -92,8 +92,8 @@ int main(int ac, char **av) unsigned long i; =20 if (!(cpuid_indexed(7, 0).b & (1 << X86_FEATURE_SMAP))) { - printf("SMAP not enabled, exiting\n"); - exit(1); + printf("SMAP not enabled, aborting\n"); + abort(); } =20 setup_vm(); diff --git a/x86/tscdeadline_latency.c b/x86/tscdeadline_latency.c index 42f19cb92e518..c5f0b06f863d3 100644 --- a/x86/tscdeadline_latency.c +++ b/x86/tscdeadline_latency.c @@ -98,8 +98,8 @@ static void test_tsc_deadline_timer(void) if(enable_tsc_deadline_timer()) { printf("tsc deadline timer enabled\n"); } else { - printf("tsc deadline timer not detected\n"); - exit(1); + printf("tsc deadline timer not detected, aborting\n"); + abort(); } } =20 diff --git a/x86/vmx.c b/x86/vmx.c index 3fa1a735881f7..a9cebcb6bdc0c 100644 --- a/x86/vmx.c +++ b/x86/vmx.c @@ -869,7 +869,7 @@ static int exit_handler() , ret); } print_vmexit_info(); - exit(-1); + abort(); return 0; } =20 --=20 2.4.3