mirror of https://github.com/xemu-project/xemu.git
* Fuzzer fixes from Alexander
* Clean-up patches for qtests, configure and mcf5206 * Sparc64 sun4u acceptance test -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAl8C0/YRHHRodXRoQHJl ZGhhdC5jb20ACgkQLtnXdP5wLbW1gRAAo+kNlJIY9VLZ/NWwnRRMP0XN9iJtBioT d5quR2e5TB5L7XYMY+VUdabLyHS9svBm0LxZZtId6ZHLt1pzdhtAkbTFMYMjisBH Q2bp88if0vFwlJJlZhKZDR0Og1aKOLtDmmB67gtEXpbYvTlz+oXNfulH4YEel7px U5ERpM8ZiO5Ozq3xCi2MjYd4LHzA5PHxyfmIxjnnyjjRGjdOw4NL2scIXbH7wKBM irG8+K0UN4i1I2N0iz+qCLn0tvxhf2xEZDMmGtx/Fh4e+AT+TT8TAcU+zvFa4boh sDTfaV0k871lFQdFW/4vX2ycnh4HM1xu+c2FYO0EQvHInCIiw8GXbfjR3rVYChzr byPOfTWB0a2hgBWRuKKwFWLgD6RQebjkyvpZgccbuBJBnWc5CcZSHd6GisQV7n5s iGbjJwftsKhfFoQIGr1hDgoe2xOG5RyU6ygQRCtaJlzAhdIXBQ+NgPrU+tgOZltR SYEkBACArLyA/FqxzGRfyuaPB+whGcsDlxMBPe14P4ZC9Cg/gkyV4HjmkRG3jBgi YEHBMCNNEXJfmPmwd4k9dYuZNDDwIuFr6aQyhujSlQeoHzNSMnoPe4Yg1QKxfF9P uXI0XLdpH1Og+H9Ckp8W8elSHlzi9M3Anu7jANVPedDx50CEYVkrbcw/GEPlSHjY TTbbEfAC8k4= =4IIx -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-07-06' into staging * Fuzzer fixes from Alexander * Clean-up patches for qtests, configure and mcf5206 * Sparc64 sun4u acceptance test # gpg: Signature made Mon 06 Jul 2020 08:34:14 BST # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth-gitlab/tags/pull-request-2020-07-06: tests/acceptance: Add a test for the sun4u sparc64 machine hw/m68k/mcf5206: Replace remaining hw_error()s by qemu_log_mask() configure / util: Auto-detect the availability of openpty() tests/qtest: Unify the test for the xenfv and xenpv machines fuzz: do not use POSIX shm for coverage bitmap fuzz: fix broken qtest check at rcu_disable_atfork Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
710fb08fd2
|
@ -1319,6 +1319,7 @@ F: include/hw/pci-host/sabre.h
|
|||
F: hw/pci-bridge/simba.c
|
||||
F: include/hw/pci-bridge/simba.h
|
||||
F: pc-bios/openbios-sparc64
|
||||
F: tests/acceptance/machine_sparc64_sun4u.py
|
||||
|
||||
Sun4v
|
||||
M: Artyom Tarasenko <atar4qemu@gmail.com>
|
||||
|
|
|
@ -5141,10 +5141,14 @@ extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
|
|||
int main(void) { return openpty(0, 0, 0, 0, 0); }
|
||||
EOF
|
||||
|
||||
if ! compile_prog "" "" ; then
|
||||
have_openpty="no"
|
||||
if compile_prog "" "" ; then
|
||||
have_openpty="yes"
|
||||
else
|
||||
if compile_prog "" "-lutil" ; then
|
||||
libs_softmmu="-lutil $libs_softmmu"
|
||||
libs_tools="-lutil $libs_tools"
|
||||
have_openpty="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -7390,6 +7394,9 @@ fi
|
|||
if test "$have_broken_size_max" = "yes" ; then
|
||||
echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$have_openpty" = "yes" ; then
|
||||
echo "HAVE_OPENPTY=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
# Work around a system header bug with some kernel/XFS header
|
||||
# versions where they both try to define 'struct fsxattr':
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "qemu/error-report.h"
|
||||
#include "qemu/log.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/m68k/mcf.h"
|
||||
#include "qemu/timer.h"
|
||||
|
@ -69,10 +68,16 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)
|
|||
if (mode == 2)
|
||||
prescale *= 16;
|
||||
|
||||
if (mode == 3 || mode == 0)
|
||||
hw_error("m5206_timer: mode %d not implemented\n", mode);
|
||||
if ((s->tmr & TMR_FRR) == 0)
|
||||
hw_error("m5206_timer: free running mode not implemented\n");
|
||||
if (mode == 3 || mode == 0) {
|
||||
qemu_log_mask(LOG_UNIMP, "m5206_timer: mode %d not implemented\n",
|
||||
mode);
|
||||
goto exit;
|
||||
}
|
||||
if ((s->tmr & TMR_FRR) == 0) {
|
||||
qemu_log_mask(LOG_UNIMP,
|
||||
"m5206_timer: free running mode not implemented\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Assume 66MHz system clock. */
|
||||
ptimer_set_freq(s->timer, 66000000 / prescale);
|
||||
|
@ -391,7 +396,9 @@ static uint32_t m5206_mbar_readb(void *opaque, hwaddr offset)
|
|||
m5206_mbar_state *s = (m5206_mbar_state *)opaque;
|
||||
offset &= 0x3ff;
|
||||
if (offset >= 0x200) {
|
||||
hw_error("Bad MBAR read offset 0x%x", (int)offset);
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR read offset 0x%" HWADDR_PRIX,
|
||||
offset);
|
||||
return 0;
|
||||
}
|
||||
if (m5206_mbar_width[offset >> 2] > 1) {
|
||||
uint16_t val;
|
||||
|
@ -410,7 +417,9 @@ static uint32_t m5206_mbar_readw(void *opaque, hwaddr offset)
|
|||
int width;
|
||||
offset &= 0x3ff;
|
||||
if (offset >= 0x200) {
|
||||
hw_error("Bad MBAR read offset 0x%x", (int)offset);
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR read offset 0x%" HWADDR_PRIX,
|
||||
offset);
|
||||
return 0;
|
||||
}
|
||||
width = m5206_mbar_width[offset >> 2];
|
||||
if (width > 2) {
|
||||
|
@ -434,7 +443,9 @@ static uint32_t m5206_mbar_readl(void *opaque, hwaddr offset)
|
|||
int width;
|
||||
offset &= 0x3ff;
|
||||
if (offset >= 0x200) {
|
||||
hw_error("Bad MBAR read offset 0x%x", (int)offset);
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR read offset 0x%" HWADDR_PRIX,
|
||||
offset);
|
||||
return 0;
|
||||
}
|
||||
width = m5206_mbar_width[offset >> 2];
|
||||
if (width < 4) {
|
||||
|
@ -458,7 +469,9 @@ static void m5206_mbar_writeb(void *opaque, hwaddr offset,
|
|||
int width;
|
||||
offset &= 0x3ff;
|
||||
if (offset >= 0x200) {
|
||||
hw_error("Bad MBAR write offset 0x%x", (int)offset);
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR write offset 0x%" HWADDR_PRIX,
|
||||
offset);
|
||||
return;
|
||||
}
|
||||
width = m5206_mbar_width[offset >> 2];
|
||||
if (width > 1) {
|
||||
|
@ -482,7 +495,9 @@ static void m5206_mbar_writew(void *opaque, hwaddr offset,
|
|||
int width;
|
||||
offset &= 0x3ff;
|
||||
if (offset >= 0x200) {
|
||||
hw_error("Bad MBAR write offset 0x%x", (int)offset);
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR write offset 0x%" HWADDR_PRIX,
|
||||
offset);
|
||||
return;
|
||||
}
|
||||
width = m5206_mbar_width[offset >> 2];
|
||||
if (width > 2) {
|
||||
|
@ -510,7 +525,9 @@ static void m5206_mbar_writel(void *opaque, hwaddr offset,
|
|||
int width;
|
||||
offset &= 0x3ff;
|
||||
if (offset >= 0x200) {
|
||||
hw_error("Bad MBAR write offset 0x%x", (int)offset);
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR write offset 0x%" HWADDR_PRIX,
|
||||
offset);
|
||||
return;
|
||||
}
|
||||
width = m5206_mbar_width[offset >> 2];
|
||||
if (width < 4) {
|
||||
|
|
12
softmmu/vl.c
12
softmmu/vl.c
|
@ -3832,17 +3832,7 @@ void qemu_init(int argc, char **argv, char **envp)
|
|||
machine_class);
|
||||
|
||||
os_daemonize();
|
||||
|
||||
/*
|
||||
* If QTest is enabled, keep the rcu_atfork enabled, since system processes
|
||||
* may be forked testing purposes (e.g. fork-server based fuzzing) The fork
|
||||
* should happen before a signle cpu instruction is executed, to prevent
|
||||
* deadlocks. See commit 73c6e40, rcu: "completely disable pthread_atfork
|
||||
* callbacks as soon as possible"
|
||||
*/
|
||||
if (!qtest_enabled()) {
|
||||
rcu_disable_atfork();
|
||||
}
|
||||
rcu_disable_atfork();
|
||||
|
||||
if (pid_file && !qemu_write_pidfile(pid_file, &err)) {
|
||||
error_reportf_err(err, "cannot create PID file: ");
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
# Functional test that boots a Linux kernel and checks the console
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# Author:
|
||||
# Thomas Huth <thuth@redhat.com>
|
||||
#
|
||||
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
# later. See the COPYING file in the top-level directory.
|
||||
|
||||
import os
|
||||
|
||||
from avocado_qemu import wait_for_console_pattern
|
||||
from avocado.utils import archive
|
||||
from boot_linux_console import LinuxKernelTest
|
||||
|
||||
class Sun4uMachine(LinuxKernelTest):
|
||||
"""Boots the Linux kernel and checks that the console is operational"""
|
||||
|
||||
timeout = 90
|
||||
|
||||
def test_sparc64_sun4u(self):
|
||||
"""
|
||||
:avocado: tags=arch:sparc64
|
||||
:avocado: tags=machine:sun4u
|
||||
"""
|
||||
tar_url = ('https://www.qemu-advent-calendar.org'
|
||||
'/2018/download/day23.tar.xz')
|
||||
tar_hash = '142db83cd974ffadc4f75c8a5cad5bcc5722c240'
|
||||
file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
|
||||
archive.extract(file_path, self.workdir)
|
||||
self.vm.set_console()
|
||||
self.vm.add_args('-kernel', self.workdir + '/day23/vmlinux',
|
||||
'-append', self.KERNEL_COMMON_COMMAND_LINE)
|
||||
self.vm.launch()
|
||||
wait_for_console_pattern(self, 'Starting logging: OK')
|
|
@ -287,11 +287,6 @@ static void add_machine_test_case(const char *mname)
|
|||
{
|
||||
char *path, *args;
|
||||
|
||||
/* Ignore blacklisted machines */
|
||||
if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
path = g_strdup_printf("device/introspect/concrete/defaults/%s", mname);
|
||||
args = g_strdup_printf("-M %s", mname);
|
||||
qtest_add_data_func(path, args, test_device_intro_concrete);
|
||||
|
|
|
@ -17,39 +17,25 @@
|
|||
|
||||
void counter_shm_init(void)
|
||||
{
|
||||
char *shm_path = g_strdup_printf("/qemu-fuzz-cntrs.%d", getpid());
|
||||
int fd = shm_open(shm_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||
g_free(shm_path);
|
||||
|
||||
if (fd == -1) {
|
||||
perror("Error: ");
|
||||
exit(1);
|
||||
}
|
||||
if (ftruncate(fd, &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START) == -1) {
|
||||
perror("Error: ");
|
||||
exit(1);
|
||||
}
|
||||
/* Copy what's in the counter region to the shm.. */
|
||||
void *rptr = mmap(NULL ,
|
||||
&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
memcpy(rptr,
|
||||
/* Copy what's in the counter region to a temporary buffer.. */
|
||||
void *copy = malloc(&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
|
||||
memcpy(copy,
|
||||
&__FUZZ_COUNTERS_START,
|
||||
&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
|
||||
|
||||
munmap(rptr, &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
|
||||
|
||||
/* And map the shm over the counter region */
|
||||
rptr = mmap(&__FUZZ_COUNTERS_START,
|
||||
&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0);
|
||||
|
||||
close(fd);
|
||||
|
||||
if (!rptr) {
|
||||
/* Map a shared region over the counter region */
|
||||
if (mmap(&__FUZZ_COUNTERS_START,
|
||||
&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
|
||||
0, 0) == MAP_FAILED) {
|
||||
perror("Error: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Copy the original data back to the counter-region */
|
||||
memcpy(&__FUZZ_COUNTERS_START, copy,
|
||||
&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
|
||||
free(copy);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -211,5 +211,8 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
|
|||
|
||||
qemu_init(result.we_wordc, result.we_wordv, NULL);
|
||||
|
||||
/* re-enable the rcu atfork, which was previously disabled in qemu_init */
|
||||
rcu_enable_atfork();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1232,6 +1232,10 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine),
|
|||
qstr = qobject_to(QString, qobj);
|
||||
g_assert(qstr);
|
||||
mname = qstring_get_str(qstr);
|
||||
/* Ignore machines that cannot be used for qtests */
|
||||
if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
|
||||
continue;
|
||||
}
|
||||
if (!skip_old_versioned || !qtest_is_old_versioned_machine(mname)) {
|
||||
cb(mname);
|
||||
}
|
||||
|
|
|
@ -81,11 +81,6 @@ static void add_machine_test_case(const char *mname)
|
|||
{
|
||||
char *path;
|
||||
|
||||
/* Ignore blacklisted machines that have known problems */
|
||||
if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
path = g_strdup_printf("qom/%s", mname);
|
||||
qtest_add_data_func(path, g_strdup(mname), test_machine);
|
||||
g_free(path);
|
||||
|
|
|
@ -143,11 +143,6 @@ static void add_machine_test_case(const char *mname)
|
|||
{
|
||||
char *path;
|
||||
|
||||
/* Ignore blacklisted machines that have known problems */
|
||||
if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
path = g_strdup_printf("hmp/%s", mname);
|
||||
qtest_add_data_func(path, g_strdup(mname), test_machine);
|
||||
g_free(path);
|
||||
|
|
|
@ -52,7 +52,9 @@
|
|||
#endif
|
||||
|
||||
#ifdef __sun__
|
||||
/* Once Solaris has openpty(), this is going to be removed. */
|
||||
|
||||
#if !defined(HAVE_OPENPTY)
|
||||
/* Once illumos has openpty(), this is going to be removed. */
|
||||
static int openpty(int *amaster, int *aslave, char *name,
|
||||
struct termios *termp, struct winsize *winp)
|
||||
{
|
||||
|
@ -93,6 +95,7 @@ err:
|
|||
close(mfd);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void cfmakeraw (struct termios *termios_p)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue