From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com
Subject: [kvm-unit-tests PATCH v3 1/6] x86: clean up exit use, use abort
Date: Mon, 29 Feb 2016 19:53:18 +0100 [thread overview]
Message-ID: <1456772003-27911-2-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1456772003-27911-1-git-send-email-drjones@redhat.com>
Change all exit()'s for the purpose of aborts to abort()'s. This changes
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 <drjones@redhat.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
---
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 *regs)
}
}
printf("unhandled exception %d\n", regs->vector);
- exit(7);
+ abort();
}
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 == 14)
printf("PF at %p addr %p\n", regs->rip, read_cr2());
- exit(7);
+ abort();
}
#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 != HVMSG_NONE) {
report("invalid Hyper-V SynIC msg type", false);
report_summary();
- exit(-1);
- return;
+ abort();
}
if (msg->header.message_type == 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();
}
/* Now process timer expiration message */
@@ -119,8 +117,7 @@ static void process_stimer_msg(struct svcpu *svcpu,
if (payload->timer_index >= ARRAY_SIZE(svcpu->timer)) {
report("invalid Hyper-V SynIC timer index", false);
report_summary();
- exit(-1);
- return;
+ abort();
}
timer = &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 = 0x20;
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();
}
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;
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();
}
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();
}
}
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;
}
--
2.4.3
next prev parent reply other threads:[~2016-02-29 18:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 18:53 [kvm-unit-tests PATCH v3 0/6] reduce exit status ambiguity and more Andrew Jones
2016-02-29 18:53 ` Andrew Jones [this message]
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 2/6] run scripts need consistent exit status Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 3/6] arch-run: reduce return code ambiguity Andrew Jones
2016-03-01 21:29 ` Paolo Bonzini
2016-03-02 12:57 ` Radim Krčmář
2016-03-02 14:44 ` Paolo Bonzini
2016-03-02 15:42 ` Radim Krčmář
2016-03-02 16:05 ` Paolo Bonzini
2016-03-02 17:13 ` Radim Krčmář
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 4/6] cleanup unittests.cfg headers Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 5/6] runtime: enable some unittest config overriding Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 6/6] run scripts: add timeout support Andrew Jones
2016-03-01 21:30 ` [kvm-unit-tests PATCH v3 0/6] reduce exit status ambiguity and more Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456772003-27911-2-git-send-email-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.