aboutsummaryrefslogtreecommitdiff
path: root/contrib
AgeCommit message (Collapse)AuthorFilesLines
2022-04-06Replace qemu_real_host_page variables with inlined functionsMarc-André Lureau1-1/+1
Replace the global variables with inlined helper functions. getpagesize() is very likely annotated with a "const" function attribute (at least with glibc), and thus optimization should apply even better. This avoids the need for a constructor initialization too. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-12-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-23mailmap/gitdm: more fixes for bad tags and authorsAlex Bennée1-1/+3
I was running some historical tags for the last 10 years and got the following warnings: git log --use-mailmap --numstat --since "June 2010" | ~/src/gitdm.git/gitdm -n -l 5 alarson@ddci.com is an author name, probably not what you want bad utf-8 ('utf-8' codec can't decode byte 0xe4 in position 552: invalid continuation byte) in patchm skipping bad utf-8 ('utf-8' codec can't decode byte 0xe4 in position 342: invalid continuation byte) in patchm skipping michael@ozlabs.org is an author name, probably not what you want Oops...funky email nicta.com.au bad utf-8 ('utf-8' codec can't decode byte 0xe9 in position 232: invalid continuation byte) in patchm skipping Oops...funky email andreas.faerber Grabbing changesets...done Processed 76422 csets from 1902 developers The following fixes try and alleviate that although I still get a warning for Aaron which I think is from 9743cd5736. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220315121251.2280317-6-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Aaron Larson <alarson@ddci.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Cc: Andreas Färber <andreas.faerber@web.de> Cc: Jason Wang <jasowang@redhat.com>
2022-03-21Use g_new() & friends where that makes obvious senseMarkus Armbruster1-1/+1
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Patch created mechanically with: $ spatch --in-place --sp-file scripts/coccinelle/use-g_new-etc.cocci \ --macro-file scripts/cocci-macro-file.h FILES... Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20220315144156.1595462-4-armbru@redhat.com> Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
2022-02-21meson: refine check for whether to look for virglrendererPaolo Bonzini1-2/+1
The check should be performed even if !have_system, as long as there is some hope that vhost-user-gpu will be built. Store into have_vhost_user_gpu whether vhost-user-gpu will be built; we will also use the variable to decide whether to look for libepoxy. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-21configure, meson: move guest-agent, tools to mesonPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-09contrib/plugins: add a drcov pluginIvanov Arkady2-0/+164
This patch adds the ability to generate files in drcov format. Primary goal this script is to have coverage logfiles thatwork in Lighthouse. Signed-off-by: Ivanov Arkady <arkadiy.ivanov@ispras.ru> Message-Id: <163491884553.304355.13246023070235438959.stgit@pc-System-Product-Name> [AJB: use g_ptr_array instead of slist] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220204204335.1689602-23-alex.bennee@linaro.org>
2022-01-12meson: build contrib/ executables after generated headersPaolo Bonzini4-4/+4
This will be needed as soon as config-poison.h moves from configure to a meson custom_target (which is built at "ninja" time). Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-04plugins/cache: make L2 emulation optional through argsMahmoud Mandour1-22/+54
By default L2 is not enabled and is enabled by either using the newly-introduced "l2" boolean argument, or by setting any of the L2 cache parameters using args. On specifying "l2=on", the default cache configuration is used. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210810134844.166490-5-ma.mandourr@gmail.com> Message-Id: <20211026102234.3961636-17-alex.bennee@linaro.org>
2021-11-04plugins/cache: split command line arguments into name and valueMahmoud Mandour1-27/+30
This way of handling args is more lenient and sets a better framework to parse boolean command line arguments. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210810134844.166490-4-ma.mandourr@gmail.com> Message-Id: <20211026102234.3961636-16-alex.bennee@linaro.org>
2021-11-04plugins/cache: implement unified L2 cache emulationMahmoud Mandour1-81/+175
This adds an implementation of a simple L2 configuration, in which a unified L2 cache (stores both blocks of instructions and data) is maintained for each core separately, with no inter-core interaction taken in account. The L2 cache is used as a backup for L1 and is only accessed if the wanted block does not exist in L1. In terms of multi-threaded user-space emulation, the same approximation of L1 is done, a static number of caches is maintained, and each and every memory access initiated by a thread will have to go through one of the available caches. An atomic increment is used to maintain the number of L2 misses per instruction. The default cache parameters of L2 caches is: 2MB cache size 16-way associativity 64-byte blocks Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210810134844.166490-3-ma.mandourr@gmail.com> Message-Id: <20211026102234.3961636-15-alex.bennee@linaro.org>
2021-11-04plugins/cache: freed heap-allocated mutexesMahmoud Mandour1-0/+3
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210810134844.166490-2-ma.mandourr@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20211026102234.3961636-14-alex.bennee@linaro.org>
2021-09-20elf2dmp: Fail cleanly if PDB file specifies zero block_sizePeter Maydell1-0/+4
Coverity points out that if the PDB file we're trying to read has a header specifying a block_size of zero then we will end up trying to divide by zero in pdb_ds_read_file(). Check for this and fail cleanly instead. Fixes: Coverity CID 1458869 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20210910170656.366592-3-philmd@redhat.com Message-Id: <20210901143910.17112-3-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2021-09-20elf2dmp: Check curl_easy_setopt() return valuePeter Maydell1-12/+10
Coverity points out that we aren't checking the return value from curl_easy_setopt(). Fixes: Coverity CID 1458895 Inspired-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20210910170656.366592-2-philmd@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-09-06configure / meson: Move the GBM handling to meson.buildThomas Huth1-3/+2
The GBM library detection does not need to be in the configure script, since it does not have any user-facing options (there are no --enable-gbm or --disable-gbm switches). Let's move it to meson.build instead, so we don't have to clutter config-host.mak with the related switches. Additionally, only check for GBM if it is really required, i.e. if we either compile with OpenGL or with virglrenderer support. Message-Id: <20210714085045.797168-1-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-09-02plugins/howvec: adapting to the new argument passing schemeMahmoud Mandour1-8/+19
Correctly parsing plugin argument since they now must be provided as full-form boolean parameters, e.g.: -plugin ./contrib/plugins/libhowvec.so,verbose=on,inline=on Also, introduced the argument "count" that accepts one opt to count individually at a time. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210730135817.17816-8-ma.mandourr@gmail.com>
2021-09-02plugins/hwprofile: adapt to the new plugin arguments schemeMahmoud Mandour1-12/+27
Parsing boolean arguments correctly (e.g. pattern=on or source=false). Introduced a new "track" argument that takes a [read|write] value. This substitutes passing read or write to "arg=" that is deprecated. Also, matches are now taken one by one through the "match" argument. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210730135817.17816-7-ma.mandourr@gmail.com>
2021-09-02plugins/lockstep: make socket path not positional & parse bool argMahmoud Mandour1-9/+22
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210730135817.17816-6-ma.mandourr@gmail.com>
2021-09-02plugins/hotblocks: Added correct boolean argument parsingMahmoud Mandour1-2/+12
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210730135817.17816-5-ma.mandourr@gmail.com>
2021-09-02plugins/hotpages: introduce sortby arg and parsed bool args correctlyMahmoud Mandour1-10/+20
Since plugin arguments now expect boolean arguments, a plugin argument name "sortby" now expects a value of "read", "write", or "address". "io" arg is now expected to be passed as a full-form boolean parameter, i.e. "io=on|true|yes|off|false|no" Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210730135817.17816-4-ma.mandourr@gmail.com>
2021-09-02plugins/cache: supported multicore cache modellingMahmoud Mandour1-44/+132
Multicore L1 cache modelling is introduced and is supported for both full system emulation and linux-user. For full-system emulation, L1 icache and dcache are maintained for each available core, since this information is exposed to the plugin through `qemu_plugin_n_vcpus()`. For linux-user, a static number of cores is assumed (default 1 core, and can be provided as a plugin argument `cores=N`). Every memory access goes through one of these caches, this approach is taken as it's somewhat akin to what happens on real setup, where a program that dispatches more threads than the available cores, they'll thrash each other Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Message-Id: <20210803151301.123581-2-ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2021-09-02plugins/execlog: removed unintended "s" at the end of log lines.Mahmoud Mandour1-1/+1
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210803151428.125323-1-ma.mandourr@gmail.com> Message-Id: <20210806141015.2487502-2-alex.bennee@linaro.org> Cc: qemu-stable@nongnu.org
2021-07-23plugins/cache: Fixed "function decl. is not a prototype" warningsMahmoud Mandour1-3/+3
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210714172151.8494-7-ma.mandourr@gmail.com> Message-Id: <20210720232703.10650-24-alex.bennee@linaro.org>
2021-07-23plugins/cache: limited the scope of a mutex lockMahmoud Mandour1-2/+1
It's not necessary to lock the address translation portion of the vcpu_mem_access callback. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210714172151.8494-3-ma.mandourr@gmail.com> Message-Id: <20210720232703.10650-23-alex.bennee@linaro.org>
2021-07-23plugins/cache: Fixed a bug with destroying FIFO metadataMahmoud Mandour1-1/+1
This manifests itself when associativity degree is greater than the number of sets and FIFO is used, otherwise it's also a memory leak whenever FIFO was used. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210714172151.8494-2-ma.mandourr@gmail.com> Message-Id: <20210720232703.10650-22-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add more individual contributor entries.Alex Bennée2-0/+6
Also ensure Li's canonical gmail address is used. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Li Qiang <liq3ea@gmail.com> Acked-by: Chetan Pant <chetan4windows@gmail.com> Acked-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210720232703.10650-20-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add a new interns group-map for GSoC/Outreachy workAlex Bennée1-0/+13
It makes sense to put our various interns in a group so we can see the overall impact of GSoC and Outreachy on the project. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Mahmoud Mandour <ma.mandourr@gmail.com> Cc: Ahmed Karaman <ahmedkhaledkaraman@gmail.com> Cc: César Belley <cesar.belley@lse.epita.fr> Message-Id: <20210720232703.10650-19-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add an explicit academic entry for BUAlex Bennée1-0/+3
For some reason Alexander's contributions were not getting grouped from the plain "edu" mapping. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20210720232703.10650-18-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add group-map for NetflixAlex Bennée1-0/+5
Warner confirmed he works for Netflix on IRC. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Warner Losh <imp@bsdimp.com> Message-Id: <20210720232703.10650-17-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add domain-map for NVIDIAAlex Bennée1-0/+1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com> Cc: Yishai Hadas <yishaih@nvidia.com> Message-Id: <20210720232703.10650-16-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add domain-map for CrudebyteAlex Bennée1-0/+1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <20210720232703.10650-15-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: un-ironically add a mapping for LWNAlex Bennée1-0/+1
I think this mainly comes from kernel-doc stuff imported into the QEMU tree. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Cc: Jonathan Corbet <corbet@lwn.net> Message-Id: <20210720232703.10650-14-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add domain-map/group-map for Wind RiverAlex Bennée2-0/+2
As per discussion at: http://patchwork.ozlabs.org/project/qemu-devel/patch/20201004180443.2035359-19-f4bug@amsat.org/ I've added Bin's personal email as an individual contributor. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Bin Meng <bin.meng@windriver.com> Cc: Ruimei Yan <ruimei.yan@windriver.com> Cc: Xuzhou Cheng <xuzhou.cheng@windriver.com> Message-Id: <20210720232703.10650-13-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add domain-map for EldoradoAlex Bennée1-0/+1
Luis acked on IRC: #qemu@znc-oftc_2021-07-13.txt:[15:00:02] <lffpires> stsquad: "eldorado.org.br Eldorado" is fine Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Luis Pires <luis.pires@eldorado.org.br> Message-Id: <20210720232703.10650-12-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add domain-map/group-map mappings for SamsungAlex Bennée2-0/+2
Minwoo's work from their personal address are treated as personal contributions. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Klaus Jensen <k.jensen@samsung.com> Cc: Gollu Appalanaidu <anaidu.gollu@samsung.com> Cc: Minwoo Im <minwoo.im.dev@gmail.com> Message-Id: <20210720232703.10650-11-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add a group mapping for robot scannersAlex Bennée1-0/+7
This mostly affects Reported-by: tags Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210720232703.10650-9-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add domain-map for MontaVistaAlex Bennée1-0/+1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Corey Minyard <cminyard@mvista.com> Message-Id: <20210720232703.10650-8-alex.bennee@linaro.org>
2021-07-23contrib/gitdm: add some new aliases to fix up commitsAlex Bennée1-0/+3
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Cc: Yuval Shaia <yuval.shaia.ml@gmail.com> Message-Id: <20210720232703.10650-6-alex.bennee@linaro.org>
2021-07-14plugins/cache: Added FIFO and LRU eviction policiesMahmoud Mandour1-13/+190
Implemented FIFO and LRU eviction policies. Now one of the three eviction policies can be chosen as an argument. On not specifying an argument, LRU is used by default. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210623125458.450462-4-ma.mandourr@gmail.com> Message-Id: <20210709143005.1554-39-alex.bennee@linaro.org>
2021-07-14plugins/cache: Enable cache parameterizationMahmoud Mandour1-1/+46
Enabled configuring both icache and dcache parameters using plugin parameters. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210623125458.450462-3-ma.mandourr@gmail.com> Message-Id: <20210709143005.1554-38-alex.bennee@linaro.org>
2021-07-14plugins: Added a new cache modelling pluginMahmoud Mandour2-0/+420
Added a cache modelling plugin that uses a static configuration used in many of the commercial microprocessors and uses random eviction policy. The purpose of the plugin is to identify the most cache-thrashing instructions for both instruction cache and data cache. Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210623125458.450462-2-ma.mandourr@gmail.com> Message-Id: <20210709143005.1554-37-alex.bennee@linaro.org>
2021-07-14contrib/plugins: add execlog to log instruction execution and memory accessAlexandre Iooss2-0/+154
Log instruction execution and memory access to a file. This plugin can be used for reverse engineering or for side-channel analysis using QEMU. Signed-off-by: Alexandre Iooss <erdnaxe@crans.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210702081307.1653644-2-erdnaxe@crans.org> Message-Id: <20210709143005.1554-35-alex.bennee@linaro.org>
2021-07-14contrib/plugins: enable -Wall for building pluginsAlex Bennée1-1/+1
Lets spot the obvious errors. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20210709143005.1554-34-alex.bennee@linaro.org>
2021-07-09meson: fix missing preprocessor symbolsPaolo Bonzini1-1/+1
While most libraries do not need a CONFIG_* symbol because the "when:" clauses are enough, some do. Add them back or stop using them if possible. In the case of libpmem, the statement to add the CONFIG_* symbol was still in configure, but could not be triggered because it checked for "no" instead of "disabled" (and it would be wrong anyway since the test for the library has not been done yet). Reported-by: Li Zhijian <lizhijian@cn.fujitsu.com> Fixes: 587d59d6cc ("configure, meson: convert virgl detection to meson", 2021-07-06) Fixes: 83ef16821a ("configure, meson: convert libdaxctl detection to meson", 2021-07-06) Fixes: e36e8c70f6 ("configure, meson: convert libpmem detection to meson", 2021-07-06) Fixes: 53c22b68e3 ("configure, meson: convert liburing detection to meson", 2021-07-06) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-15vhost-user-gpu: reorder free calls.Gerd Hoffmann1-1/+1
Free in correct order to avoid use-after-free. Resolves: CID 1453812 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210604103714.1237414-1-kraxel@redhat.com>
2021-05-27vhost-user-gpu: abstract vg_cleanup_mapping_iovLi Qiang3-9/+26
Currently in vhost-user-gpu, we free resource directly in the cleanup case of resource. If we change the cleanup logic we need to change several places, also abstruct a 'vg_create_mapping_iov' can be symmetry with the 'vg_create_mapping_iov'. This is like what virtio-gpu does, no function changed. Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210516030403.107723-9-liq3ea@163.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-27vhost-user-gpu: fix OOB write in 'virgl_cmd_get_capset' (CVE-2021-3546)Li Qiang1-0/+4
If 'virgl_cmd_get_capset' set 'max_size' to 0, the 'virgl_renderer_fill_caps' will write the data after the 'resp'. This patch avoid this by checking the returned 'max_size'. virtio-gpu fix: abd7f08b23 ("display: virtio-gpu-3d: check virgl capabilities max_size") Fixes: CVE-2021-3546 Reported-by: Li Qiang <liq3ea@163.com> Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210516030403.107723-8-liq3ea@163.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-27vhost-user-gpu: fix memory leak in 'virgl_resource_attach_backing' ↵Li Qiang1-1/+4
(CVE-2021-3544) If 'virgl_renderer_resource_attach_iov' failed, the 'res_iovs' will be leaked. Fixes: CVE-2021-3544 Reported-by: Li Qiang <liq3ea@163.com> virtio-gpu fix: 33243031da ("virtio-gpu-3d: fix memory leak in resource attach backing") Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210516030403.107723-7-liq3ea@163.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-27vhost-user-gpu: fix memory leak in 'virgl_cmd_resource_unref' (CVE-2021-3544)Li Qiang1-0/+7
The 'res->iov' will be leaked if the guest trigger following sequences: virgl_cmd_create_resource_2d virgl_resource_attach_backing virgl_cmd_resource_unref This patch fixes this. Fixes: CVE-2021-3544 Reported-by: Li Qiang <liq3ea@163.com> virtio-gpu fix: 5e8e3c4c75 ("virtio-gpu: fix resource leak in virgl_cmd_resource_unref" Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210516030403.107723-6-liq3ea@163.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-27vhost-user-gpu: fix memory leak while calling 'vg_resource_unref' ↵Li Qiang1-0/+1
(CVE-2021-3544) If the guest trigger following sequences, the attach_backing will be leaked: vg_resource_create_2d vg_resource_attach_backing vg_resource_unref This patch fix this by freeing 'res->iov' in vg_resource_destroy. Fixes: CVE-2021-3544 Reported-by: Li Qiang <liq3ea@163.com> virtio-gpu fix: 5e8e3c4c75 ("virtio-gpu: fix resource leak in virgl_cmd_resource_unref") Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210516030403.107723-5-liq3ea@163.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-27vhost-user-gpu: fix memory leak in vg_resource_attach_backing (CVE-2021-3544)Li Qiang1-0/+5
Check whether the 'res' has already been attach_backing to avoid memory leak. Fixes: CVE-2021-3544 Reported-by: Li Qiang <liq3ea@163.com> virtio-gpu fix: 204f01b309 ("virtio-gpu: fix memory leak in resource attach backing") Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210516030403.107723-4-liq3ea@163.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>