qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/1] Block patches
@ 2024-07-25 20:12 Stefan Hajnoczi
  2024-07-25 20:12 ` [PULL 1/1] util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params() Stefan Hajnoczi
  2024-07-26  5:12 ` [PULL 0/1] Block patches Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2024-07-25 20:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Hanna Reitz, Stefan Hajnoczi, qemu-block, Fam Zheng, Kevin Wolf,
	Richard Henderson

The following changes since commit 029e13a8a56a2931e7c24c0db52ae7256b932cb0:

  Merge tag 'bsd-user-for-9.1-pull-request' of gitlab.com:bsdimp/qemu into staging (2024-07-25 09:53:57 +1000)

are available in the Git repository at:

  https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 851495571d14fe2226c52b9d423f88a4f5460836:

  util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params() (2024-07-25 15:57:38 -0400)

----------------------------------------------------------------
Pull request

Peter's AioContext thread_pool_min/max fix

----------------------------------------------------------------

Peter Maydell (1):
  util/async.c: Forbid negative min/max in
    aio_context_set_thread_pool_params()

 util/async.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.45.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL 1/1] util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params()
  2024-07-25 20:12 [PULL 0/1] Block patches Stefan Hajnoczi
@ 2024-07-25 20:12 ` Stefan Hajnoczi
  2024-07-26  5:12 ` [PULL 0/1] Block patches Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2024-07-25 20:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Hanna Reitz, Stefan Hajnoczi, qemu-block, Fam Zheng, Kevin Wolf,
	Richard Henderson, Peter Maydell, Philippe Mathieu-Daudé

From: Peter Maydell <peter.maydell@linaro.org>

aio_context_set_thread_pool_params() takes two int64_t arguments to
set the minimum and maximum number of threads in the pool.  We do
some bounds checking on these, but we don't catch the case where the
inputs are negative.  This means that later in the function when we
assign these inputs to the AioContext::thread_pool_min and
::thread_pool_max fields, which are of type int, the values might
overflow the smaller type.

A negative number of threads is meaningless, so make
aio_context_set_thread_pool_params() return an error if either min or
max are negative.

Resolves: Coverity CID 1547605
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20240723150927.1396456-1-peter.maydell@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 util/async.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/async.c b/util/async.c
index 0467890052..3e3e4fc712 100644
--- a/util/async.c
+++ b/util/async.c
@@ -746,7 +746,7 @@ void aio_context_set_thread_pool_params(AioContext *ctx, int64_t min,
                                         int64_t max, Error **errp)
 {
 
-    if (min > max || !max || min > INT_MAX || max > INT_MAX) {
+    if (min > max || max <= 0 || min < 0 || min > INT_MAX || max > INT_MAX) {
         error_setg(errp, "bad thread-pool-min/thread-pool-max values");
         return;
     }
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL 0/1] Block patches
  2024-07-25 20:12 [PULL 0/1] Block patches Stefan Hajnoczi
  2024-07-25 20:12 ` [PULL 1/1] util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params() Stefan Hajnoczi
@ 2024-07-26  5:12 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2024-07-26  5:12 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel
  Cc: Hanna Reitz, qemu-block, Fam Zheng, Kevin Wolf, Richard Henderson

On 7/26/24 06:12, Stefan Hajnoczi wrote:
> The following changes since commit 029e13a8a56a2931e7c24c0db52ae7256b932cb0:
> 
>    Merge tag 'bsd-user-for-9.1-pull-request' ofgitlab.com:bsdimp/qemu into staging (2024-07-25 09:53:57 +1000)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/stefanha/qemu.git tags/block-pull-request
> 
> for you to fetch changes up to 851495571d14fe2226c52b9d423f88a4f5460836:
> 
>    util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params() (2024-07-25 15:57:38 -0400)
> 
> ----------------------------------------------------------------
> Pull request
> 
> Peter's AioContext thread_pool_min/max fix

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as appropriate.

r~


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-26  5:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 20:12 [PULL 0/1] Block patches Stefan Hajnoczi
2024-07-25 20:12 ` [PULL 1/1] util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params() Stefan Hajnoczi
2024-07-26  5:12 ` [PULL 0/1] Block patches Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).