<feed xmlns='http://www.w3.org/2005/Atom'>
<title>qemu/include/block, branch master</title>
<subtitle>QEMU development tree</subtitle>
<id>https://git.zx2c4.com/qemu/atom/include/block?h=master</id>
<link rel='self' href='https://git.zx2c4.com/qemu/atom/include/block?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/'/>
<updated>2024-08-08T21:02:23Z</updated>
<entry>
<title>nbd/server: CVE-2024-7409: Cap default max-connections to 100</title>
<updated>2024-08-08T21:02:23Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2024-08-06T18:53:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=c8a76dbd90c2f48df89b75bef74917f90a59b623'/>
<id>urn:sha1:c8a76dbd90c2f48df89b75bef74917f90a59b623</id>
<content type='text'>
Allowing an unlimited number of clients to any web service is a recipe
for a rudimentary denial of service attack: the client merely needs to
open lots of sockets without closing them, until qemu no longer has
any more fds available to allocate.

For qemu-nbd, we default to allowing only 1 connection unless more are
explicitly asked for (-e or --shared); this was historically picked as
a nice default (without an explicit -t, a non-persistent qemu-nbd goes
away after a client disconnects, without needing any additional
follow-up commands), and we are not going to change that interface now
(besides, someday we want to point people towards qemu-storage-daemon
instead of qemu-nbd).

But for qemu proper, and the newer qemu-storage-daemon, the QMP
nbd-server-start command has historically had a default of unlimited
number of connections, in part because unlike qemu-nbd it is
inherently persistent until nbd-server-stop.  Allowing multiple client
sockets is particularly useful for clients that can take advantage of
MULTI_CONN (creating parallel sockets to increase throughput),
although known clients that do so (such as libnbd's nbdcopy) typically
use only 8 or 16 connections (the benefits of scaling diminish once
more sockets are competing for kernel attention).  Picking a number
large enough for typical use cases, but not unlimited, makes it
slightly harder for a malicious client to perform a denial of service
merely by opening lots of connections withot progressing through the
handshake.

This change does not eliminate CVE-2024-7409 on its own, but reduces
the chance for fd exhaustion or unlimited memory usage as an attack
surface.  On the other hand, by itself, it makes it more obvious that
with a finite limit, we have the problem of an unauthenticated client
holding 100 fds opened as a way to block out a legitimate client from
being able to connect; thus, later patches will further add timeouts
to reject clients that are not making progress.

This is an INTENTIONAL change in behavior, and will break any client
of nbd-server-start that was not passing an explicit max-connections
parameter, yet expects more than 100 simultaneous connections.  We are
not aware of any such client (as stated above, most clients aware of
MULTI_CONN get by just fine on 8 or 16 connections, and probably cope
with later connections failing by relying on the earlier connections;
libvirt has not yet been passing max-connections, but generally
creates NBD servers with the intent for a single client for the sake
of live storage migration; meanwhile, the KubeSAN project anticipates
a large cluster sharing multiple clients [up to 8 per node, and up to
100 nodes in a cluster], but it currently uses qemu-nbd with an
explicit --shared=0 rather than qemu-storage-daemon with
nbd-server-start).

We considered using a deprecation period (declare that omitting
max-parameters is deprecated, and make it mandatory in 3 releases -
then we don't need to pick an arbitrary default); that has zero risk
of breaking any apps that accidentally depended on more than 100
connections, and where such breakage might not be noticed under unit
testing but only under the larger loads of production usage.  But it
does not close the denial-of-service hole until far into the future,
and requires all apps to change to add the parameter even if 100 was
good enough.  It also has a drawback that any app (like libvirt) that
is accidentally relying on an unlimited default should seriously
consider their own CVE now, at which point they are going to change to
pass explicit max-connections sooner than waiting for 3 qemu releases.
Finally, if our changed default breaks an app, that app can always
pass in an explicit max-parameters with a larger value.

It is also intentional that the HMP interface to nbd-server-start is
not changed to expose max-connections (any client needing to fine-tune
things should be using QMP).

Suggested-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
Signed-off-by: Eric Blake &lt;eblake@redhat.com&gt;
Message-ID: &lt;20240807174943.771624-12-eblake@redhat.com&gt;
Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
[ericb: Expand commit message to summarize Dan's argument for why we
break corner-case back-compat behavior without a deprecation period]
Signed-off-by: Eric Blake &lt;eblake@redhat.com&gt;
</content>
</entry>
<entry>
<title>nbd/server: Plumb in new args to nbd_client_add()</title>
<updated>2024-08-08T20:05:27Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2024-08-07T13:50:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=fb1c2aaa981e0a2fa6362c9985f1296b74f055ac'/>
<id>urn:sha1:fb1c2aaa981e0a2fa6362c9985f1296b74f055ac</id>
<content type='text'>
Upcoming patches to fix a CVE need to track an opaque pointer passed
in by the owner of a client object, as well as request for a time
limit on how fast negotiation must complete.  Prepare for that by
changing the signature of nbd_client_new() and adding an accessor to
get at the opaque pointer, although for now the two servers
(qemu-nbd.c and blockdev-nbd.c) do not change behavior even though
they pass in a new default timeout value.

Suggested-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@yandex-team.ru&gt;
Signed-off-by: Eric Blake &lt;eblake@redhat.com&gt;
Message-ID: &lt;20240807174943.771624-11-eblake@redhat.com&gt;
Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
[eblake: s/LIMIT/MAX_SECS/ as suggested by Dan]
Signed-off-by: Eric Blake &lt;eblake@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/graph-lock: Make WITH_GRAPH_RDLOCK_GUARD() fully checked</title>
<updated>2024-08-06T18:12:39Z</updated>
<author>
<name>Kevin Wolf</name>
<email>kwolf@redhat.com</email>
</author>
<published>2024-06-27T18:12:45Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=7e1711164683b1036f7da5f87c5f66c17a043ab1'/>
<id>urn:sha1:7e1711164683b1036f7da5f87c5f66c17a043ab1</id>
<content type='text'>
Upstream clang 18 (and backports to clang 17 in Fedora and RHEL)
implemented support for __attribute__((cleanup())) in its Thread Safety
Analysis, so we can now actually have a proper implementation of
WITH_GRAPH_RDLOCK_GUARD() that understands when we acquire and when we
release the lock.

-Wthread-safety is now only enabled if the compiler is new enough to
understand this pattern. In theory, we could have used some #ifdefs to
keep the existing basic checks on old compilers, but as long as someone
runs a newer compiler (and our CI does), we will catch locking problems,
so it's probably not worth keeping multiple implementations for this.

The implementation can't use g_autoptr any more because the glib macros
define wrapper functions that don't have the right TSA attributes, so
the compiler would complain about them. Just use the cleanup attribute
directly instead.

Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Message-ID: &lt;20240627181245.281403-3-kwolf@redhat.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Manos Pitsidianakis &lt;manos.pitsidianakis@linaro.org&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>hw/nvme: add cross namespace copy support</title>
<updated>2024-07-22T12:36:15Z</updated>
<author>
<name>Arun Kumar</name>
<email>arun.kka@samsung.com</email>
</author>
<published>2024-07-01T07:08:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=d522aef88d42a05e46290c97602936a7f6d307e3'/>
<id>urn:sha1:d522aef88d42a05e46290c97602936a7f6d307e3</id>
<content type='text'>
Extend copy command to copy user data across different namespaces via
support for specifying a namespace for each source range

Signed-off-by: Arun Kumar &lt;arun.kka@samsung.com&gt;
Reviewed-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
Signed-off-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
</content>
</entry>
<entry>
<title>hw/nvme: add Identify Endurance Group List</title>
<updated>2024-07-11T15:05:37Z</updated>
<author>
<name>Minwoo Im</name>
<email>minwoo.im@samsung.com</email>
</author>
<published>2024-05-29T12:42:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=6471556500378c9ce38f58cb6c97217778d14226'/>
<id>urn:sha1:6471556500378c9ce38f58cb6c97217778d14226</id>
<content type='text'>
Commit 73064edfb864 ("hw/nvme: flexible data placement emulation")
intorudced NVMe FDP feature to nvme-subsys and nvme-ctrl with a
single endurance group #1 supported.  This means that controller should
return proper identify data to host with Identify Endurance Group List
(CNS 19h).  But, yes, only just for the endurance group #1.  This patch
allows host applications to ask for which endurance group is available
and utilize FDP through that endurance group.

Reviewed-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
Signed-off-by: Minwoo Im &lt;minwoo.im@samsung.com&gt;
Signed-off-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
</content>
</entry>
<entry>
<title>block: remove separate bdrv_file_open callback</title>
<updated>2024-06-28T12:44:51Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2022-11-24T15:22:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=44b424dc4a3e2d47fa20676f00645fb950d8d76a'/>
<id>urn:sha1:44b424dc4a3e2d47fa20676f00645fb950d8d76a</id>
<content type='text'>
bdrv_file_open and bdrv_open are completely equivalent, they are
never checked except to see which one to invoke.  So merge them
into a single one.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>linux-aio: add IO_CMD_FDSYNC command support</title>
<updated>2024-06-10T09:05:43Z</updated>
<author>
<name>Prasad Pandit</name>
<email>pjp@fedoraproject.org</email>
</author>
<published>2024-04-25T07:04:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=24687abf237e3c15816d689a8e4b08d7c3190dcb'/>
<id>urn:sha1:24687abf237e3c15816d689a8e4b08d7c3190dcb</id>
<content type='text'>
Libaio defines IO_CMD_FDSYNC command to sync all outstanding
asynchronous I/O operations, by flushing out file data to the
disk storage. Enable linux-aio to submit such aio request.

When using aio=native without fdsync() support, QEMU creates
pthreads, and destroying these pthreads results in TLB flushes.
In a real-time guest environment, TLB flushes cause a latency
spike. This patch helps to avoid such spikes.

Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Prasad Pandit &lt;pjp@fedoraproject.org&gt;
Message-ID: &lt;20240425070412.37248-1-ppandit@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>aio: warn about iohandler_ctx special casing</title>
<updated>2024-06-10T09:05:43Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2024-05-06T19:06:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=e669e800fc9ef8806af5c5578249ab758a4f8a5a'/>
<id>urn:sha1:e669e800fc9ef8806af5c5578249ab758a4f8a5a</id>
<content type='text'>
The main loop has two AioContexts: qemu_aio_context and iohandler_ctx.
The main loop runs them both, but nested aio_poll() calls on
qemu_aio_context exclude iohandler_ctx.

Which one should qemu_get_current_aio_context() return when called from
the main loop? Document that it's always qemu_aio_context.

This has subtle effects on functions that use
qemu_get_current_aio_context(). For example, aio_co_reschedule_self()
does not work when moving from iohandler_ctx to qemu_aio_context because
qemu_get_current_aio_context() does not differentiate these two
AioContexts.

Document this in order to reduce the chance of future bugs.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-ID: &lt;20240506190622.56095-3-stefanha@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>hw/ufs: Add support MCQ of UFSHCI 4.0</title>
<updated>2024-06-03T07:20:42Z</updated>
<author>
<name>Minwoo Im</name>
<email>minwoo.im@samsung.com</email>
</author>
<published>2024-05-28T02:31:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=5c079578d2e46df626d13eeb629c7d761a5c4e44'/>
<id>urn:sha1:5c079578d2e46df626d13eeb629c7d761a5c4e44</id>
<content type='text'>
This patch adds support for MCQ defined in UFSHCI 4.0.  This patch
utilized the legacy I/O codes as much as possible to support MCQ.

MCQ operation &amp; runtime register is placed at 0x1000 offset of UFSHCI
register statically with no spare space among four registers (48B):

	UfsMcqSqReg, UfsMcqSqIntReg, UfsMcqCqReg, UfsMcqCqIntReg

The maxinum number of queue is 32 as per spec, and the default
MAC(Multiple Active Commands) are 32 in the device.

Example:
	-device ufs,serial=foo,id=ufs0,mcq=true,mcq-maxq=8

Signed-off-by: Minwoo Im &lt;minwoo.im@samsung.com&gt;
Reviewed-by: Jeuk Kim &lt;jeuk20.kim@samsung.com&gt;
Message-Id: &lt;20240528023106.856777-3-minwoo.im@samsung.com&gt;
Signed-off-by: Jeuk Kim &lt;jeuk20.kim@samsung.com&gt;
</content>
</entry>
<entry>
<title>hw/ufs: Update MCQ-related fields to block/ufs.h</title>
<updated>2024-06-03T07:20:42Z</updated>
<author>
<name>Minwoo Im</name>
<email>minwoo.im@samsung.com</email>
</author>
<published>2024-05-28T02:31:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=cdba3b901ac0b480eb9d940219113f0be80cc4e1'/>
<id>urn:sha1:cdba3b901ac0b480eb9d940219113f0be80cc4e1</id>
<content type='text'>
This patch is a prep patch for the following MCQ support patch for
hw/ufs.  This patch updated minimal mandatory fields to support MCQ
based on UFSHCI 4.0.

Signed-off-by: Minwoo Im &lt;minwoo.im@samsung.com&gt;
Reviewed-by: Jeuk Kim &lt;jeuk20.kim@samsung.com&gt;
Message-Id: &lt;20240528023106.856777-2-minwoo.im@samsung.com&gt;
Signed-off-by: Jeuk Kim &lt;jeuk20.kim@samsung.com&gt;
</content>
</entry>
</feed>
