- Aug 29, 2023
-
-
Zhenwei Pi authored
'bool is_write' style is obsolete from throttle framework, adapt fsdev to the new style. Cc: Greg Kurz <groug@kaod.org> Reviewed-by:
Hanna Czenczek <hreitz@redhat.com> Signed-off-by:
zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20230728022006.1098509-9-pizhenwei@bytedance.com> Reviewed-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Hanna Czenczek <hreitz@redhat.com>
-
Zhenwei Pi authored
enum ThrottleDirection is already there, use ThrottleDirection instead of 'bool is_write' for throttle API, also modify related codes from block, fsdev, cryptodev and tests. Reviewed-by:
Hanna Czenczek <hreitz@redhat.com> Signed-off-by:
zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20230728022006.1098509-7-pizhenwei@bytedance.com> Signed-off-by:
Hanna Czenczek <hreitz@redhat.com>
-
- Jul 06, 2023
-
-
Christian Schoenebeck authored
As recent CVE-2023-2861 (fixed by f6b0de53) once again showed, the 9p 'proxy' fs driver is in bad shape. Using the 'proxy' backend was already discouraged for safety reasons before and we recommended to use the 'local' backend (preferably in conjunction with its 'mapped' security model) instead, but now it is time to officially deprecate the 'proxy' backend. Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by:
Greg Kurz <groug@kaod.org> Message-Id: <E1qDkmw-0007M1-8f@lizzy.crudebyte.com>
-
- Jun 20, 2023
-
-
Philippe Mathieu-Daudé authored
We use the user_ss[] array to hold the user emulation sources, and the softmmu_ss[] array to hold the system emulation ones. Hold the latter in the 'system_ss[]' array for parity with user emulation. Mechanical change doing: $ sed -i -e s/softmmu_ss/system_ss/g $(git grep -l softmmu_ss) Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230613133347.82210-10-philmd@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Jun 08, 2023
-
-
Christian Schoenebeck authored
The 9p protocol does not specifically define how server shall behave when client tries to open a special file, however from security POV it does make sense for 9p server to prohibit opening any special file on host side in general. A sane Linux 9p client for instance would never attempt to open a special file on host side, it would always handle those exclusively on its guest side. A malicious client however could potentially escape from the exported 9p tree by creating and opening a device file on host side. With QEMU this could only be exploited in the following unsafe setups: - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough' security model. or - Using 9p 'proxy' fs driver (which is running its helper daemon as root). These setups were already discouraged for safety reasons before, however for obvious reasons we are now tightening behaviour on this. Fixes: CVE-2023-2861 Reported-by:
Yanwu Shen <ywsPlz@gmail.com> Reported-by:
Jietao Xiao <shawtao1125@gmail.com> Reported-by:
Jinku Li <jkli@xidian.edu.cn> Reported-by:
Wenbo Shen <shenwenbo@zju.edu.cn> Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Michael Tokarev <mjt@tls.msk.ru> Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
-
- Feb 08, 2023
-
-
Markus Armbruster authored
This commit was created with scripts/clean-includes. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Acked-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Message-Id: <20230202133830.2152150-19-armbru@redhat.com>
-
- Oct 24, 2022
-
-
Bin Meng authored
Use g_mkdir() to create a directory on all platforms. Signed-off-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <20220927110632.1973965-27-bmeng.cn@gmail.com> Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com>
-
- Apr 06, 2022
-
-
Marc-André Lureau authored
Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-33-marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Mar 22, 2022
-
-
Marc-André Lureau authored
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually. Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Richard W.M. Jones <rjones@redhat.com>
-
- Mar 07, 2022
-
-
Christian Schoenebeck authored
API doc comments in QEMU are supposed to be in kerneldoc format, so convert API doc comments from Doxygen format to kerneldoc format. Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by:
Greg Kurz <groug@kaod.org> Message-Id: <2e2d46a402560f155de322d95789ba107d728885.1646314856.git.qemu_oss@crudebyte.com>
-
Keno Fischer authored
To allow VirtFS on darwin, we need to check that pthread_fchdir_np is available, which has only been available since macOS 10.12. Additionally, virtfs_proxy_helper is disabled on Darwin. This patch series does not currently provide an implementation of the proxy-helper, but this functionality could be implemented later on. Signed-off-by:
Keno Fischer <keno@juliacomputing.com> [Michael Roitzsch: - Rebase for NixOS] Signed-off-by:
Michael Roitzsch <reactorcontrol@icloud.com> [Will Cohen: - Rebase to master] Signed-off-by:
Will Cohen <wwcohen@gmail.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> [Will Cohen: - Add check for pthread_fchdir_np to virtfs - Add comments to patch commit - Note that virtfs_proxy_helper does not work on macOS - Fully adjust meson virtfs error note to specify macOS - Rebase to master] Signed-off-by:
Will Cohen <wwcohen@gmail.com> Message-Id: <20220227223522.91937-12-wwcohen@gmail.com> Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Acked-by:
Christian Schoenebeck <qemu_oss@crudebyte.com>
-
Keno Fischer authored
- Guard Linux only headers. - Add qemu/statfs.h header to abstract over the which headers are needed for struct statfs - Define `ENOATTR` only if not only defined (it's defined in system headers on Darwin). Signed-off-by:
Keno Fischer <keno@juliacomputing.com> [Michael Roitzsch: - Rebase for NixOS] Signed-off-by:
Michael Roitzsch <reactorcontrol@icloud.com> While it might at first appear that fsdev/virtfs-proxy-header.c would need similar adjustment for darwin as file-op-9p here, a later patch in this series disables virtfs-proxy-helper for non-Linux. Allowing virtfs-proxy-helper on darwin could potentially be an additional optimization later. [Will Cohen: - Fix headers for Alpine - Integrate statfs.h back into file-op-9p.h - Remove superfluous header guards from file-opt-9p - Add note about virtfs-proxy-helper being disabled on non-Linux for this patch series] Signed-off-by:
Will Cohen <wwcohen@gmail.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Greg Kurz <groug@kaod.org> Message-Id: <20220227223522.91937-2-wwcohen@gmail.com> Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com>
-
- Oct 27, 2021
-
-
Christian Schoenebeck authored
Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <79a0ddf8375f6c95f0565ef155a1bf1e9387664f.1633097129.git.qemu_oss@crudebyte.com>
-
Christian Schoenebeck authored
Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <ce9f7a0a63585dc27f4545c485109efbec1251da.1633097129.git.qemu_oss@crudebyte.com>
-
Christian Schoenebeck authored
Make sure at compile time that the scalar type of the array requested to be created via P9ARRAY_NEW() matches the scalar type of the passed auto reference variable (unique pointer). Suggested-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <c1965e2a096835dc9e1d4d659dfb15d96755cbe0.1633097129.git.qemu_oss@crudebyte.com>
-
Christian Schoenebeck authored
Implements deep auto free of arrays while retaining common C-style squared bracket access. Main purpose of this API is to get rid of error prone individual array deallocation pathes in user code, i.e. turning something like this: void doSomething(size_t n) { Foo *foos = malloc(n * sizeof(Foo)); for (...) { foos[i].s = malloc(...); if (...) { goto out; } } out: if (...) { for (...) { /* deep deallocation */ free(foos[i].s); } /* array deallocation */ free(foos); } } into something more simple and safer like: void doSomething(size_t n) { P9ARRAY_REF(Foo) foos = NULL; P9ARRAY_NEW(Foo, foos, n); for (...) { foos[i].s = malloc(...); if (...) { return; /* array auto freed here */ } } /* array auto freed here */ } Unlike GArray, P9Array does not require special macros, function calls or struct member dereferencing to access the individual array elements: C-array = P9Array: vs. GArray: for (...) { | for (...) { ... = arr[i].m; | ... = g_array_index(arr, Foo, i).m; arr[i].m = ... ; | g_array_index(arr, Foo, i).m = ... ; } | } So existing C-style array code can be retained with only very little changes; basically limited to replacing array allocation call and of course removing individual array deallocation pathes. In this initial version P9Array only supports the concept of unique pointers, i.e. it does not support reference counting. The array (and all dynamically allocated memory of individual array elements) is auto freed once execution leaves the scope of the reference variable (unique pointer) associated with the array. Internally a flex array struct is used in combination with macros spanned over a continuous memory space for both the array's meta data (private) and the actual C-array user data (public): struct P9Array##scalar_type { size_t len; /* private, hidden from user code */ scalar_type first[]; /* public, directly exposed to user code */ }; Which has the advantage that the compiler automatically takes care about correct padding, alignment and overall size for all scalar data types on all systems and that the user space exposed pointer can directly be translated back and forth between user space C-array pointer and internal P9Array struct whenever needed, in a type-safe manner. This header file is released under MIT license, to allow this file being used in other C-projects as well. The common QEMU license GPL2+ might have construed a conflict for other projects. Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <a954ef47b5ac26085a16c5c2aec8695374e0424d.1633097129.git.qemu_oss@crudebyte.com>
-
- Jan 23, 2021
-
-
Philippe Mathieu-Daudé authored
have_virtfs_proxy_helper is used from docs/meson.build, and can be not declared when including it before fsdev/meson.build. This fixes: ../docs/meson.build:54:2: ERROR: Unknown variable "have_virtfs_proxy_helper". Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210120151539.1166252-1-philmd@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jan 12, 2021
-
-
Paolo Bonzini authored
CONFIG_VIRTFS is not anymore part of the config_host dictionary. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 13, 2020
-
-
zhouyang authored
I found some style problems while check the code using checkpatch.pl. This commit fixs the issue below: ERROR: open brace '{' following struct go on the same line Signed-off-by:
zhouyang <zhouyang789@huawei.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201209060735.2760943-1-zhouyang789@huawei.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 17, 2020
-
-
zhaolichang authored
I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the folder. Signed-off-by:
zhaolichang <zhaolichang@huawei.com> Reviewed-by:
Alex Bennee <alex.bennee@linaro.org> Message-Id: <20200917075029.313-2-zhaolichang@huawei.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 15, 2020
-
-
Christian Schoenebeck authored
Previous patch introduced a performance warning being logged on host side if client connected with an 'msize' <= 8192. Disable this performance warning for the synth driver to prevent that warning from being printed whenever the 9pfs (qtest) test cases are running. Introduce a new export flag V9FS_NO_PERF_WARN for that purpose, which might also be used to disable such warnings from the CLI in future. We could have also prevented the warning by simply raising P9_MAX_SIZE in virtio-9p-test.c to any value larger than 8192, however in the context of test cases it makes sense running for edge cases, which includes the lowest 'msize' value supported by the server which is 4096, hence we want to preserve an msize of 4096 for the test client. Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by:
Greg Kurz <groug@kaod.org> Message-Id: <E1kEyDy-0006nN-5A@lizzy.crudebyte.com> Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com>
-
- Aug 21, 2020
-
-
Marc-André Lureau authored
Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Marc-André Lureau authored
Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jul 10, 2020
-
-
Prasad J Pandit authored
NULL terminate fs driver options' list, validate_opt() looks for a null entry to terminate the loop. Fixes: aee7f3ec ("fsdev: Error out when unsupported option is passed") Signed-off-by:
Prasad J Pandit <pjp@fedoraproject.org> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Message-Id: <20200709175848.650400-1-ppandit@redhat.com> Signed-off-by:
Greg Kurz <groug@kaod.org>
-
- Mar 09, 2020
-
-
Philippe Mathieu-Daudé authored
Reduce a bit the memory footprint by making the helper_opts[] array const. Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by:
Greg Kurz <groug@kaod.org> Acked-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200305010446.17029-4-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Feb 03, 2020
-
-
Peter Maydell authored
The virtfs-proxy-helper documentation is currently in fsdev/qemu-trace-stap.texi in Texinfo format, which we present to the user as: * a virtfs-proxy-helper manpage * but not (unusually for QEMU) part of the HTML docs Convert the documentation to rST format that lives in the docs/ subdirectory, and present it to the user as: * a virtfs-proxy-helper manpage * part of the interop/ Sphinx manual There are minor formatting changes to suit Sphinx, but no content changes. In particular I've split the -u and -g options into each having their own description text. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Acked-by:
Greg Kurz <groug@kaod.org> Message-id: 20200124162606.8787-9-peter.maydell@linaro.org
-
- Jan 20, 2020
-
-
Daniel Henrique Barboza authored
'err_out' can be removed and be replaced by 'return -errno' in its only instance in the function. CC: Greg Kurz <groug@kaod.org> Signed-off-by:
Daniel Henrique Barboza <danielhb413@gmail.com> Acked-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Greg Kurz <groug@kaod.org>
-
- Dec 02, 2019
-
-
Paolo Bonzini authored
virtfs-proxy-helper is the only user of libcap; everyone else is using the simpler libcap-ng API. Switch and remove the configure code to detect libcap. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Reviewed-by:
Greg Kurz <groug@kaod.org> [groug: - drop remaining -lcap from Makefile - fix error message in configure] Signed-off-by:
Greg Kurz <groug@kaod.org>
-
- Oct 10, 2019
-
-
Antonios Motakis authored
'warn' (default): Only log an error message (once) on host if more than one device is shared by same export, except of that just ignore this config error though. This is the default behaviour for not breaking existing installations implying that they really know what they are doing. 'forbid': Like 'warn', but except of just logging an error this also denies access of guest to additional devices. 'remap': Allows to share more than one device per export by remapping inodes from host to guest appropriately. To support multiple devices on the 9p share, and avoid qid path collisions we take the device id as input to generate a unique QID path. The lowest 48 bits of the path will be set equal to the file inode, and the top bits will be uniquely assigned based on the top 16 bits of the inode and the device id. Signed-off-by:
Antonios Motakis <antonios.motakis@huawei.com> [CS: - Rebased to https://github.com/gkurz/qemu/commits/9p-next (SHA1 7fc4c49e91). - Added virtfs option 'multidevs', original patch simply did the inode remapping without being asked. - Updated hash calls to new xxhash API. - Updated docs for new option 'multidevs'. - Fixed v9fs_do_readdir() not having remapped inodes. - Log error message when running out of prefixes in qid_path_prefixmap(). - Fixed definition of QPATH_INO_MASK. - Wrapped qpp_table initialization to dedicated qpp_table_init() function. - Dropped unnecessary parantheses in qpp_lookup_func(). - Dropped unnecessary g_malloc0() result checks. ] Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> [groug: - Moved "multidevs" parsing to the local backend. - Added hint to invalid multidevs option error. - Turn "remap" into "x-remap". ] Signed-off-by:
Greg Kurz <groug@kaod.org>
-
Greg Kurz authored
It is more convenient to use the return value of the function to notify errors, rather than to be tied up setting up the &local_err boilerplate. Signed-off-by:
Greg Kurz <groug@kaod.org>
-
Antonios Motakis authored
There is no need for signedness on these QID fields for 9p. Signed-off-by:
Antonios Motakis <antonios.motakis@huawei.com> [CS: - Also make QID type unsigned. - Adjust donttouch_stat() to new types. - Adjust trace-events to new types. ] Signed-off-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by:
Greg Kurz <groug@kaod.org>
-
- Aug 20, 2019
-
-
Paolo Bonzini authored
Express the complex conditions in Kconfig rather than Makefiles, since Kconfig is better suited at expressing dependencies and detecting contradictions. Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Aug 16, 2019
-
-
Markus Armbruster authored
In my "build everything" tree, changing qemu/main-loop.h triggers a recompile of some 5600 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h). It includes block/aio.h, which in turn includes qemu/event_notifier.h, qemu/notify.h, qemu/processor.h, qemu/qsp.h, qemu/queue.h, qemu/thread-posix.h, qemu/thread.h, qemu/timer.h, and a few more. Include qemu/main-loop.h only where it's needed. Touching it now recompiles only some 1700 objects. For block/aio.h and qemu/event_notifier.h, these numbers drop from 5600 to 2800. For the others, they shrink only slightly. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20190812052359.30071-21-armbru@redhat.com> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com>
-
- Jun 12, 2019
-
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20190523143508.25387-4-armbru@redhat.com> [Rebased with conflicts resolved automatically, except for hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c; ui/cocoa.m fixed up]
-
- May 17, 2019
-
-
Greg Kurz authored
Each fsdriver only supports a subset of the options that can be passed to -fsdev. Unsupported options are simply ignored. This could cause the user to erroneously think QEMU has a bug. Enforce strict checking of supported options for all fsdrivers. This shouldn't impact libvirt, since it doesn't know about the synth and proxy fsdrivers. Signed-off-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Eric Blake <eblake@redhat.com>
-
Greg Kurz authored
It would make sense for these types to be defined in a header file if we had an API for fsdrivers to register themselves. In practice, we only have three of them and it is very unlikely we add new ones since the future of file sharing between host and guest is the upcoming virtio-fs. Move the types to qemu-fsdev.c instead since they are only used there. Signed-off-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Greg Kurz authored
This was introduced along with -fsdev but it never got used. Signed-off-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Greg Kurz authored
This is a leftover of the handle backend, removed in QEMU 4.0. Signed-off-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
- May 13, 2019
-
-
Markus Armbruster authored
Header guard symbols should match their file name to make guard collisions less likely. Cleaned up with scripts/clean-header-guards.pl, followed by some renaming of new guard symbols picked by the script to better ones. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20190315145123.28030-6-armbru@redhat.com> [Rebase to master: update include/hw/net/ne2000-isa.h]
-
- Jan 11, 2019
-
-
Paolo Bonzini authored
Most list head structs need not be given a name. In most cases the name is given just in case one is going to use QTAILQ_LAST, QTAILQ_PREV or reverse iteration, but this does not apply to lists of other kinds, and even for QTAILQ in practice this is only rarely needed. In addition, we will soon reimplement those macros completely so that they do not need a name for the head struct. So clean up everything, not giving a name except in the rare case where it is necessary. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-