1 | A last handful of patches before the rc0. These are all bugfixes | 1 | Almost nothing in here is arm-related, but the target-arm |
---|---|---|---|
2 | so they could equally well go into rc1, but since my pullreq | 2 | queue was convenient for these last minute bits and pieces |
3 | queue is otherwise empty I might as well push them out. The | 3 | for 5.0... |
4 | FPSCR bugfix is definitely one I'd like in rc0; the rest are | ||
5 | not really user-visible I think. | ||
6 | 4 | ||
7 | thanks | 5 | thanks |
8 | -- PMM | 6 | -- PMM |
9 | 7 | ||
10 | The following changes since commit c4107e8208d0222f9b328691b519aaee4101db87: | 8 | The following changes since commit 14e5526b51910efd62cd31cd95b49baca975c83f: |
11 | 9 | ||
12 | Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2019-07-08 10:26:18 +0100) | 10 | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-04-13 15:42:51 +0100) |
13 | 11 | ||
14 | are available in the Git repository at: | 12 | are available in the Git repository at: |
15 | 13 | ||
16 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190708 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200414 |
17 | 15 | ||
18 | for you to fetch changes up to 85795187f416326f87177cabc39fae1911f04c50: | 16 | for you to fetch changes up to 84f82ddcbb4ac4ed04c8675e85155329f23184f0: |
19 | 17 | ||
20 | target/arm/vfp_helper: Call set_fpscr_to_host before updating to FPSCR (2019-07-08 14:11:31 +0100) | 18 | Deprecate KVM support for AArch32 (2020-04-14 17:20:22 +0100) |
21 | 19 | ||
22 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
23 | target-arm queue: | 21 | patch queue: |
24 | * tests/migration-test: Fix read off end of aarch64_kernel array | 22 | * Fix some problems that trip up Coverity's scanner |
25 | * Fix sve_zcr_len_for_el off-by-one error | 23 | * run-coverity-scan: New script automating the scan-and-upload process |
26 | * hw/arm/sbsa-ref: Silence Coverity nit | 24 | * docs: Improve our gdbstub documentation |
27 | * vfp_helper: Call set_fpscr_to_host before updating to FPSCR | 25 | * configure: Honour --disable-werror for Sphinx |
26 | * docs: Fix errors produced when building with Sphinx 3.0 | ||
27 | * docs: Require Sphinx 1.6 or better | ||
28 | * Add deprecation notice for KVM support on AArch32 hosts | ||
28 | 29 | ||
29 | ---------------------------------------------------------------- | 30 | ---------------------------------------------------------------- |
30 | Peter Maydell (2): | 31 | Peter Maydell (12): |
31 | tests/migration-test: Fix read off end of aarch64_kernel array | 32 | osdep.h: Drop no-longer-needed Coverity workarounds |
32 | hw/arm/sbsa-ref: Remove unnecessary check for secure_sysmem == NULL | 33 | thread.h: Fix Coverity version of qemu_cond_timedwait() |
34 | thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc | ||
35 | linux-user/flatload.c: Use "" for include of QEMU header target_flat.h | ||
36 | scripts/run-coverity-scan: Script to run Coverity Scan build | ||
37 | scripts/coverity-scan: Add Docker support | ||
38 | docs: Improve our gdbstub documentation | ||
39 | configure: Honour --disable-werror for Sphinx | ||
40 | scripts/kernel-doc: Add missing close-paren in c:function directives | ||
41 | kernel-doc: Use c:struct for Sphinx 3.0 and later | ||
42 | docs: Require Sphinx 1.6 or better | ||
43 | Deprecate KVM support for AArch32 | ||
33 | 44 | ||
34 | Philippe Mathieu-Daudé (1): | 45 | configure | 9 +- |
35 | target/arm/vfp_helper: Call set_fpscr_to_host before updating to FPSCR | 46 | Makefile | 2 +- |
47 | include/qemu/osdep.h | 14 - | ||
48 | include/qemu/thread.h | 12 +- | ||
49 | linux-user/flatload.c | 2 +- | ||
50 | MAINTAINERS | 5 + | ||
51 | docs/conf.py | 6 +- | ||
52 | docs/sphinx/kerneldoc.py | 1 + | ||
53 | docs/system/deprecated.rst | 8 + | ||
54 | docs/system/gdb.rst | 22 +- | ||
55 | qemu-options.hx | 24 +- | ||
56 | scripts/coverity-scan/coverity-scan.docker | 131 ++++++++++ | ||
57 | scripts/coverity-scan/run-coverity-scan | 401 +++++++++++++++++++++++++++++ | ||
58 | scripts/kernel-doc | 18 +- | ||
59 | 14 files changed, 615 insertions(+), 40 deletions(-) | ||
60 | create mode 100644 scripts/coverity-scan/coverity-scan.docker | ||
61 | create mode 100755 scripts/coverity-scan/run-coverity-scan | ||
36 | 62 | ||
37 | Richard Henderson (1): | ||
38 | target/arm: Fix sve_zcr_len_for_el | ||
39 | |||
40 | hw/arm/sbsa-ref.c | 8 ++------ | ||
41 | target/arm/helper.c | 4 ++-- | ||
42 | target/arm/vfp_helper.c | 4 ++-- | ||
43 | tests/migration-test.c | 22 +++++++--------------- | ||
44 | 4 files changed, 13 insertions(+), 25 deletions(-) | ||
45 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In commit a1a98357e3fd in 2018 we added some workarounds for Coverity | ||
2 | not being able to handle the _Float* types introduced by recent | ||
3 | glibc. Newer versions of the Coverity scan tools have support for | ||
4 | these types, and will fail with errors about duplicate typedefs if we | ||
5 | have our workaround. Remove our copy of the typedefs. | ||
1 | 6 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200319193323.2038-2-peter.maydell@linaro.org | ||
10 | --- | ||
11 | include/qemu/osdep.h | 14 -------------- | ||
12 | 1 file changed, 14 deletions(-) | ||
13 | |||
14 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/include/qemu/osdep.h | ||
17 | +++ b/include/qemu/osdep.h | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | #else | ||
20 | #include "exec/poison.h" | ||
21 | #endif | ||
22 | -#ifdef __COVERITY__ | ||
23 | -/* Coverity does not like the new _Float* types that are used by | ||
24 | - * recent glibc, and croaks on every single file that includes | ||
25 | - * stdlib.h. These typedefs are enough to please it. | ||
26 | - * | ||
27 | - * Note that these fix parse errors so they cannot be placed in | ||
28 | - * scripts/coverity-model.c. | ||
29 | - */ | ||
30 | -typedef float _Float32; | ||
31 | -typedef double _Float32x; | ||
32 | -typedef double _Float64; | ||
33 | -typedef __float80 _Float64x; | ||
34 | -typedef __float128 _Float128; | ||
35 | -#endif | ||
36 | |||
37 | #include "qemu/compiler.h" | ||
38 | |||
39 | -- | ||
40 | 2.20.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | For Coverity's benefit, we provide simpler versions of functions like | ||
2 | qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When | ||
3 | we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and | ||
4 | paste error meant that the Coverity version of qemu_cond_timedwait() | ||
5 | was using the wrong _impl function, which makes the Coverity parser | ||
6 | complain: | ||
1 | 7 | ||
8 | "/qemu/include/qemu/thread.h", line 159: warning #140: too many arguments in | ||
9 | function call | ||
10 | return qemu_cond_timedwait(cond, mutex, ms); | ||
11 | ^ | ||
12 | |||
13 | "/qemu/include/qemu/thread.h", line 159: warning #120: return value type does | ||
14 | not match the function type | ||
15 | return qemu_cond_timedwait(cond, mutex, ms); | ||
16 | ^ | ||
17 | |||
18 | "/qemu/include/qemu/thread.h", line 156: warning #1563: function | ||
19 | "qemu_cond_timedwait" not emitted, consider modeling it or review | ||
20 | parse diagnostics to improve fidelity | ||
21 | static inline bool (qemu_cond_timedwait)(QemuCond *cond, QemuMutex *mutex, | ||
22 | ^ | ||
23 | |||
24 | These aren't fatal, but reduce the scope of the analysis. Fix the error. | ||
25 | |||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
29 | Message-id: 20200319193323.2038-3-peter.maydell@linaro.org | ||
30 | --- | ||
31 | include/qemu/thread.h | 2 +- | ||
32 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
33 | |||
34 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/qemu/thread.h | ||
37 | +++ b/include/qemu/thread.h | ||
38 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; | ||
39 | #define qemu_cond_wait(c, m) \ | ||
40 | qemu_cond_wait_impl(c, m, __FILE__, __LINE__); | ||
41 | #define qemu_cond_timedwait(c, m, ms) \ | ||
42 | - qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__); | ||
43 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); | ||
44 | #else | ||
45 | #define qemu_mutex_lock(m) ({ \ | ||
46 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ | ||
47 | -- | ||
48 | 2.20.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | All the Coverity-specific definitions of qemu_mutex_lock() and friends | ||
2 | have a trailing semicolon. This works fine almost everywhere because | ||
3 | of QEMU's mandatory-braces coding style and because most callsites are | ||
4 | simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as | ||
5 | an if() statement, which makes the ';' a syntax error: | ||
6 | "../target/s390x/sigp.c", line 461: warning #18: expected a ")" | ||
7 | if (qemu_mutex_trylock(&qemu_sigp_mutex)) { | ||
8 | ^ | ||
1 | 9 | ||
10 | Remove the bogus semicolons from the macro definitions. | ||
11 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20200319193323.2038-4-peter.maydell@linaro.org | ||
16 | --- | ||
17 | include/qemu/thread.h | 12 ++++++------ | ||
18 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
19 | |||
20 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/include/qemu/thread.h | ||
23 | +++ b/include/qemu/thread.h | ||
24 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; | ||
25 | * hide them. | ||
26 | */ | ||
27 | #define qemu_mutex_lock(m) \ | ||
28 | - qemu_mutex_lock_impl(m, __FILE__, __LINE__); | ||
29 | + qemu_mutex_lock_impl(m, __FILE__, __LINE__) | ||
30 | #define qemu_mutex_trylock(m) \ | ||
31 | - qemu_mutex_trylock_impl(m, __FILE__, __LINE__); | ||
32 | + qemu_mutex_trylock_impl(m, __FILE__, __LINE__) | ||
33 | #define qemu_rec_mutex_lock(m) \ | ||
34 | - qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__); | ||
35 | + qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__) | ||
36 | #define qemu_rec_mutex_trylock(m) \ | ||
37 | - qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__); | ||
38 | + qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__) | ||
39 | #define qemu_cond_wait(c, m) \ | ||
40 | - qemu_cond_wait_impl(c, m, __FILE__, __LINE__); | ||
41 | + qemu_cond_wait_impl(c, m, __FILE__, __LINE__) | ||
42 | #define qemu_cond_timedwait(c, m, ms) \ | ||
43 | - qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); | ||
44 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__) | ||
45 | #else | ||
46 | #define qemu_mutex_lock(m) ({ \ | ||
47 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ | ||
48 | -- | ||
49 | 2.20.1 | ||
50 | |||
51 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The target_flat.h file is a QEMU header, so we should include it using | ||
2 | quotes, not angle brackets. | ||
1 | 3 | ||
4 | Coverity otherwise is unable to find the header: | ||
5 | |||
6 | "../linux-user/flatload.c", line 40: error #1712: cannot open source file | ||
7 | "target_flat.h" | ||
8 | #include <target_flat.h> | ||
9 | ^ | ||
10 | |||
11 | because the relevant directory is only on the -iquote path, not the -I path. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200319193323.2038-5-peter.maydell@linaro.org | ||
17 | --- | ||
18 | linux-user/flatload.c | 2 +- | ||
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/linux-user/flatload.c b/linux-user/flatload.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/linux-user/flatload.c | ||
24 | +++ b/linux-user/flatload.c | ||
25 | @@ -XXX,XX +XXX,XX @@ | ||
26 | |||
27 | #include "qemu.h" | ||
28 | #include "flat.h" | ||
29 | -#include <target_flat.h> | ||
30 | +#include "target_flat.h" | ||
31 | |||
32 | //#define DEBUG | ||
33 | |||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Add a new script to automate the process of running the Coverity | |
2 | Scan build tools and uploading the resulting tarball to the | ||
3 | website. | ||
4 | |||
5 | This is intended eventually to be driven from Travis, | ||
6 | but it can be run locally, if you are a maintainer of the | ||
7 | QEMU project on the Coverity Scan website and have the secret | ||
8 | upload token. | ||
9 | |||
10 | The script must be run on a Fedora 30 system. Support for using a | ||
11 | Docker container is added in a following commit. | ||
12 | |||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Message-id: 20200319193323.2038-6-peter.maydell@linaro.org | ||
16 | --- | ||
17 | MAINTAINERS | 5 + | ||
18 | scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++ | ||
19 | 2 files changed, 316 insertions(+) | ||
20 | create mode 100755 scripts/coverity-scan/run-coverity-scan | ||
21 | |||
22 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/MAINTAINERS | ||
25 | +++ b/MAINTAINERS | ||
26 | @@ -XXX,XX +XXX,XX @@ M: Markus Armbruster <armbru@redhat.com> | ||
27 | S: Supported | ||
28 | F: scripts/coverity-model.c | ||
29 | |||
30 | +Coverity Scan integration | ||
31 | +M: Peter Maydell <peter.maydell@linaro.org> | ||
32 | +S: Maintained | ||
33 | +F: scripts/coverity-scan/ | ||
34 | + | ||
35 | Device Tree | ||
36 | M: Alistair Francis <alistair.francis@wdc.com> | ||
37 | R: David Gibson <david@gibson.dropbear.id.au> | ||
38 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | ||
39 | new file mode 100755 | ||
40 | index XXXXXXX..XXXXXXX | ||
41 | --- /dev/null | ||
42 | +++ b/scripts/coverity-scan/run-coverity-scan | ||
43 | @@ -XXX,XX +XXX,XX @@ | ||
44 | +#!/bin/sh -e | ||
45 | + | ||
46 | +# Upload a created tarball to Coverity Scan, as per | ||
47 | +# https://scan.coverity.com/projects/qemu/builds/new | ||
48 | + | ||
49 | +# This work is licensed under the terms of the GNU GPL version 2, | ||
50 | +# or (at your option) any later version. | ||
51 | +# See the COPYING file in the top-level directory. | ||
52 | +# | ||
53 | +# Copyright (c) 2017-2020 Linaro Limited | ||
54 | +# Written by Peter Maydell | ||
55 | + | ||
56 | +# Note that this script will automatically download and | ||
57 | +# run the (closed-source) coverity build tools, so don't | ||
58 | +# use it if you don't trust them! | ||
59 | + | ||
60 | +# This script assumes that you're running it from a QEMU source | ||
61 | +# tree, and that tree is a fresh clean one, because we do an in-tree | ||
62 | +# build. (This is necessary so that the filenames that the Coverity | ||
63 | +# Scan server sees are relative paths that match up with the component | ||
64 | +# regular expressions it uses; an out-of-tree build won't work for this.) | ||
65 | +# The host machine should have as many of QEMU's dependencies | ||
66 | +# installed as possible, for maximum coverity coverage. | ||
67 | + | ||
68 | +# To do an upload you need to be a maintainer in the Coverity online | ||
69 | +# service, and you will need to know the "Coverity token", which is a | ||
70 | +# secret 8 digit hex string. You can find that from the web UI in the | ||
71 | +# project settings, if you have maintainer access there. | ||
72 | + | ||
73 | +# Command line options: | ||
74 | +# --dry-run : run the tools, but don't actually do the upload | ||
75 | +# --update-tools-only : update the cached copy of the tools, but don't run them | ||
76 | +# --tokenfile : file to read Coverity token from | ||
77 | +# --version ver : specify version being analyzed (default: ask git) | ||
78 | +# --description desc : specify description of this version (default: ask git) | ||
79 | +# --srcdir : QEMU source tree to analyze (default: current working dir) | ||
80 | +# --results-tarball : path to copy the results tarball to (default: don't | ||
81 | +# copy it anywhere, just upload it) | ||
82 | +# | ||
83 | +# User-specifiable environment variables: | ||
84 | +# COVERITY_TOKEN -- Coverity token | ||
85 | +# COVERITY_EMAIL -- the email address to use for uploads (default: | ||
86 | +# looks at your git user.email config) | ||
87 | +# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is | ||
88 | +# number of CPUs as determined by 'nproc') | ||
89 | +# COVERITY_TOOL_BASE -- set to directory to put coverity tools | ||
90 | +# (default: /tmp/coverity-tools) | ||
91 | +# | ||
92 | +# You must specify the token, either by environment variable or by | ||
93 | +# putting it in a file and using --tokenfile. Everything else has | ||
94 | +# a reasonable default if this is run from a git tree. | ||
95 | + | ||
96 | +check_upload_permissions() { | ||
97 | + # Check whether we can do an upload to the server; will exit the script | ||
98 | + # with status 1 if the check failed (usually a bad token); | ||
99 | + # will exit the script with status 0 if the check indicated that we | ||
100 | + # can't upload yet (ie we are at quota) | ||
101 | + # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized. | ||
102 | + | ||
103 | + echo "Checking upload permissions..." | ||
104 | + | ||
105 | + if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted --post-data "token=$PROJTOKEN&project=$PROJNAME" -q -O -)"; then | ||
106 | + echo "Coverity Scan API access denied: bad token?" | ||
107 | + exit 1 | ||
108 | + fi | ||
109 | + | ||
110 | + # Really up_perm is a JSON response with either | ||
111 | + # {upload_permitted:true} or {next_upload_permitted_at:<date>} | ||
112 | + # We do some hacky string parsing instead of properly parsing it. | ||
113 | + case "$up_perm" in | ||
114 | + *upload_permitted*true*) | ||
115 | + echo "Coverity Scan: upload permitted" | ||
116 | + ;; | ||
117 | + *next_upload_permitted_at*) | ||
118 | + if [ "$DRYRUN" = yes ]; then | ||
119 | + echo "Coverity Scan: upload quota reached, continuing dry run" | ||
120 | + else | ||
121 | + echo "Coverity Scan: upload quota reached; stopping here" | ||
122 | + # Exit success as this isn't a build error. | ||
123 | + exit 0 | ||
124 | + fi | ||
125 | + ;; | ||
126 | + *) | ||
127 | + echo "Coverity Scan upload check: unexpected result $up_perm" | ||
128 | + exit 1 | ||
129 | + ;; | ||
130 | + esac | ||
131 | +} | ||
132 | + | ||
133 | + | ||
134 | +update_coverity_tools () { | ||
135 | + # Check for whether we need to download the Coverity tools | ||
136 | + # (either because we don't have a copy, or because it's out of date) | ||
137 | + # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set. | ||
138 | + | ||
139 | + mkdir -p "$COVERITY_TOOL_BASE" | ||
140 | + cd "$COVERITY_TOOL_BASE" | ||
141 | + | ||
142 | + echo "Checking for new version of coverity build tools..." | ||
143 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new | ||
144 | + | ||
145 | + if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then | ||
146 | + # out of date md5 or no md5: download new build tool | ||
147 | + # blow away the old build tool | ||
148 | + echo "Downloading coverity build tools..." | ||
149 | + rm -rf coverity_tool coverity_tool.tgz | ||
150 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz | ||
151 | + if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5sum -c --status; then | ||
152 | + echo "Downloaded tarball didn't match md5sum!" | ||
153 | + exit 1 | ||
154 | + fi | ||
155 | + # extract the new one, keeping it corralled in a 'coverity_tool' directory | ||
156 | + echo "Unpacking coverity build tools..." | ||
157 | + mkdir -p coverity_tool | ||
158 | + cd coverity_tool | ||
159 | + tar xf ../coverity_tool.tgz | ||
160 | + cd .. | ||
161 | + mv coverity_tool.md5.new coverity_tool.md5 | ||
162 | + fi | ||
163 | + | ||
164 | + rm -f coverity_tool.md5.new | ||
165 | +} | ||
166 | + | ||
167 | + | ||
168 | +# Check user-provided environment variables and arguments | ||
169 | +DRYRUN=no | ||
170 | +UPDATE_ONLY=no | ||
171 | + | ||
172 | +while [ "$#" -ge 1 ]; do | ||
173 | + case "$1" in | ||
174 | + --dry-run) | ||
175 | + shift | ||
176 | + DRYRUN=yes | ||
177 | + ;; | ||
178 | + --update-tools-only) | ||
179 | + shift | ||
180 | + UPDATE_ONLY=yes | ||
181 | + ;; | ||
182 | + --version) | ||
183 | + shift | ||
184 | + if [ $# -eq 0 ]; then | ||
185 | + echo "--version needs an argument" | ||
186 | + exit 1 | ||
187 | + fi | ||
188 | + VERSION="$1" | ||
189 | + shift | ||
190 | + ;; | ||
191 | + --description) | ||
192 | + shift | ||
193 | + if [ $# -eq 0 ]; then | ||
194 | + echo "--description needs an argument" | ||
195 | + exit 1 | ||
196 | + fi | ||
197 | + DESCRIPTION="$1" | ||
198 | + shift | ||
199 | + ;; | ||
200 | + --tokenfile) | ||
201 | + shift | ||
202 | + if [ $# -eq 0 ]; then | ||
203 | + echo "--tokenfile needs an argument" | ||
204 | + exit 1 | ||
205 | + fi | ||
206 | + COVERITY_TOKEN="$(cat "$1")" | ||
207 | + shift | ||
208 | + ;; | ||
209 | + --srcdir) | ||
210 | + shift | ||
211 | + if [ $# -eq 0 ]; then | ||
212 | + echo "--srcdir needs an argument" | ||
213 | + exit 1 | ||
214 | + fi | ||
215 | + SRCDIR="$1" | ||
216 | + shift | ||
217 | + ;; | ||
218 | + --results-tarball) | ||
219 | + shift | ||
220 | + if [ $# -eq 0 ]; then | ||
221 | + echo "--results-tarball needs an argument" | ||
222 | + exit 1 | ||
223 | + fi | ||
224 | + RESULTSTARBALL="$1" | ||
225 | + shift | ||
226 | + ;; | ||
227 | + *) | ||
228 | + echo "Unexpected argument '$1'" | ||
229 | + exit 1 | ||
230 | + ;; | ||
231 | + esac | ||
232 | +done | ||
233 | + | ||
234 | +if [ -z "$COVERITY_TOKEN" ]; then | ||
235 | + echo "COVERITY_TOKEN environment variable not set" | ||
236 | + exit 1 | ||
237 | +fi | ||
238 | + | ||
239 | +if [ -z "$COVERITY_BUILD_CMD" ]; then | ||
240 | + NPROC=$(nproc) | ||
241 | + COVERITY_BUILD_CMD="make -j$NPROC" | ||
242 | + echo "COVERITY_BUILD_CMD: using default '$COVERITY_BUILD_CMD'" | ||
243 | +fi | ||
244 | + | ||
245 | +if [ -z "$COVERITY_TOOL_BASE" ]; then | ||
246 | + echo "COVERITY_TOOL_BASE: using default /tmp/coverity-tools" | ||
247 | + COVERITY_TOOL_BASE=/tmp/coverity-tools | ||
248 | +fi | ||
249 | + | ||
250 | +if [ -z "$SRCDIR" ]; then | ||
251 | + SRCDIR="$PWD" | ||
252 | +fi | ||
253 | + | ||
254 | +PROJTOKEN="$COVERITY_TOKEN" | ||
255 | +PROJNAME=QEMU | ||
256 | +TARBALL=cov-int.tar.xz | ||
257 | + | ||
258 | + | ||
259 | +if [ "$UPDATE_ONLY" = yes ]; then | ||
260 | + # Just do the tools update; we don't need to check whether | ||
261 | + # we are in a source tree or have upload rights for this, | ||
262 | + # so do it before some of the command line and source tree checks. | ||
263 | + update_coverity_tools | ||
264 | + exit 0 | ||
265 | +fi | ||
266 | + | ||
267 | +cd "$SRCDIR" | ||
268 | + | ||
269 | +echo "Checking this is a QEMU source tree..." | ||
270 | +if ! [ -e "$SRCDIR/VERSION" ]; then | ||
271 | + echo "Not in a QEMU source tree?" | ||
272 | + exit 1 | ||
273 | +fi | ||
274 | + | ||
275 | +# Fill in defaults used by the non-update-only process | ||
276 | +if [ -z "$VERSION" ]; then | ||
277 | + VERSION="$(git describe --always HEAD)" | ||
278 | +fi | ||
279 | + | ||
280 | +if [ -z "$DESCRIPTION" ]; then | ||
281 | + DESCRIPTION="$(git rev-parse HEAD)" | ||
282 | +fi | ||
283 | + | ||
284 | +if [ -z "$COVERITY_EMAIL" ]; then | ||
285 | + COVERITY_EMAIL="$(git config user.email)" | ||
286 | +fi | ||
287 | + | ||
288 | +check_upload_permissions | ||
289 | + | ||
290 | +update_coverity_tools | ||
291 | + | ||
292 | +TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)" | ||
293 | + | ||
294 | +if ! test -x "$TOOLBIN/cov-build"; then | ||
295 | + echo "Couldn't find cov-build in the coverity build-tool directory??" | ||
296 | + exit 1 | ||
297 | +fi | ||
298 | + | ||
299 | +export PATH="$TOOLBIN:$PATH" | ||
300 | + | ||
301 | +cd "$SRCDIR" | ||
302 | + | ||
303 | +echo "Doing make distclean..." | ||
304 | +make distclean | ||
305 | + | ||
306 | +echo "Configuring..." | ||
307 | +# We configure with a fixed set of enables here to ensure that we don't | ||
308 | +# accidentally reduce the scope of the analysis by doing the build on | ||
309 | +# the system that's missing a dependency that we need to build part of | ||
310 | +# the codebase. | ||
311 | +./configure --disable-modules --enable-sdl --enable-gtk \ | ||
312 | + --enable-opengl --enable-vte --enable-gnutls \ | ||
313 | + --enable-nettle --enable-curses --enable-curl \ | ||
314 | + --audio-drv-list=oss,alsa,sdl,pa --enable-virtfs \ | ||
315 | + --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png \ | ||
316 | + --enable-xen --enable-brlapi \ | ||
317 | + --enable-linux-aio --enable-attr \ | ||
318 | + --enable-cap-ng --enable-trace-backends=log --enable-spice --enable-rbd \ | ||
319 | + --enable-xfsctl --enable-libusb --enable-usb-redir \ | ||
320 | + --enable-libiscsi --enable-libnfs --enable-seccomp \ | ||
321 | + --enable-tpm --enable-libssh --enable-lzo --enable-snappy --enable-bzip2 \ | ||
322 | + --enable-numa --enable-rdma --enable-smartcard --enable-virglrenderer \ | ||
323 | + --enable-mpath --enable-libxml2 --enable-glusterfs \ | ||
324 | + --enable-virtfs --enable-zstd | ||
325 | + | ||
326 | +echo "Making libqemustub.a..." | ||
327 | +make libqemustub.a | ||
328 | + | ||
329 | +echo "Running cov-build..." | ||
330 | +rm -rf cov-int | ||
331 | +mkdir cov-int | ||
332 | +cov-build --dir cov-int $COVERITY_BUILD_CMD | ||
333 | + | ||
334 | +echo "Creating results tarball..." | ||
335 | +tar cvf - cov-int | xz > "$TARBALL" | ||
336 | + | ||
337 | +if [ ! -z "$RESULTSTARBALL" ]; then | ||
338 | + echo "Copying results tarball to $RESULTSTARBALL..." | ||
339 | + cp "$TARBALL" "$RESULTSTARBALL" | ||
340 | +fi | ||
341 | + | ||
342 | +echo "Uploading results tarball..." | ||
343 | + | ||
344 | +if [ "$DRYRUN" = yes ]; then | ||
345 | + echo "Dry run only, not uploading $TARBALL" | ||
346 | + exit 0 | ||
347 | +fi | ||
348 | + | ||
349 | +curl --form token="$PROJTOKEN" --form email="$COVERITY_EMAIL" \ | ||
350 | + --form file=@"$TARBALL" --form version="$VERSION" \ | ||
351 | + --form description="$DESCRIPTION" \ | ||
352 | + https://scan.coverity.com/builds?project="$PROJNAME" | ||
353 | + | ||
354 | +echo "Done." | ||
355 | -- | ||
356 | 2.20.1 | ||
357 | |||
358 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Add support for running the Coverity Scan tools inside a Docker | |
2 | container rather than directly on the host system. | ||
3 | |||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Message-id: 20200319193323.2038-7-peter.maydell@linaro.org | ||
7 | --- | ||
8 | scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++ | ||
9 | scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++ | ||
10 | 2 files changed, 221 insertions(+) | ||
11 | create mode 100644 scripts/coverity-scan/coverity-scan.docker | ||
12 | |||
13 | diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-scan/coverity-scan.docker | ||
14 | new file mode 100644 | ||
15 | index XXXXXXX..XXXXXXX | ||
16 | --- /dev/null | ||
17 | +++ b/scripts/coverity-scan/coverity-scan.docker | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | +# syntax=docker/dockerfile:1.0.0-experimental | ||
20 | +# | ||
21 | +# Docker setup for running the "Coverity Scan" tools over the source | ||
22 | +# tree and uploading them to the website, as per | ||
23 | +# https://scan.coverity.com/projects/qemu/builds/new | ||
24 | +# We do this on a fixed config (currently Fedora 30 with a known | ||
25 | +# set of dependencies and a configure command that enables a specific | ||
26 | +# set of options) so that random changes don't result in our accidentally | ||
27 | +# dropping some files from the scan. | ||
28 | +# | ||
29 | +# We don't build on top of the fedora.docker file because we don't | ||
30 | +# want to accidentally change or break the scan config when that | ||
31 | +# is updated. | ||
32 | + | ||
33 | +# The work of actually doing the build is handled by the | ||
34 | +# run-coverity-scan script. | ||
35 | + | ||
36 | +FROM fedora:30 | ||
37 | +ENV PACKAGES \ | ||
38 | + alsa-lib-devel \ | ||
39 | + bc \ | ||
40 | + bison \ | ||
41 | + brlapi-devel \ | ||
42 | + bzip2 \ | ||
43 | + bzip2-devel \ | ||
44 | + ccache \ | ||
45 | + clang \ | ||
46 | + curl \ | ||
47 | + cyrus-sasl-devel \ | ||
48 | + dbus-daemon \ | ||
49 | + device-mapper-multipath-devel \ | ||
50 | + findutils \ | ||
51 | + flex \ | ||
52 | + gcc \ | ||
53 | + gcc-c++ \ | ||
54 | + gettext \ | ||
55 | + git \ | ||
56 | + glib2-devel \ | ||
57 | + glusterfs-api-devel \ | ||
58 | + gnutls-devel \ | ||
59 | + gtk3-devel \ | ||
60 | + hostname \ | ||
61 | + libaio-devel \ | ||
62 | + libasan \ | ||
63 | + libattr-devel \ | ||
64 | + libblockdev-mpath-devel \ | ||
65 | + libcap-devel \ | ||
66 | + libcap-ng-devel \ | ||
67 | + libcurl-devel \ | ||
68 | + libepoxy-devel \ | ||
69 | + libfdt-devel \ | ||
70 | + libgbm-devel \ | ||
71 | + libiscsi-devel \ | ||
72 | + libjpeg-devel \ | ||
73 | + libpmem-devel \ | ||
74 | + libnfs-devel \ | ||
75 | + libpng-devel \ | ||
76 | + librbd-devel \ | ||
77 | + libseccomp-devel \ | ||
78 | + libssh-devel \ | ||
79 | + libubsan \ | ||
80 | + libudev-devel \ | ||
81 | + libusbx-devel \ | ||
82 | + libxml2-devel \ | ||
83 | + libzstd-devel \ | ||
84 | + llvm \ | ||
85 | + lzo-devel \ | ||
86 | + make \ | ||
87 | + mingw32-bzip2 \ | ||
88 | + mingw32-curl \ | ||
89 | + mingw32-glib2 \ | ||
90 | + mingw32-gmp \ | ||
91 | + mingw32-gnutls \ | ||
92 | + mingw32-gtk3 \ | ||
93 | + mingw32-libjpeg-turbo \ | ||
94 | + mingw32-libpng \ | ||
95 | + mingw32-libtasn1 \ | ||
96 | + mingw32-nettle \ | ||
97 | + mingw32-nsis \ | ||
98 | + mingw32-pixman \ | ||
99 | + mingw32-pkg-config \ | ||
100 | + mingw32-SDL2 \ | ||
101 | + mingw64-bzip2 \ | ||
102 | + mingw64-curl \ | ||
103 | + mingw64-glib2 \ | ||
104 | + mingw64-gmp \ | ||
105 | + mingw64-gnutls \ | ||
106 | + mingw64-gtk3 \ | ||
107 | + mingw64-libjpeg-turbo \ | ||
108 | + mingw64-libpng \ | ||
109 | + mingw64-libtasn1 \ | ||
110 | + mingw64-nettle \ | ||
111 | + mingw64-pixman \ | ||
112 | + mingw64-pkg-config \ | ||
113 | + mingw64-SDL2 \ | ||
114 | + ncurses-devel \ | ||
115 | + nettle-devel \ | ||
116 | + nss-devel \ | ||
117 | + numactl-devel \ | ||
118 | + perl \ | ||
119 | + perl-Test-Harness \ | ||
120 | + pixman-devel \ | ||
121 | + pulseaudio-libs-devel \ | ||
122 | + python3 \ | ||
123 | + python3-sphinx \ | ||
124 | + PyYAML \ | ||
125 | + rdma-core-devel \ | ||
126 | + SDL2-devel \ | ||
127 | + snappy-devel \ | ||
128 | + sparse \ | ||
129 | + spice-server-devel \ | ||
130 | + systemd-devel \ | ||
131 | + systemtap-sdt-devel \ | ||
132 | + tar \ | ||
133 | + texinfo \ | ||
134 | + usbredir-devel \ | ||
135 | + virglrenderer-devel \ | ||
136 | + vte291-devel \ | ||
137 | + wget \ | ||
138 | + which \ | ||
139 | + xen-devel \ | ||
140 | + xfsprogs-devel \ | ||
141 | + zlib-devel | ||
142 | +ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3 | ||
143 | + | ||
144 | +RUN dnf install -y $PACKAGES | ||
145 | +RUN rpm -q $PACKAGES | sort > /packages.txt | ||
146 | +ENV PATH $PATH:/usr/libexec/python3-sphinx/ | ||
147 | +ENV COVERITY_TOOL_BASE=/coverity-tools | ||
148 | +COPY run-coverity-scan run-coverity-scan | ||
149 | +RUN --mount=type=secret,id=coverity.token,required ./run-coverity-scan --update-tools-only --tokenfile /run/secrets/coverity.token | ||
150 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | ||
151 | index XXXXXXX..XXXXXXX 100755 | ||
152 | --- a/scripts/coverity-scan/run-coverity-scan | ||
153 | +++ b/scripts/coverity-scan/run-coverity-scan | ||
154 | @@ -XXX,XX +XXX,XX @@ | ||
155 | |||
156 | # Command line options: | ||
157 | # --dry-run : run the tools, but don't actually do the upload | ||
158 | +# --docker : create and work inside a docker container | ||
159 | # --update-tools-only : update the cached copy of the tools, but don't run them | ||
160 | # --tokenfile : file to read Coverity token from | ||
161 | # --version ver : specify version being analyzed (default: ask git) | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | # --srcdir : QEMU source tree to analyze (default: current working dir) | ||
164 | # --results-tarball : path to copy the results tarball to (default: don't | ||
165 | # copy it anywhere, just upload it) | ||
166 | +# --src-tarball : tarball to untar into src dir (default: none); this | ||
167 | +# is intended mainly for internal use by the Docker support | ||
168 | # | ||
169 | # User-specifiable environment variables: | ||
170 | # COVERITY_TOKEN -- Coverity token | ||
171 | @@ -XXX,XX +XXX,XX @@ update_coverity_tools () { | ||
172 | # Check user-provided environment variables and arguments | ||
173 | DRYRUN=no | ||
174 | UPDATE_ONLY=no | ||
175 | +DOCKER=no | ||
176 | |||
177 | while [ "$#" -ge 1 ]; do | ||
178 | case "$1" in | ||
179 | @@ -XXX,XX +XXX,XX @@ while [ "$#" -ge 1 ]; do | ||
180 | RESULTSTARBALL="$1" | ||
181 | shift | ||
182 | ;; | ||
183 | + --src-tarball) | ||
184 | + shift | ||
185 | + if [ $# -eq 0 ]; then | ||
186 | + echo "--src-tarball needs an argument" | ||
187 | + exit 1 | ||
188 | + fi | ||
189 | + SRCTARBALL="$1" | ||
190 | + shift | ||
191 | + ;; | ||
192 | + --docker) | ||
193 | + DOCKER=yes | ||
194 | + shift | ||
195 | + ;; | ||
196 | *) | ||
197 | echo "Unexpected argument '$1'" | ||
198 | exit 1 | ||
199 | @@ -XXX,XX +XXX,XX @@ PROJTOKEN="$COVERITY_TOKEN" | ||
200 | PROJNAME=QEMU | ||
201 | TARBALL=cov-int.tar.xz | ||
202 | |||
203 | +if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then | ||
204 | + echo "Combining --docker and --update-only is not supported" | ||
205 | + exit 1 | ||
206 | +fi | ||
207 | |||
208 | if [ "$UPDATE_ONLY" = yes ]; then | ||
209 | # Just do the tools update; we don't need to check whether | ||
210 | @@ -XXX,XX +XXX,XX @@ if [ "$UPDATE_ONLY" = yes ]; then | ||
211 | exit 0 | ||
212 | fi | ||
213 | |||
214 | +if [ ! -e "$SRCDIR" ]; then | ||
215 | + mkdir "$SRCDIR" | ||
216 | +fi | ||
217 | + | ||
218 | cd "$SRCDIR" | ||
219 | |||
220 | +if [ ! -z "$SRCTARBALL" ]; then | ||
221 | + echo "Untarring source tarball into $SRCDIR..." | ||
222 | + tar xvf "$SRCTARBALL" | ||
223 | +fi | ||
224 | + | ||
225 | echo "Checking this is a QEMU source tree..." | ||
226 | if ! [ -e "$SRCDIR/VERSION" ]; then | ||
227 | echo "Not in a QEMU source tree?" | ||
228 | @@ -XXX,XX +XXX,XX @@ if [ -z "$COVERITY_EMAIL" ]; then | ||
229 | COVERITY_EMAIL="$(git config user.email)" | ||
230 | fi | ||
231 | |||
232 | +# Run ourselves inside docker if that's what the user wants | ||
233 | +if [ "$DOCKER" = yes ]; then | ||
234 | + # build docker container including the coverity-scan tools | ||
235 | + # Put the Coverity token into a temporary file that only | ||
236 | + # we have read access to, and then pass it to docker build | ||
237 | + # using --secret. This requires at least Docker 18.09. | ||
238 | + # Mostly what we are trying to do here is ensure we don't leak | ||
239 | + # the token into the Docker image. | ||
240 | + umask 077 | ||
241 | + SECRETDIR=$(mktemp -d) | ||
242 | + if [ -z "$SECRETDIR" ]; then | ||
243 | + echo "Failed to create temporary directory" | ||
244 | + exit 1 | ||
245 | + fi | ||
246 | + trap 'rm -rf "$SECRETDIR"' INT TERM EXIT | ||
247 | + echo "Created temporary directory $SECRETDIR" | ||
248 | + SECRET="$SECRETDIR/token" | ||
249 | + echo "$COVERITY_TOKEN" > "$SECRET" | ||
250 | + echo "Building docker container..." | ||
251 | + # TODO: This re-downloads the tools every time, rather than | ||
252 | + # caching and reusing the image produced with the downloaded tools. | ||
253 | + # Not sure why. | ||
254 | + # TODO: how do you get 'docker build' to print the output of the | ||
255 | + # commands it is running to its stdout? This would be useful for debug. | ||
256 | + DOCKER_BUILDKIT=1 docker build -t coverity-scanner \ | ||
257 | + --secret id=coverity.token,src="$SECRET" \ | ||
258 | + -f scripts/coverity-scan/coverity-scan.docker \ | ||
259 | + scripts/coverity-scan | ||
260 | + echo "Archiving sources to be analyzed..." | ||
261 | + ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz" | ||
262 | + if [ "$DRYRUN" = yes ]; then | ||
263 | + DRYRUNARG=--dry-run | ||
264 | + fi | ||
265 | + echo "Running scanner..." | ||
266 | + # If we need to capture the output tarball, get the inner run to | ||
267 | + # save it to the secrets directory so we can copy it out before the | ||
268 | + # directory is cleaned up. | ||
269 | + if [ ! -z "$RESULTSTARBALL" ]; then | ||
270 | + RTARGS="--results-tarball /work/cov-int.tar.xz" | ||
271 | + else | ||
272 | + RTARGS="" | ||
273 | + fi | ||
274 | + # Arrange for this docker run to get access to the sources with -v. | ||
275 | + # We pass through all the configuration from the outer script to the inner. | ||
276 | + export COVERITY_EMAIL COVERITY_BUILD_CMD | ||
277 | + docker run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \ | ||
278 | + -v "$SECRETDIR:/work" coverity-scanner \ | ||
279 | + ./run-coverity-scan --version "$VERSION" \ | ||
280 | + --description "$DESCRIPTION" $DRYRUNARG --tokenfile /work/token \ | ||
281 | + --srcdir /qemu --src-tarball /work/qemu-sources.tgz $RTARGS | ||
282 | + if [ ! -z "$RESULTSTARBALL" ]; then | ||
283 | + echo "Copying results tarball to $RESULTSTARBALL..." | ||
284 | + cp "$SECRETDIR/cov-int.tar.xz" "$RESULTSTARBALL" | ||
285 | + fi | ||
286 | + echo "Docker work complete." | ||
287 | + exit 0 | ||
288 | +fi | ||
289 | + | ||
290 | +# Otherwise, continue with the full build and upload process. | ||
291 | + | ||
292 | check_upload_permissions | ||
293 | |||
294 | update_coverity_tools | ||
295 | -- | ||
296 | 2.20.1 | ||
297 | |||
298 | diff view generated by jsdifflib |
1 | In the virt machine, we support TrustZone being either present or | 1 | The documentation of our -s and -gdb options is quite old; in |
---|---|---|---|
2 | absent, and so the code must deal with the secure_sysmem pointer | 2 | particular it still claims that it will cause QEMU to stop and wait |
3 | possibly being NULL. In the sbsa-ref machine, TrustZone is always | 3 | for the gdb connection, when this has not been true for some time: |
4 | present, but some code and comments copied from virt still treat | 4 | you also need to pass -S if you want to make QEMU not launch the |
5 | it as possibly not being present. | 5 | guest on startup. |
6 | 6 | ||
7 | This causes Coverity to complain (CID 1407287) that we check | 7 | Improve the documentation to mention this requirement in the |
8 | secure_sysmem for being NULL after an unconditional dereference. | 8 | executable's --help output, the documentation of the -gdb option in |
9 | Simplify the code so that instead of initializing the variable | 9 | the manual, and in the "GDB usage" chapter. |
10 | to NULL, unconditionally assigning it, and then testing it for NULL, | 10 | |
11 | we just initialize it correctly in the variable declaration and | 11 | Includes some minor tweaks to these paragraphs of documentation |
12 | then assume it to be non-NULL. We also delete a comment which | 12 | since I was editing them anyway (such as dropping the description |
13 | only applied to the non-TrustZone config. | 13 | of our gdb support as "primitive"). |
14 | 14 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
17 | Message-id: 20190704142004.7150-1-peter.maydell@linaro.org | 17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
18 | Tested-by: Radosław Biernacki <radoslaw.biernacki@linaro.org> | 18 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
19 | Reviewed-by: Radosław Biernacki <radoslaw.biernacki@linaro.org> | 19 | Message-id: 20200403094014.9589-1-peter.maydell@linaro.org |
20 | --- | 20 | --- |
21 | hw/arm/sbsa-ref.c | 8 ++------ | 21 | docs/system/gdb.rst | 22 +++++++++++++++------- |
22 | 1 file changed, 2 insertions(+), 6 deletions(-) | 22 | qemu-options.hx | 24 ++++++++++++++++++------ |
23 | 2 files changed, 33 insertions(+), 13 deletions(-) | ||
23 | 24 | ||
24 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | 25 | diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst |
25 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/arm/sbsa-ref.c | 27 | --- a/docs/system/gdb.rst |
27 | +++ b/hw/arm/sbsa-ref.c | 28 | +++ b/docs/system/gdb.rst |
28 | @@ -XXX,XX +XXX,XX @@ static void sbsa_flash_map(SBSAMachineState *sms, | 29 | @@ -XXX,XX +XXX,XX @@ |
29 | * sysmem is the system memory space. secure_sysmem is the secure view | 30 | GDB usage |
30 | * of the system, and the first flash device should be made visible only | 31 | --------- |
31 | * there. The second flash device is visible to both secure and nonsecure. | 32 | |
32 | - * If sysmem == secure_sysmem this means there is no separate Secure | 33 | -QEMU has a primitive support to work with gdb, so that you can do |
33 | - * address space and both flash devices are generally visible. | 34 | -'Ctrl-C' while the virtual machine is running and inspect its state. |
34 | */ | 35 | +QEMU supports working with gdb via gdb's remote-connection facility |
35 | hwaddr flashsize = sbsa_ref_memmap[SBSA_FLASH].size / 2; | 36 | +(the "gdbstub"). This allows you to debug guest code in the same |
36 | hwaddr flashbase = sbsa_ref_memmap[SBSA_FLASH].base; | 37 | +way that you might with a low-level debug facility like JTAG |
37 | @@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine) | 38 | +on real hardware. You can stop and start the virtual machine, |
38 | SBSAMachineState *sms = SBSA_MACHINE(machine); | 39 | +examine state like registers and memory, and set breakpoints and |
39 | MachineClass *mc = MACHINE_GET_CLASS(machine); | 40 | +watchpoints. |
40 | MemoryRegion *sysmem = get_system_memory(); | 41 | |
41 | - MemoryRegion *secure_sysmem = NULL; | 42 | -In order to use gdb, launch QEMU with the '-s' option. It will wait for |
42 | + MemoryRegion *secure_sysmem = g_new(MemoryRegion, 1); | 43 | -a gdb connection: |
43 | MemoryRegion *ram = g_new(MemoryRegion, 1); | 44 | +In order to use gdb, launch QEMU with the ``-s`` and ``-S`` options. |
44 | bool firmware_loaded; | 45 | +The ``-s`` option will make QEMU listen for an incoming connection |
45 | const CPUArchIdList *possible_cpus; | 46 | +from gdb on TCP port 1234, and ``-S`` will make QEMU not start the |
46 | @@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine) | 47 | +guest until you tell it to from gdb. (If you want to specify which |
47 | * containing the system memory at low priority; any secure-only | 48 | +TCP port to use or to use something other than TCP for the gdbstub |
48 | * devices go in at higher priority and take precedence. | 49 | +connection, use the ``-gdb dev`` option instead of ``-s``.) |
49 | */ | 50 | |
50 | - secure_sysmem = g_new(MemoryRegion, 1); | 51 | .. parsed-literal:: |
51 | memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory", | 52 | |
52 | UINT64_MAX); | 53 | - |qemu_system| -s -kernel bzImage -hda rootdisk.img -append "root=/dev/hda" |
53 | memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1); | 54 | - Connected to host network interface: tun0 |
54 | 55 | - Waiting gdb connection on port 1234 | |
55 | - firmware_loaded = sbsa_firmware_init(sms, sysmem, | 56 | + |qemu_system| -s -S -kernel bzImage -hda rootdisk.img -append "root=/dev/hda" |
56 | - secure_sysmem ?: sysmem); | 57 | + |
57 | + firmware_loaded = sbsa_firmware_init(sms, sysmem, secure_sysmem); | 58 | +QEMU will launch but will silently wait for gdb to connect. |
58 | 59 | ||
59 | if (machine->kernel_filename && firmware_loaded) { | 60 | Then launch gdb on the 'vmlinux' executable:: |
60 | error_report("sbsa-ref: No fw_cfg device on this machine, " | 61 | |
62 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/qemu-options.hx | ||
65 | +++ b/qemu-options.hx | ||
66 | @@ -XXX,XX +XXX,XX @@ SRST | ||
67 | ERST | ||
68 | |||
69 | DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \ | ||
70 | - "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL) | ||
71 | + "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n" | ||
72 | + " the guest without waiting for gdb to connect; use -S too\n" | ||
73 | + " if you want it to not start execution.)\n", | ||
74 | + QEMU_ARCH_ALL) | ||
75 | SRST | ||
76 | ``-gdb dev`` | ||
77 | - Wait for gdb connection on device dev (see | ||
78 | - :ref:`gdb_005fusage`). Typical connections will likely be | ||
79 | - TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable | ||
80 | - use case. The latter is allowing to start QEMU from within gdb and | ||
81 | - establish the connection via a pipe: | ||
82 | + Accept a gdb connection on device dev (see | ||
83 | + :ref:`gdb_005fusage`). Note that this option does not pause QEMU | ||
84 | + execution -- if you want QEMU to not start the guest until you | ||
85 | + connect with gdb and issue a ``continue`` command, you will need to | ||
86 | + also pass the ``-S`` option to QEMU. | ||
87 | + | ||
88 | + The most usual configuration is to listen on a local TCP socket:: | ||
89 | + | ||
90 | + -gdb tcp::3117 | ||
91 | + | ||
92 | + but you can specify other backends; UDP, pseudo TTY, or even stdio | ||
93 | + are all reasonable use cases. For example, a stdio connection | ||
94 | + allows you to start QEMU from within gdb and establish the | ||
95 | + connection via a pipe: | ||
96 | |||
97 | .. parsed-literal:: | ||
98 | |||
61 | -- | 99 | -- |
62 | 2.20.1 | 100 | 2.20.1 |
63 | 101 | ||
64 | 102 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | If we are not making warnings fatal for compilation, make them | ||
2 | non-fatal when building the Sphinx documentation also. (For instance | ||
3 | Sphinx 3.0 warns about some constructs that older versions were happy | ||
4 | with, which is a build failure if we use the warnings-as-errors | ||
5 | flag.) | ||
1 | 6 | ||
7 | This provides a workaround at least for LP:1872113. | ||
8 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20200411182934.28678-2-peter.maydell@linaro.org | ||
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
13 | --- | ||
14 | configure | 9 ++++++++- | ||
15 | Makefile | 2 +- | ||
16 | 2 files changed, 9 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/configure b/configure | ||
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/configure | ||
21 | +++ b/configure | ||
22 | @@ -XXX,XX +XXX,XX @@ if check_include sys/kcov.h ; then | ||
23 | kcov=yes | ||
24 | fi | ||
25 | |||
26 | +# If we're making warnings fatal, apply this to Sphinx runs as well | ||
27 | +sphinx_werror="" | ||
28 | +if test "$werror" = "yes"; then | ||
29 | + sphinx_werror="-W" | ||
30 | +fi | ||
31 | + | ||
32 | # Check we have a new enough version of sphinx-build | ||
33 | has_sphinx_build() { | ||
34 | # This is a bit awkward but works: create a trivial document and | ||
35 | @@ -XXX,XX +XXX,XX @@ has_sphinx_build() { | ||
36 | # sphinx-build doesn't exist at all or if it is too old. | ||
37 | mkdir -p "$TMPDIR1/sphinx" | ||
38 | touch "$TMPDIR1/sphinx/index.rst" | ||
39 | - "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 | ||
40 | + "$sphinx_build" $sphinx_werror -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 | ||
41 | } | ||
42 | |||
43 | # Check if tools are available to build documentation. | ||
44 | @@ -XXX,XX +XXX,XX @@ echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak | ||
45 | echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak | ||
46 | echo "PYTHON=$python" >> $config_host_mak | ||
47 | echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak | ||
48 | +echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak | ||
49 | echo "GENISOIMAGE=$genisoimage" >> $config_host_mak | ||
50 | echo "CC=$cc" >> $config_host_mak | ||
51 | if $iasl -h > /dev/null 2>&1; then | ||
52 | diff --git a/Makefile b/Makefile | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/Makefile | ||
55 | +++ b/Makefile | ||
56 | @@ -XXX,XX +XXX,XX @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ | ||
57 | # Note the use of different doctree for each (manual, builder) tuple; | ||
58 | # this works around Sphinx not handling parallel invocation on | ||
59 | # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 | ||
60 | -build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") | ||
61 | +build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") | ||
62 | # We assume all RST files in the manual's directory are used in it | ||
63 | manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ | ||
64 | $(SRC_PATH)/docs/defs.rst.inc \ | ||
65 | -- | ||
66 | 2.20.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | When kernel-doc generates a 'c:function' directive for a function | ||
2 | one of whose arguments is a function pointer, it fails to print | ||
3 | the close-paren after the argument list of the function pointer | ||
4 | argument, for instance in the memory API documentation: | ||
5 | .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) | ||
1 | 6 | ||
7 | which should have a ')' after the 'void *host' which is the | ||
8 | last argument to 'resized'. | ||
9 | |||
10 | Older versions of Sphinx don't try to parse the argumnet | ||
11 | to c:function, but Sphinx 3.0 does do this and will complain: | ||
12 | |||
13 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters | ||
14 | Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208] | ||
15 | void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) | ||
16 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ | ||
17 | |||
18 | Add the missing close-paren. | ||
19 | |||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
22 | Message-id: 20200411182934.28678-3-peter.maydell@linaro.org | ||
23 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
24 | --- | ||
25 | scripts/kernel-doc | 2 +- | ||
26 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
27 | |||
28 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc | ||
29 | index XXXXXXX..XXXXXXX 100755 | ||
30 | --- a/scripts/kernel-doc | ||
31 | +++ b/scripts/kernel-doc | ||
32 | @@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) { | ||
33 | |||
34 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | ||
35 | # pointer-to-function | ||
36 | - print $1 . $parameter . ") (" . $2; | ||
37 | + print $1 . $parameter . ") (" . $2 . ")"; | ||
38 | } else { | ||
39 | print $type . " " . $parameter; | ||
40 | } | ||
41 | -- | ||
42 | 2.20.1 | ||
43 | |||
44 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | The kernel-doc Sphinx plugin and associated script currently emit |
---|---|---|---|
2 | 'c:type' directives for "struct foo" documentation. | ||
2 | 3 | ||
3 | In commit e9d652824b0 we extracted the vfp_set_fpscr_to_host() | 4 | Sphinx 3.0 warns about this: |
4 | function but failed at calling it in the correct place, we call | 5 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:3: WARNING: Type must be either just a name or a typedef-like declaration. |
5 | it after xregs[ARM_VFP_FPSCR] is modified. | 6 | If just a name: |
7 | Error in declarator or parameters | ||
8 | Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6] | ||
9 | struct MemoryListener | ||
10 | ------^ | ||
11 | If typedef-like declaration: | ||
12 | Error in declarator or parameters | ||
13 | Invalid C declaration: Expected identifier in nested name. [error at 21] | ||
14 | struct MemoryListener | ||
15 | ---------------------^ | ||
6 | 16 | ||
7 | Fix by calling this function before we update FPSCR. | 17 | because it wants us to use the new-in-3.0 'c:struct' instead. |
8 | 18 | ||
9 | Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 19 | Plumb the Sphinx version through to the kernel-doc script |
10 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 20 | and use it to select 'c:struct' for newer versions than 3.0. |
11 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 21 | |
12 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 22 | Fixes: LP:1872113 |
13 | Message-id: 20190705124318.1075-1-philmd@redhat.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
15 | --- | 25 | --- |
16 | target/arm/vfp_helper.c | 4 ++-- | 26 | docs/sphinx/kerneldoc.py | 1 + |
17 | 1 file changed, 2 insertions(+), 2 deletions(-) | 27 | scripts/kernel-doc | 16 +++++++++++++++- |
28 | 2 files changed, 16 insertions(+), 1 deletion(-) | ||
18 | 29 | ||
19 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c | 30 | diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py |
20 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/vfp_helper.c | 32 | --- a/docs/sphinx/kerneldoc.py |
22 | +++ b/target/arm/vfp_helper.c | 33 | +++ b/docs/sphinx/kerneldoc.py |
23 | @@ -XXX,XX +XXX,XX @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) | 34 | @@ -XXX,XX +XXX,XX @@ class KernelDocDirective(Directive): |
24 | val &= 0xf7c0009f; | 35 | env.note_dependency(os.path.abspath(f)) |
25 | } | 36 | cmd += ['-export-file', f] |
26 | 37 | ||
27 | + vfp_set_fpscr_to_host(env, val); | 38 | + cmd += ['-sphinx-version', sphinx.__version__] |
28 | + | 39 | cmd += [filename] |
29 | /* | 40 | |
30 | * We don't implement trapped exception handling, so the | 41 | try: |
31 | * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!) | 42 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc |
32 | @@ -XXX,XX +XXX,XX @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) | 43 | index XXXXXXX..XXXXXXX 100755 |
33 | env->vfp.qc[1] = 0; | 44 | --- a/scripts/kernel-doc |
34 | env->vfp.qc[2] = 0; | 45 | +++ b/scripts/kernel-doc |
35 | env->vfp.qc[3] = 0; | 46 | @@ -XXX,XX +XXX,XX @@ Output selection (mutually exclusive): |
36 | - | 47 | DOC: sections. May be specified multiple times. |
37 | - vfp_set_fpscr_to_host(env, val); | 48 | |
38 | } | 49 | Output selection modifiers: |
39 | 50 | + -sphinx-version VER Generate rST syntax for the specified Sphinx version. | |
40 | void vfp_set_fpscr(CPUARMState *env, uint32_t val) | 51 | + Only works with reStructuredTextFormat. |
52 | -no-doc-sections Do not output DOC: sections. | ||
53 | -enable-lineno Enable output of #define LINENO lines. Only works with | ||
54 | reStructuredText format. | ||
55 | @@ -XXX,XX +XXX,XX @@ use constant { | ||
56 | }; | ||
57 | my $output_selection = OUTPUT_ALL; | ||
58 | my $show_not_found = 0; # No longer used | ||
59 | +my $sphinx_version = "0.0"; # if not specified, assume old | ||
60 | |||
61 | my @export_file_list; | ||
62 | |||
63 | @@ -XXX,XX +XXX,XX @@ while ($ARGV[0] =~ m/^--?(.*)/) { | ||
64 | $enable_lineno = 1; | ||
65 | } elsif ($cmd eq 'show-not-found') { | ||
66 | $show_not_found = 1; # A no-op but don't fail | ||
67 | + } elsif ($cmd eq 'sphinx-version') { | ||
68 | + $sphinx_version = shift @ARGV; | ||
69 | } else { | ||
70 | # Unknown argument | ||
71 | usage(); | ||
72 | @@ -XXX,XX +XXX,XX @@ sub output_struct_rst(%) { | ||
73 | my $oldprefix = $lineprefix; | ||
74 | my $name = $args{'type'} . " " . $args{'struct'}; | ||
75 | |||
76 | - print "\n\n.. c:type:: " . $name . "\n\n"; | ||
77 | + # Sphinx 3.0 and up will emit warnings for "c:type:: struct Foo". | ||
78 | + # It wants to see "c:struct:: Foo" (and will add the word 'struct' in | ||
79 | + # the rendered output). | ||
80 | + if ((split(/\./, $sphinx_version))[0] >= 3) { | ||
81 | + my $sname = $name; | ||
82 | + $sname =~ s/^struct //; | ||
83 | + print "\n\n.. c:struct:: " . $sname . "\n\n"; | ||
84 | + } else { | ||
85 | + print "\n\n.. c:type:: " . $name . "\n\n"; | ||
86 | + } | ||
87 | print_lineno($declaration_start_line); | ||
88 | $lineprefix = " "; | ||
89 | output_highlight_rst($args{'purpose'}); | ||
41 | -- | 90 | -- |
42 | 2.20.1 | 91 | 2.20.1 |
43 | 92 | ||
44 | 93 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Versions of Sphinx older than 1.6 can't build all of our documentation, |
---|---|---|---|
2 | because they are too picky about the syntax of the argument to the | ||
3 | option:: directive; see Sphinx bugs #646, #3366: | ||
2 | 4 | ||
3 | Off by one error in the EL2 and EL3 tests. Remove the test | 5 | https://github.com/sphinx-doc/sphinx/issues/646 |
4 | against EL3 entirely, since it must always be true. | 6 | https://github.com/sphinx-doc/sphinx/issues/3366 |
5 | 7 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Trying to build with a 1.4.x Sphinx fails with |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | docs/system/images.rst:4: SEVERE: Duplicate ID: "cmdoption-qcow2-arg-encrypt" |
8 | Message-id: 20190702104732.31154-1-richard.henderson@linaro.org | 10 | and a 1.5.x Sphinx fails with |
11 | docs/system/invocation.rst:544: WARNING: Malformed option description '[enable=]PATTERN', should look like "opt", "-opt | ||
12 | args", "--opt args", "/opt args" or "+opt args" | ||
13 | |||
14 | Update our needs_sphinx setting to indicate that we require at least | ||
15 | 1.6. This will allow configure to fall back to "don't build the | ||
16 | docs" rather than causing the build to fail entirely, which is | ||
17 | probably what most users building on a host old enough to have such | ||
18 | an old Sphinx would want; if they do want the docs then they'll have | ||
19 | a useful indication of what they need to do (upgrade Sphinx!) rather | ||
20 | than a confusing error message. | ||
21 | |||
22 | In theory our distro support policy would suggest that we should | ||
23 | support building on the Sphinx shipped in those distros, but: | ||
24 | * EPEL7 has Sphinx 1.2.3 (which we've never supported!) | ||
25 | * Debian Stretch has Sphinx 1.4.8 | ||
26 | |||
27 | Trying to get our docs to work with Sphinx 1.4 is not tractable | ||
28 | for the 5.0 release and I'm not sure it's worthwhile effort anyway; | ||
29 | at least with this change the build as a whole now succeeds. | ||
30 | |||
31 | Thanks to John Snow for doing the investigation and testing to | ||
32 | confirm what Sphinx versions fail in what ways and what distros | ||
33 | shipped what. | ||
34 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
36 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | 37 | --- |
11 | target/arm/helper.c | 4 ++-- | 38 | docs/conf.py | 6 ++++-- |
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | 39 | 1 file changed, 4 insertions(+), 2 deletions(-) |
13 | 40 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 41 | diff --git a/docs/conf.py b/docs/conf.py |
15 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 43 | --- a/docs/conf.py |
17 | +++ b/target/arm/helper.c | 44 | +++ b/docs/conf.py |
18 | @@ -XXX,XX +XXX,XX @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) | 45 | @@ -XXX,XX +XXX,XX @@ sys.path.insert(0, os.path.join(qemu_docdir, "sphinx")) |
19 | if (el <= 1) { | 46 | |
20 | zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]); | 47 | # If your documentation needs a minimal Sphinx version, state it here. |
21 | } | 48 | # |
22 | - if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) { | 49 | -# 1.3 is where the 'alabaster' theme was shipped with Sphinx. |
23 | + if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) { | 50 | -needs_sphinx = '1.3' |
24 | zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]); | 51 | +# Sphinx 1.5 and earlier can't build our docs because they are too |
25 | } | 52 | +# picky about the syntax of the argument to the option:: directive |
26 | - if (el < 3 && arm_feature(env, ARM_FEATURE_EL3)) { | 53 | +# (see Sphinx bugs #646, #3366). |
27 | + if (arm_feature(env, ARM_FEATURE_EL3)) { | 54 | +needs_sphinx = '1.6' |
28 | zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]); | 55 | |
29 | } | 56 | # Add any Sphinx extension module names here, as strings. They can be |
30 | return zcr_len; | 57 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
31 | -- | 58 | -- |
32 | 2.20.1 | 59 | 2.20.1 |
33 | 60 | ||
34 | 61 | diff view generated by jsdifflib |
1 | The test aarch64 kernel is in an array defined with | 1 | The Linux kernel has dropped support for allowing 32-bit Arm systems |
---|---|---|---|
2 | unsigned char aarch64_kernel[] = { [...] } | 2 | to host KVM guests (kernel commit 541ad0150ca4aa663a2, which just |
3 | 3 | landed upstream in the 5.7 merge window). Mark QEMU's support for | |
4 | which means it could be any size; currently it's quite small. | 4 | this configuration as deprecated, so that we can delete that support |
5 | However we write it to a file using init_bootfile(), which | 5 | code in 5.2. |
6 | writes exactly 512 bytes to the file. This will break if | ||
7 | we ever end up with a kernel larger than that, and will | ||
8 | read garbage off the end of the array in the current setup | ||
9 | where the kernel is smaller. | ||
10 | |||
11 | Make init_bootfile() take an argument giving the length of | ||
12 | the data to write. This allows us to use it for all architectures | ||
13 | (previously s390 had a special-purpose init_bootfile_s390x | ||
14 | which hardcoded the file to write so it could write the | ||
15 | correct length). We assert that the x86 bootfile really is | ||
16 | exactly 512 bytes as it should be (and as we were previously | ||
17 | just assuming it was). | ||
18 | |||
19 | This was detected by the clang-7 asan: | ||
20 | ==15607==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55a796f51d20 at pc 0x55a796b89c2f bp 0x7ffc58e89160 sp 0x7ffc58e88908 | ||
21 | READ of size 512 at 0x55a796f51d20 thread T0 | ||
22 | #0 0x55a796b89c2e in fwrite (/home/petmay01/linaro/qemu-from-laptop/qemu/build/sanitizers/tests/migration-test+0xb0c2e) | ||
23 | #1 0x55a796c46492 in init_bootfile /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:99:5 | ||
24 | #2 0x55a796c46492 in test_migrate_start /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:593 | ||
25 | #3 0x55a796c44101 in test_baddest /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:854:9 | ||
26 | #4 0x7f906ffd3cc9 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72cc9) | ||
27 | #5 0x7f906ffd3bfa (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72bfa) | ||
28 | #6 0x7f906ffd3bfa (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72bfa) | ||
29 | #7 0x7f906ffd3ea1 in g_test_run_suite (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72ea1) | ||
30 | #8 0x7f906ffd3ec0 in g_test_run (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72ec0) | ||
31 | #9 0x55a796c43707 in main /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:1187:11 | ||
32 | #10 0x7f906e9abb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 | ||
33 | #11 0x55a796b6c2d9 in _start (/home/petmay01/linaro/qemu-from-laptop/qemu/build/sanitizers/tests/migration-test+0x932d9) | ||
34 | 6 | ||
35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
36 | Reviewed-by: Laurent Vivier <lvivier@redhat.com> | 8 | Reviewed-by: Andrew Jones <drjones@redhat.com> |
37 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
38 | Message-id: 20190702150311.20467-1-peter.maydell@linaro.org | ||
39 | --- | 9 | --- |
40 | tests/migration-test.c | 22 +++++++--------------- | 10 | docs/system/deprecated.rst | 8 ++++++++ |
41 | 1 file changed, 7 insertions(+), 15 deletions(-) | 11 | 1 file changed, 8 insertions(+) |
42 | 12 | ||
43 | diff --git a/tests/migration-test.c b/tests/migration-test.c | 13 | diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst |
44 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/tests/migration-test.c | 15 | --- a/docs/system/deprecated.rst |
46 | +++ b/tests/migration-test.c | 16 | +++ b/docs/system/deprecated.rst |
47 | @@ -XXX,XX +XXX,XX @@ static const char *tmpfs; | 17 | @@ -XXX,XX +XXX,XX @@ The ``compat`` property used to set backwards compatibility modes for |
48 | */ | 18 | the processor has been deprecated. The ``max-cpu-compat`` property of |
49 | #include "tests/migration/i386/a-b-bootblock.h" | 19 | the ``pseries`` machine type should be used instead. |
50 | #include "tests/migration/aarch64/a-b-kernel.h" | 20 | |
51 | - | 21 | +KVM guest support on 32-bit Arm hosts (since 5.0) |
52 | -static void init_bootfile(const char *bootpath, void *content) | 22 | +''''''''''''''''''''''''''''''''''''''''''''''''' |
53 | -{ | 23 | + |
54 | - FILE *bootfile = fopen(bootpath, "wb"); | 24 | +The Linux kernel has dropped support for allowing 32-bit Arm systems |
55 | - | 25 | +to host KVM guests as of the 5.7 kernel. Accordingly, QEMU is deprecating |
56 | - g_assert_cmpint(fwrite(content, 512, 1, bootfile), ==, 1); | 26 | +its support for this configuration and will remove it in a future version. |
57 | - fclose(bootfile); | 27 | +Running 32-bit guests on a 64-bit Arm host remains supported. |
58 | -} | 28 | + |
59 | - | 29 | System emulator devices |
60 | #include "tests/migration/s390x/a-b-bios.h" | 30 | ----------------------- |
61 | 31 | ||
62 | -static void init_bootfile_s390x(const char *bootpath) | ||
63 | +static void init_bootfile(const char *bootpath, void *content, size_t len) | ||
64 | { | ||
65 | FILE *bootfile = fopen(bootpath, "wb"); | ||
66 | - size_t len = sizeof(s390x_elf); | ||
67 | |||
68 | - g_assert_cmpint(fwrite(s390x_elf, len, 1, bootfile), ==, 1); | ||
69 | + g_assert_cmpint(fwrite(content, len, 1, bootfile), ==, 1); | ||
70 | fclose(bootfile); | ||
71 | } | ||
72 | |||
73 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, | ||
74 | got_stop = false; | ||
75 | bootpath = g_strdup_printf("%s/bootsect", tmpfs); | ||
76 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { | ||
77 | - init_bootfile(bootpath, x86_bootsect); | ||
78 | + /* the assembled x86 boot sector should be exactly one sector large */ | ||
79 | + assert(sizeof(x86_bootsect) == 512); | ||
80 | + init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); | ||
81 | extra_opts = use_shmem ? get_shmem_opts("150M", shmem_path) : NULL; | ||
82 | cmd_src = g_strdup_printf("-machine accel=%s -m 150M" | ||
83 | " -name source,debug-threads=on" | ||
84 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, | ||
85 | start_address = X86_TEST_MEM_START; | ||
86 | end_address = X86_TEST_MEM_END; | ||
87 | } else if (g_str_equal(arch, "s390x")) { | ||
88 | - init_bootfile_s390x(bootpath); | ||
89 | + init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); | ||
90 | extra_opts = use_shmem ? get_shmem_opts("128M", shmem_path) : NULL; | ||
91 | cmd_src = g_strdup_printf("-machine accel=%s -m 128M" | ||
92 | " -name source,debug-threads=on" | ||
93 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, | ||
94 | start_address = PPC_TEST_MEM_START; | ||
95 | end_address = PPC_TEST_MEM_END; | ||
96 | } else if (strcmp(arch, "aarch64") == 0) { | ||
97 | - init_bootfile(bootpath, aarch64_kernel); | ||
98 | + init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); | ||
99 | extra_opts = use_shmem ? get_shmem_opts("150M", shmem_path) : NULL; | ||
100 | cmd_src = g_strdup_printf("-machine virt,accel=%s,gic-version=max " | ||
101 | "-name vmsource,debug-threads=on -cpu max " | ||
102 | -- | 32 | -- |
103 | 2.20.1 | 33 | 2.20.1 |
104 | 34 | ||
105 | 35 | diff view generated by jsdifflib |