* Some fuzzer related fixes

* Fixes / improvements for the "configure" script
 * Doc updates
 * Gitlab pipeline-status script
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAl8MPAARHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbVLTQ/9H0G+Vo46hqOYpb2+psbfSi29WXAQiyNM
 ZtcloeDW/fwhKUlxtEMTuuAuDNOleGj+UxAsGaodFIEgx5XnJT2MxeqOpE3uE9G0
 9r/potzlcztYgqRHRu+H0keZNYiMY70lZUJy8NSYl+KOnndeRBmSy/GwPb/HOzH5
 2t+hlsCFkbnvm1IOcaGCVKcRNvIlUmqRt5LmqkRVrOxe6u8kfm3lgkZ/CUHzfoDq
 N5S/DuVmy0IWiP25/WnVQiV4XYLUN4jf161XfacwypPmZrK/QT9ScZhaICNuEqIY
 krDH1ZDV2M6a69e1PecJUsPYEVlsfbnmEMb3aM/xEZtrHEm2b14MpQo0CePkWEQc
 BBHd0UkkjbC9K9Gqe8tXG2YC22ZgEi6psqRprdIixNNZptJ5oWYfZ0bAeuT2Bs+7
 VOhtUmRk7ufEu9FwOleSPpHlhkTAwuMh+sYma52wx9an6rB84i6oJPGlAeSje6db
 e2+D5J6z72ZxIxc7wUBbdoL70wM0tpbppYR0QO5TblJA+WJtBupQ6mw71TzeMoOg
 2ZJlwOsnbUy0EbwgKm7huHANAhCFhnbYv70KVseX3agPJ0vSZYDo2PT8vJXTL7Sk
 BNoFn3rI70b7HW40YL8jsMvO6zXrIuofwNkpEIRoNS+gItc2a3SQa/lBosQBQAy3
 5p+qPn/kQ1U=
 =f+Fr
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-07-13' into staging

* Some fuzzer related fixes
* Fixes / improvements for the "configure" script
* Doc updates
* Gitlab pipeline-status script

# gpg: Signature made Mon 13 Jul 2020 11:48:32 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-13:
  docs/system/s390x: Improve the 3270 documentation
  GitLab Gating CI: introduce pipeline-status contrib script
  disas/sh4: Add missing fallthrough annotations
  Remove the CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE switch
  docs/devel/fuzzing: Fix bugs in documentation
  tests/qtest/fuzz: Add missing spaces in description
  fuzz: add missing header for rcu_enable_atfork
  configure: do not clobber CFLAGS with --enable-fuzzing
  configure: fix malloc check

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-07-13 13:01:30 +01:00
commit 00ce6c36b3
12 changed files with 210 additions and 63 deletions

32
configure vendored
View File

@ -5728,31 +5728,6 @@ if compile_prog "" "" ; then
linux_magic_h=yes linux_magic_h=yes
fi fi
########################################
# check whether we can disable warning option with a pragma (this is needed
# to silence warnings in the headers of some versions of external libraries).
# This test has to be compiled with -Werror as otherwise an unknown pragma is
# only a warning.
#
# If we can't selectively disable warning in the code, disable -Werror so that
# the build doesn't fail anyway.
pragma_disable_unused_but_set=no
cat > $TMPC << EOF
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic pop
int main(void) {
return 0;
}
EOF
if compile_prog "-Werror" "" ; then
pragma_diagnostic_available=yes
else
werror=no
fi
######################################## ########################################
# check if we have valgrind/valgrind.h # check if we have valgrind/valgrind.h
@ -6343,6 +6318,7 @@ int main(void) {
if (tmp != NULL) { if (tmp != NULL) {
return *(int *)(tmp + 2); return *(int *)(tmp + 2);
} }
return 1;
} }
EOF EOF
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
@ -7688,10 +7664,6 @@ if test "$linux_magic_h" = "yes" ; then
echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
fi fi
if test "$pragma_diagnostic_available" = "yes" ; then
echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
fi
if test "$valgrind_h" = "yes" ; then if test "$valgrind_h" = "yes" ; then
echo "CONFIG_VALGRIND_H=y" >> $config_host_mak echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
fi fi
@ -7925,7 +7897,7 @@ if test "$fuzzing" = "yes" ; then
if test "$have_fuzzer" = "yes"; then if test "$have_fuzzer" = "yes"; then
FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"
FUZZ_CFLAGS=" -fsanitize=address,fuzzer" FUZZ_CFLAGS=" -fsanitize=address,fuzzer"
CFLAGS=" -fsanitize=address,fuzzer-no-link" CFLAGS="$CFLAGS -fsanitize=address,fuzzer-no-link"
else else
error_exit "Your compiler doesn't support -fsanitize=address,fuzzer" error_exit "Your compiler doesn't support -fsanitize=address,fuzzer"
exit 1 exit 1

View File

@ -1963,6 +1963,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
fprintf_fn (stream, "xd%d", rn & ~1); fprintf_fn (stream, "xd%d", rn & ~1);
break; break;
} }
/* fallthrough */
case D_REG_N: case D_REG_N:
fprintf_fn (stream, "dr%d", rn); fprintf_fn (stream, "dr%d", rn);
break; break;
@ -1972,6 +1973,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
fprintf_fn (stream, "xd%d", rm & ~1); fprintf_fn (stream, "xd%d", rm & ~1);
break; break;
} }
/* fallthrough */
case D_REG_M: case D_REG_M:
fprintf_fn (stream, "dr%d", rm); fprintf_fn (stream, "dr%d", rm);
break; break;

View File

@ -33,11 +33,11 @@ Fuzz targets are built similarly to system/softmmu:
This builds ./i386-softmmu/qemu-fuzz-i386 This builds ./i386-softmmu/qemu-fuzz-i386
The first option to this command is: --fuzz_taget=FUZZ_NAME The first option to this command is: --fuzz-target=FUZZ_NAME
To list all of the available fuzzers run qemu-fuzz-i386 with no arguments. To list all of the available fuzzers run qemu-fuzz-i386 with no arguments.
eg: For example:
./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-net-fork-fuzz ./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz
Internally, libfuzzer parses all arguments that do not begin with "--". Internally, libfuzzer parses all arguments that do not begin with "--".
Information about these is available by passing -help=1 Information about these is available by passing -help=1

View File

@ -1,9 +1,15 @@
3270 devices 3270 devices
============ ============
QEMU supports connecting an external 3270 terminal emulator (such as The 3270 is the classic 'green-screen' console of the mainframes (see the
``x3270``) to make a single 3270 device available to a guest. Note that this `IBM 3270 Wikipedia article <https://en.wikipedia.org/wiki/IBM_3270>`__).
supports basic features only.
The 3270 data stream is not implemented within QEMU; the device only provides
TN3270 (a telnet extension; see `RFC 854 <https://tools.ietf.org/html/rfc854>`__
and `RFC 1576 <https://tools.ietf.org/html/rfc1576>`__) and leaves the heavy
lifting to an external 3270 terminal emulator (such as ``x3270``) to make a
single 3270 device available to a guest. Note that this supports basic
features only.
To provide a 3270 device to a guest, create a ``x-terminal3270`` linked to To provide a 3270 device to a guest, create a ``x-terminal3270`` linked to
a ``tn3270`` chardev. The guest will see a 3270 channel device. In order a ``tn3270`` chardev. The guest will see a 3270 channel device. In order
@ -12,10 +18,14 @@ to actually be able to use it, attach the ``x3270`` emulator to the chardev.
Example configuration Example configuration
--------------------- ---------------------
* Make sure that 3270 support is enabled in the guest's Linux kernel. You need
``CONFIG_TN3270`` and at least one of ``CONFIG_TN3270_TTY`` (for additional
ttys) or ``CONFIG_TN3270_CONSOLE`` (for a 3270 console).
* Add a ``tn3270`` chardev and a ``x-terminal3270`` to the QEMU command line:: * Add a ``tn3270`` chardev and a ``x-terminal3270`` to the QEMU command line::
-chardev socket,id=char_0,host=0.0.0.0,port=2300,nowait,server,tn3270 -chardev socket,id=ch0,host=0.0.0.0,port=2300,nowait,server,tn3270
-device x-terminal3270,chardev=char_0,devno=fe.0.000a,id=terminal_0 -device x-terminal3270,chardev=ch0,devno=fe.0.000a,id=terminal0
* Start the guest. In the guest, use ``chccwdev -e 0.0.000a`` to enable * Start the guest. In the guest, use ``chccwdev -e 0.0.000a`` to enable
the device. the device.
@ -29,4 +39,25 @@ Example configuration
systemctl start serial-getty@3270-tty1.service systemctl start serial-getty@3270-tty1.service
This should get you an addtional tty for logging into the guest. This should get you an additional tty for logging into the guest.
* If you want to use the 3270 device as the Linux kernel console instead of
an additional tty, you can also append ``conmode=3270 condev=000a`` to
the guest's kernel command line. The kernel then should use the 3270 as
console after the next boot.
Restrictions
------------
3270 support is very basic. In particular:
* Only one 3270 device is supported.
* It has only been tested with Linux guests and the x3270 emulator.
* TLS/SSL is not supported.
* Resizing on reattach is not supported.
* Multiple commands in one inbound buffer (for example, when the reset key
is pressed while the network is slow) are not supported.

View File

@ -1,15 +1,11 @@
#ifndef UI_GTK_H #ifndef UI_GTK_H
#define UI_GTK_H #define UI_GTK_H
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
/* Work around an -Wstrict-prototypes warning in GTK headers */ /* Work around an -Wstrict-prototypes warning in GTK headers */
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes" #pragma GCC diagnostic ignored "-Wstrict-prototypes"
#endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>

View File

@ -7,14 +7,10 @@
#define QEMU_PIXMAN_H #define QEMU_PIXMAN_H
/* pixman-0.16.0 headers have a redundant declaration */ /* pixman-0.16.0 headers have a redundant declaration */
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls" #pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
#include <pixman.h> #include <pixman.h>
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
/* /*
* pixman image formats are defined to be native endian, * pixman image formats are defined to be native endian,

157
scripts/ci/gitlab-pipeline-status Executable file
View File

@ -0,0 +1,157 @@
#!/usr/bin/env python3
#
# Copyright (c) 2019-2020 Red Hat, Inc.
#
# Author:
# Cleber Rosa <crosa@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.
"""
Checks the GitLab pipeline status for a given commit ID
"""
# pylint: disable=C0103
import argparse
import http.client
import json
import os
import subprocess
import time
import sys
def get_local_staging_branch_commit():
"""
Returns the commit sha1 for the *local* branch named "staging"
"""
result = subprocess.run(['git', 'rev-parse', 'staging'],
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
cwd=os.path.dirname(__file__),
universal_newlines=True).stdout.strip()
if result == 'staging':
raise ValueError("There's no local branch named 'staging'")
if len(result) != 40:
raise ValueError("Branch staging HEAD doesn't look like a sha1")
return result
def get_pipeline_status(project_id, commit_sha1):
"""
Returns the JSON content of the pipeline status API response
"""
url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
commit_sha1)
connection = http.client.HTTPSConnection('gitlab.com')
connection.request('GET', url=url)
response = connection.getresponse()
if response.code != http.HTTPStatus.OK:
raise ValueError("Failed to receive a successful response")
json_response = json.loads(response.read())
# As far as I can tell, there should be only one pipeline for the same
# project + commit. If this assumption is false, we can add further
# filters to the url, such as username, and order_by.
if not json_response:
raise ValueError("No pipeline found")
return json_response[0]
def wait_on_pipeline_success(timeout, interval,
project_id, commit_sha):
"""
Waits for the pipeline to finish within the given timeout
"""
start = time.time()
while True:
if time.time() >= (start + timeout):
print("Waiting on the pipeline timed out")
return False
status = get_pipeline_status(project_id, commit_sha)
if status['status'] == 'running':
time.sleep(interval)
print('running...')
continue
if status['status'] == 'success':
return True
msg = "Pipeline failed, check: %s" % status['web_url']
print(msg)
return False
def main():
"""
Script entry point
"""
parser = argparse.ArgumentParser(
prog='pipeline-status',
description='check or wait on a pipeline status')
parser.add_argument('-t', '--timeout', type=int, default=7200,
help=('Amount of time (in seconds) to wait for the '
'pipeline to complete. Defaults to '
'%(default)s'))
parser.add_argument('-i', '--interval', type=int, default=60,
help=('Amount of time (in seconds) to wait between '
'checks of the pipeline status. Defaults '
'to %(default)s'))
parser.add_argument('-w', '--wait', action='store_true', default=False,
help=('Wether to wait, instead of checking only once '
'the status of a pipeline'))
parser.add_argument('-p', '--project-id', type=int, default=11167699,
help=('The GitLab project ID. Defaults to the project '
'for https://gitlab.com/qemu-project/qemu, that '
'is, "%(default)s"'))
try:
default_commit = get_local_staging_branch_commit()
commit_required = False
except ValueError:
default_commit = ''
commit_required = True
parser.add_argument('-c', '--commit', required=commit_required,
default=default_commit,
help=('Look for a pipeline associated with the given '
'commit. If one is not explicitly given, the '
'commit associated with the local branch named '
'"staging" is used. Default: %(default)s'))
parser.add_argument('--verbose', action='store_true', default=False,
help=('A minimal verbosity level that prints the '
'overall result of the check/wait'))
args = parser.parse_args()
try:
if args.wait:
success = wait_on_pipeline_success(
args.timeout,
args.interval,
args.project_id,
args.commit)
else:
status = get_pipeline_status(args.project_id,
args.commit)
success = status['status'] == 'success'
except Exception as error: # pylint: disable=W0703
success = False
if args.verbose:
print("ERROR: %s" % error.args[0])
if success:
if args.verbose:
print('success')
sys.exit(0)
else:
if args.verbose:
print('failure')
sys.exit(1)
if __name__ == '__main__':
main()

View File

@ -1327,12 +1327,10 @@ def main():
# but we can't tell which ones. Prevent issues from the compiler by # but we can't tell which ones. Prevent issues from the compiler by
# suppressing redundant declaration warnings. # suppressing redundant declaration warnings.
if anyextern: if anyextern:
output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n", output("#pragma GCC diagnostic push\n",
"# pragma GCC diagnostic push\n", "#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n",
"# pragma GCC diagnostic ignored \"-Wredundant-decls\"\n", "#ifdef __clang__\n"
"# ifdef __clang__\n"
"# pragma GCC diagnostic ignored \"-Wtypedef-redefinition\"\n", "# pragma GCC diagnostic ignored \"-Wtypedef-redefinition\"\n",
"# endif\n",
"#endif\n\n") "#endif\n\n")
out_pats = {} out_pats = {}
@ -1347,9 +1345,7 @@ def main():
output('\n') output('\n')
if anyextern: if anyextern:
output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n", output("#pragma GCC diagnostic pop\n\n")
"# pragma GCC diagnostic pop\n",
"#endif\n\n")
for n in sorted(formats.keys()): for n in sorted(formats.keys()):
f = formats[n] f = formats[n]

View File

@ -19,6 +19,7 @@
#include "sysemu/runstate.h" #include "sysemu/runstate.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/rcu.h"
#include "tests/qtest/libqtest.h" #include "tests/qtest/libqtest.h"
#include "tests/qtest/libqos/qgraph.h" #include "tests/qtest/libqos/qgraph.h"
#include "fuzz.h" #include "fuzz.h"

View File

@ -191,7 +191,7 @@ static void register_virtio_scsi_fuzz_targets(void)
{ {
fuzz_add_qos_target(&(FuzzTarget){ fuzz_add_qos_target(&(FuzzTarget){
.name = "virtio-scsi-fuzz", .name = "virtio-scsi-fuzz",
.description = "Fuzz the virtio-scsi virtual queues, forking" .description = "Fuzz the virtio-scsi virtual queues, forking "
"for each fuzz run", "for each fuzz run",
.pre_vm_init = &counter_shm_init, .pre_vm_init = &counter_shm_init,
.pre_fuzz = &virtio_scsi_pre_fuzz, .pre_fuzz = &virtio_scsi_pre_fuzz,
@ -202,7 +202,7 @@ static void register_virtio_scsi_fuzz_targets(void)
fuzz_add_qos_target(&(FuzzTarget){ fuzz_add_qos_target(&(FuzzTarget){
.name = "virtio-scsi-flags-fuzz", .name = "virtio-scsi-flags-fuzz",
.description = "Fuzz the virtio-scsi virtual queues, forking" .description = "Fuzz the virtio-scsi virtual queues, forking "
"for each fuzz run (also fuzzes the virtio flags)", "for each fuzz run (also fuzzes the virtio flags)",
.pre_vm_init = &counter_shm_init, .pre_vm_init = &counter_shm_init,
.pre_fuzz = &virtio_scsi_pre_fuzz, .pre_fuzz = &virtio_scsi_pre_fuzz,

View File

@ -1996,14 +1996,10 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
* proper replacement (native opengl support) is only * proper replacement (native opengl support) is only
* available in 3.16+. Silence the warning if possible. * available in 3.16+. Silence the warning if possible.
*/ */
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE); gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE);
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
vc->gfx.dcl.ops = &dcl_egl_ops; vc->gfx.dcl.ops = &dcl_egl_ops;
} }
} else } else

View File

@ -251,8 +251,8 @@ Coroutine *qemu_coroutine_new(void)
} }
#ifdef CONFIG_VALGRIND_H #ifdef CONFIG_VALGRIND_H
#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE) && !defined(__clang__)
/* Work around an unused variable in the valgrind.h macro... */ /* Work around an unused variable in the valgrind.h macro... */
#if !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif #endif
@ -260,7 +260,7 @@ static inline void valgrind_stack_deregister(CoroutineUContext *co)
{ {
VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id); VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id);
} }
#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE) && !defined(__clang__) #if !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#endif #endif