Skip to content

Commit 00ce6c3

Browse files
committed
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 "[email protected]" # gpg: Good signature from "Thomas Huth <[email protected]>" [full] # gpg: aka "Thomas Huth <[email protected]>" [full] # gpg: aka "Thomas Huth <[email protected]>" [full] # gpg: aka "Thomas Huth <[email protected]>" [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 <[email protected]>
2 parents 6c87d9f + 2a84f48 commit 00ce6c3

File tree

12 files changed

+210
-63
lines changed

12 files changed

+210
-63
lines changed

configure

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5728,31 +5728,6 @@ if compile_prog "" "" ; then
57285728
linux_magic_h=yes
57295729
fi
57305730

5731-
########################################
5732-
# check whether we can disable warning option with a pragma (this is needed
5733-
# to silence warnings in the headers of some versions of external libraries).
5734-
# This test has to be compiled with -Werror as otherwise an unknown pragma is
5735-
# only a warning.
5736-
#
5737-
# If we can't selectively disable warning in the code, disable -Werror so that
5738-
# the build doesn't fail anyway.
5739-
5740-
pragma_disable_unused_but_set=no
5741-
cat > $TMPC << EOF
5742-
#pragma GCC diagnostic push
5743-
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
5744-
#pragma GCC diagnostic pop
5745-
5746-
int main(void) {
5747-
return 0;
5748-
}
5749-
EOF
5750-
if compile_prog "-Werror" "" ; then
5751-
pragma_diagnostic_available=yes
5752-
else
5753-
werror=no
5754-
fi
5755-
57565731
########################################
57575732
# check if we have valgrind/valgrind.h
57585733

@@ -6343,6 +6318,7 @@ int main(void) {
63436318
if (tmp != NULL) {
63446319
return *(int *)(tmp + 2);
63456320
}
6321+
return 1;
63466322
}
63476323
EOF
63486324
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
@@ -7688,10 +7664,6 @@ if test "$linux_magic_h" = "yes" ; then
76887664
echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
76897665
fi
76907666

7691-
if test "$pragma_diagnostic_available" = "yes" ; then
7692-
echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
7693-
fi
7694-
76957667
if test "$valgrind_h" = "yes" ; then
76967668
echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
76977669
fi
@@ -7925,7 +7897,7 @@ if test "$fuzzing" = "yes" ; then
79257897
if test "$have_fuzzer" = "yes"; then
79267898
FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"
79277899
FUZZ_CFLAGS=" -fsanitize=address,fuzzer"
7928-
CFLAGS=" -fsanitize=address,fuzzer-no-link"
7900+
CFLAGS="$CFLAGS -fsanitize=address,fuzzer-no-link"
79297901
else
79307902
error_exit "Your compiler doesn't support -fsanitize=address,fuzzer"
79317903
exit 1

disas/sh4.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
19631963
fprintf_fn (stream, "xd%d", rn & ~1);
19641964
break;
19651965
}
1966+
/* fallthrough */
19661967
case D_REG_N:
19671968
fprintf_fn (stream, "dr%d", rn);
19681969
break;
@@ -1972,6 +1973,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
19721973
fprintf_fn (stream, "xd%d", rm & ~1);
19731974
break;
19741975
}
1976+
/* fallthrough */
19751977
case D_REG_M:
19761978
fprintf_fn (stream, "dr%d", rm);
19771979
break;

docs/devel/fuzzing.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ Fuzz targets are built similarly to system/softmmu:
3333

3434
This builds ./i386-softmmu/qemu-fuzz-i386
3535

36-
The first option to this command is: --fuzz_taget=FUZZ_NAME
36+
The first option to this command is: --fuzz-target=FUZZ_NAME
3737
To list all of the available fuzzers run qemu-fuzz-i386 with no arguments.
3838

39-
eg:
40-
./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-net-fork-fuzz
39+
For example:
40+
./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz
4141

4242
Internally, libfuzzer parses all arguments that do not begin with "--".
4343
Information about these is available by passing -help=1

docs/system/s390x/3270.rst

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
3270 devices
22
============
33

4-
QEMU supports connecting an external 3270 terminal emulator (such as
5-
``x3270``) to make a single 3270 device available to a guest. Note that this
6-
supports basic features only.
4+
The 3270 is the classic 'green-screen' console of the mainframes (see the
5+
`IBM 3270 Wikipedia article <https://en.wikipedia.org/wiki/IBM_3270>`__).
6+
7+
The 3270 data stream is not implemented within QEMU; the device only provides
8+
TN3270 (a telnet extension; see `RFC 854 <https://tools.ietf.org/html/rfc854>`__
9+
and `RFC 1576 <https://tools.ietf.org/html/rfc1576>`__) and leaves the heavy
10+
lifting to an external 3270 terminal emulator (such as ``x3270``) to make a
11+
single 3270 device available to a guest. Note that this supports basic
12+
features only.
713

814
To provide a 3270 device to a guest, create a ``x-terminal3270`` linked to
915
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.
1218
Example configuration
1319
---------------------
1420

21+
* Make sure that 3270 support is enabled in the guest's Linux kernel. You need
22+
``CONFIG_TN3270`` and at least one of ``CONFIG_TN3270_TTY`` (for additional
23+
ttys) or ``CONFIG_TN3270_CONSOLE`` (for a 3270 console).
24+
1525
* Add a ``tn3270`` chardev and a ``x-terminal3270`` to the QEMU command line::
1626

17-
-chardev socket,id=char_0,host=0.0.0.0,port=2300,nowait,server,tn3270
18-
-device x-terminal3270,chardev=char_0,devno=fe.0.000a,id=terminal_0
27+
-chardev socket,id=ch0,host=0.0.0.0,port=2300,nowait,server,tn3270
28+
-device x-terminal3270,chardev=ch0,devno=fe.0.000a,id=terminal0
1929

2030
* Start the guest. In the guest, use ``chccwdev -e 0.0.000a`` to enable
2131
the device.
@@ -29,4 +39,25 @@ Example configuration
2939

3040
systemctl start [email protected]
3141

32-
This should get you an addtional tty for logging into the guest.
42+
This should get you an additional tty for logging into the guest.
43+
44+
* If you want to use the 3270 device as the Linux kernel console instead of
45+
an additional tty, you can also append ``conmode=3270 condev=000a`` to
46+
the guest's kernel command line. The kernel then should use the 3270 as
47+
console after the next boot.
48+
49+
Restrictions
50+
------------
51+
52+
3270 support is very basic. In particular:
53+
54+
* Only one 3270 device is supported.
55+
56+
* It has only been tested with Linux guests and the x3270 emulator.
57+
58+
* TLS/SSL is not supported.
59+
60+
* Resizing on reattach is not supported.
61+
62+
* Multiple commands in one inbound buffer (for example, when the reset key
63+
is pressed while the network is slow) are not supported.

include/ui/gtk.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
#ifndef UI_GTK_H
22
#define UI_GTK_H
33

4-
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
54
/* Work around an -Wstrict-prototypes warning in GTK headers */
65
#pragma GCC diagnostic push
76
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
8-
#endif
97
#include <gtk/gtk.h>
10-
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
118
#pragma GCC diagnostic pop
12-
#endif
139

1410
#include <gdk/gdkkeysyms.h>
1511

include/ui/qemu-pixman.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
#define QEMU_PIXMAN_H
88

99
/* pixman-0.16.0 headers have a redundant declaration */
10-
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
1110
#pragma GCC diagnostic push
1211
#pragma GCC diagnostic ignored "-Wredundant-decls"
13-
#endif
1412
#include <pixman.h>
15-
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
1613
#pragma GCC diagnostic pop
17-
#endif
1814

1915
/*
2016
* pixman image formats are defined to be native endian,

scripts/ci/gitlab-pipeline-status

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright (c) 2019-2020 Red Hat, Inc.
4+
#
5+
# Author:
6+
# Cleber Rosa <[email protected]>
7+
#
8+
# This work is licensed under the terms of the GNU GPL, version 2 or
9+
# later. See the COPYING file in the top-level directory.
10+
11+
"""
12+
Checks the GitLab pipeline status for a given commit ID
13+
"""
14+
15+
# pylint: disable=C0103
16+
17+
import argparse
18+
import http.client
19+
import json
20+
import os
21+
import subprocess
22+
import time
23+
import sys
24+
25+
26+
def get_local_staging_branch_commit():
27+
"""
28+
Returns the commit sha1 for the *local* branch named "staging"
29+
"""
30+
result = subprocess.run(['git', 'rev-parse', 'staging'],
31+
stdin=subprocess.DEVNULL,
32+
stdout=subprocess.PIPE,
33+
stderr=subprocess.DEVNULL,
34+
cwd=os.path.dirname(__file__),
35+
universal_newlines=True).stdout.strip()
36+
if result == 'staging':
37+
raise ValueError("There's no local branch named 'staging'")
38+
if len(result) != 40:
39+
raise ValueError("Branch staging HEAD doesn't look like a sha1")
40+
return result
41+
42+
43+
def get_pipeline_status(project_id, commit_sha1):
44+
"""
45+
Returns the JSON content of the pipeline status API response
46+
"""
47+
url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
48+
commit_sha1)
49+
connection = http.client.HTTPSConnection('gitlab.com')
50+
connection.request('GET', url=url)
51+
response = connection.getresponse()
52+
if response.code != http.HTTPStatus.OK:
53+
raise ValueError("Failed to receive a successful response")
54+
json_response = json.loads(response.read())
55+
56+
# As far as I can tell, there should be only one pipeline for the same
57+
# project + commit. If this assumption is false, we can add further
58+
# filters to the url, such as username, and order_by.
59+
if not json_response:
60+
raise ValueError("No pipeline found")
61+
return json_response[0]
62+
63+
64+
def wait_on_pipeline_success(timeout, interval,
65+
project_id, commit_sha):
66+
"""
67+
Waits for the pipeline to finish within the given timeout
68+
"""
69+
start = time.time()
70+
while True:
71+
if time.time() >= (start + timeout):
72+
print("Waiting on the pipeline timed out")
73+
return False
74+
75+
status = get_pipeline_status(project_id, commit_sha)
76+
if status['status'] == 'running':
77+
time.sleep(interval)
78+
print('running...')
79+
continue
80+
81+
if status['status'] == 'success':
82+
return True
83+
84+
msg = "Pipeline failed, check: %s" % status['web_url']
85+
print(msg)
86+
return False
87+
88+
89+
def main():
90+
"""
91+
Script entry point
92+
"""
93+
parser = argparse.ArgumentParser(
94+
prog='pipeline-status',
95+
description='check or wait on a pipeline status')
96+
97+
parser.add_argument('-t', '--timeout', type=int, default=7200,
98+
help=('Amount of time (in seconds) to wait for the '
99+
'pipeline to complete. Defaults to '
100+
'%(default)s'))
101+
parser.add_argument('-i', '--interval', type=int, default=60,
102+
help=('Amount of time (in seconds) to wait between '
103+
'checks of the pipeline status. Defaults '
104+
'to %(default)s'))
105+
parser.add_argument('-w', '--wait', action='store_true', default=False,
106+
help=('Wether to wait, instead of checking only once '
107+
'the status of a pipeline'))
108+
parser.add_argument('-p', '--project-id', type=int, default=11167699,
109+
help=('The GitLab project ID. Defaults to the project '
110+
'for https://gitlab.com/qemu-project/qemu, that '
111+
'is, "%(default)s"'))
112+
try:
113+
default_commit = get_local_staging_branch_commit()
114+
commit_required = False
115+
except ValueError:
116+
default_commit = ''
117+
commit_required = True
118+
parser.add_argument('-c', '--commit', required=commit_required,
119+
default=default_commit,
120+
help=('Look for a pipeline associated with the given '
121+
'commit. If one is not explicitly given, the '
122+
'commit associated with the local branch named '
123+
'"staging" is used. Default: %(default)s'))
124+
parser.add_argument('--verbose', action='store_true', default=False,
125+
help=('A minimal verbosity level that prints the '
126+
'overall result of the check/wait'))
127+
128+
args = parser.parse_args()
129+
130+
try:
131+
if args.wait:
132+
success = wait_on_pipeline_success(
133+
args.timeout,
134+
args.interval,
135+
args.project_id,
136+
args.commit)
137+
else:
138+
status = get_pipeline_status(args.project_id,
139+
args.commit)
140+
success = status['status'] == 'success'
141+
except Exception as error: # pylint: disable=W0703
142+
success = False
143+
if args.verbose:
144+
print("ERROR: %s" % error.args[0])
145+
146+
if success:
147+
if args.verbose:
148+
print('success')
149+
sys.exit(0)
150+
else:
151+
if args.verbose:
152+
print('failure')
153+
sys.exit(1)
154+
155+
156+
if __name__ == '__main__':
157+
main()

scripts/decodetree.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,12 +1327,10 @@ def main():
13271327
# but we can't tell which ones. Prevent issues from the compiler by
13281328
# suppressing redundant declaration warnings.
13291329
if anyextern:
1330-
output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n",
1331-
"# pragma GCC diagnostic push\n",
1332-
"# pragma GCC diagnostic ignored \"-Wredundant-decls\"\n",
1333-
"# ifdef __clang__\n"
1330+
output("#pragma GCC diagnostic push\n",
1331+
"#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n",
1332+
"#ifdef __clang__\n"
13341333
"# pragma GCC diagnostic ignored \"-Wtypedef-redefinition\"\n",
1335-
"# endif\n",
13361334
"#endif\n\n")
13371335

13381336
out_pats = {}
@@ -1347,9 +1345,7 @@ def main():
13471345
output('\n')
13481346

13491347
if anyextern:
1350-
output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n",
1351-
"# pragma GCC diagnostic pop\n",
1352-
"#endif\n\n")
1348+
output("#pragma GCC diagnostic pop\n\n")
13531349

13541350
for n in sorted(formats.keys()):
13551351
f = formats[n]

tests/qtest/fuzz/fuzz.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "sysemu/runstate.h"
2020
#include "sysemu/sysemu.h"
2121
#include "qemu/main-loop.h"
22+
#include "qemu/rcu.h"
2223
#include "tests/qtest/libqtest.h"
2324
#include "tests/qtest/libqos/qgraph.h"
2425
#include "fuzz.h"

tests/qtest/fuzz/virtio_scsi_fuzz.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void register_virtio_scsi_fuzz_targets(void)
191191
{
192192
fuzz_add_qos_target(&(FuzzTarget){
193193
.name = "virtio-scsi-fuzz",
194-
.description = "Fuzz the virtio-scsi virtual queues, forking"
194+
.description = "Fuzz the virtio-scsi virtual queues, forking "
195195
"for each fuzz run",
196196
.pre_vm_init = &counter_shm_init,
197197
.pre_fuzz = &virtio_scsi_pre_fuzz,
@@ -202,7 +202,7 @@ static void register_virtio_scsi_fuzz_targets(void)
202202

203203
fuzz_add_qos_target(&(FuzzTarget){
204204
.name = "virtio-scsi-flags-fuzz",
205-
.description = "Fuzz the virtio-scsi virtual queues, forking"
205+
.description = "Fuzz the virtio-scsi virtual queues, forking "
206206
"for each fuzz run (also fuzzes the virtio flags)",
207207
.pre_vm_init = &counter_shm_init,
208208
.pre_fuzz = &virtio_scsi_pre_fuzz,

0 commit comments

Comments
 (0)