All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 11.2] io: fix busy-wait when uncorking
@ 2026-12-01 18:15 Daniel P. Berrangé
  2026-12-01 22:36 ` Eric Blake
  2026-12-02  6:50 ` marcandre.lureau
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2026-12-01 18:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé

If we have corked data pending on the TLS channel, when uncorking
if we don't make progress sending any data, the code currently
busy-waits as it mistakenly expects QCRYPTO_TLS_SESSIONERR_BLOCK.

This return value is never set by the uncork method, as that will
always return the amount of outstanding data. IOW, to detect this
situation we need to look for the amount of corked data being
unchanged.

The busy-waiting would allow a lesser privileged, but none the less
authenticated & authorized, network client to create a denial of
service attack on the whole VM which can be owned by a user with
high privileges.

Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/5027
Fixes: CVE-2026-141376
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 io/channel-tls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io/channel-tls.c b/io/channel-tls.c
index 5b0524e68dd..1da9cd08ef0 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -462,7 +462,7 @@ static ssize_t qio_channel_tls_writev(QIOChannel *ioc,
      */
     while (tioc->corked) {
         ssize_t ret = qcrypto_tls_session_write_uncork(tioc->session, errp);
-        if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
+        if (ret == tioc->corked) {
             if (done) {
                 return done;
             } else {
-- 
2.56.1



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

* Re: [PATCH for 11.2] io: fix busy-wait when uncorking
  2026-12-01 18:15 [PATCH for 11.2] io: fix busy-wait when uncorking Daniel P. Berrangé
@ 2026-12-01 22:36 ` Eric Blake
  2026-12-02  9:30   ` Daniel P. Berrangé
  2026-12-02  6:50 ` marcandre.lureau
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2026-12-01 22:36 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel

On Tue, Dec 01, 2026 at 06:15:59PM +0000, Daniel P. Berrangé wrote:
> If we have corked data pending on the TLS channel, when uncorking
> if we don't make progress sending any data, the code currently
> busy-waits as it mistakenly expects QCRYPTO_TLS_SESSIONERR_BLOCK.

s/SESSIONERR/SESSION_ERR/

> 
> This return value is never set by the uncork method, as that will
> always return the amount of outstanding data.

Concur - the function returns ssize_t, but collapses all errors into
-1 (SESSION_ERR_BLOCK is -2).

>   IOW, to detect this
> situation we need to look for the amount of corked data being
> unchanged.

> 
> The busy-waiting would allow a lesser privileged, but none the less
> authenticated & authorized, network client to create a denial of
> service attack on the whole VM which can be owned by a user with
> high privileges.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/5027
> Fixes: CVE-2026-141376
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Although the regression only happened recently, it has already been
backported into the stable releases.  We should add:

Fixes: 99a8b5a0 ("io: cork TLW writes to avoid small TLS records", v11.2.0-rc0)
CC: qemu-stable@nongnu.org

> ---
>  io/channel-tls.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)



> 
> diff --git a/io/channel-tls.c b/io/channel-tls.c
> index 5b0524e68dd..1da9cd08ef0 100644
> --- a/io/channel-tls.c
> +++ b/io/channel-tls.c
> @@ -462,7 +462,7 @@ static ssize_t qio_channel_tls_writev(QIOChannel *ioc,
>       */
>      while (tioc->corked) {
>          ssize_t ret = qcrypto_tls_session_write_uncork(tioc->session, errp);
> -        if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
> +        if (ret == tioc->corked) {

Reviewed-by: Eric Blake <eblake@redhat.com>

>              if (done) {
>                  return done;
>              } else {
> -- 
> 2.56.1
> 
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



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

* Re: [PATCH for 11.2] io: fix busy-wait when uncorking
  2026-12-01 18:15 [PATCH for 11.2] io: fix busy-wait when uncorking Daniel P. Berrangé
  2026-12-01 22:36 ` Eric Blake
@ 2026-12-02  6:50 ` marcandre.lureau
  2026-12-02  9:49   ` Daniel P. Berrangé
  1 sibling, 1 reply; 5+ messages in thread
From: marcandre.lureau @ 2026-12-02  6:50 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel

> If we have corked data pending on the TLS channel, when uncorking
> if we don't make progress sending any data, the code currently
> busy-waits as it mistakenly expects QCRYPTO_TLS_SESSIONERR_BLOCK.
> 
> This return value is never set by the uncork method, as that will
> always return the amount of outstanding data. IOW, to detect this
> situation we need to look for the amount of corked data being
> unchanged.
> 
> The busy-waiting would allow a lesser privileged, but none the less
> authenticated & authorized, network client to create a denial of
> service attack on the whole VM which can be owned by a user with
> high privileges.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/5027
> Fixes: CVE-2026-141376
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Message-ID: <20261201181559.3015655-1-berrange@redhat.com>
> ---
>  io/channel-tls.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io/channel-tls.c b/io/channel-tls.c
> index 5b0524e68dde..1da9cd08ef04 100644
> --- a/io/channel-tls.c
> +++ b/io/channel-tls.c
> @@ -462,7 +462,7 @@ static ssize_t qio_channel_tls_writev(QIOChannel *ioc,
>       */
>      while (tioc->corked) {
>          ssize_t ret = qcrypto_tls_session_write_uncork(tioc->session, errp);
> -        if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
> +        if (ret == tioc->corked) {

Given ret will be promoted to size_t, we should check ret < 0 before
this comparison. Otherwise:

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

-- 
Marc-André Lureau <marcandre.lureau@redhat.com>



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

* Re: [PATCH for 11.2] io: fix busy-wait when uncorking
  2026-12-01 22:36 ` Eric Blake
@ 2026-12-02  9:30   ` Daniel P. Berrangé
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2026-12-02  9:30 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel

On Tue, Dec 01, 2026 at 04:36:31PM -0600, Eric Blake wrote:
> On Tue, Dec 01, 2026 at 06:15:59PM +0000, Daniel P. Berrangé wrote:
> > If we have corked data pending on the TLS channel, when uncorking
> > if we don't make progress sending any data, the code currently
> > busy-waits as it mistakenly expects QCRYPTO_TLS_SESSIONERR_BLOCK.
> 
> s/SESSIONERR/SESSION_ERR/
> 
> > 
> > This return value is never set by the uncork method, as that will
> > always return the amount of outstanding data.
> 
> Concur - the function returns ssize_t, but collapses all errors into
> -1 (SESSION_ERR_BLOCK is -2).
> 
> >   IOW, to detect this
> > situation we need to look for the amount of corked data being
> > unchanged.
> 
> > 
> > The busy-waiting would allow a lesser privileged, but none the less
> > authenticated & authorized, network client to create a denial of
> > service attack on the whole VM which can be owned by a user with
> > high privileges.
> > 
> > Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/5027
> > Fixes: CVE-2026-141376
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> Although the regression only happened recently, it has already been
> backported into the stable releases.  We should add:

Yes, if it were not for the stable branch cherry pick we would
not have required a CVE.

> 
> Fixes: 99a8b5a0 ("io: cork TLW writes to avoid small TLS records", v11.2.0-rc0)
> CC: qemu-stable@nongnu.org
> 
> > ---
> >  io/channel-tls.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> 
> > 
> > diff --git a/io/channel-tls.c b/io/channel-tls.c
> > index 5b0524e68dd..1da9cd08ef0 100644
> > --- a/io/channel-tls.c
> > +++ b/io/channel-tls.c
> > @@ -462,7 +462,7 @@ static ssize_t qio_channel_tls_writev(QIOChannel *ioc,
> >       */
> >      while (tioc->corked) {
> >          ssize_t ret = qcrypto_tls_session_write_uncork(tioc->session, errp);
> > -        if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
> > +        if (ret == tioc->corked) {
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> >              if (done) {
> >                  return done;
> >              } else {
> > -- 
> > 2.56.1
> > 
> > 
> > 
> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.
> Virtualization:  qemu.org | libguestfs.org
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



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

* Re: [PATCH for 11.2] io: fix busy-wait when uncorking
  2026-12-02  6:50 ` marcandre.lureau
@ 2026-12-02  9:49   ` Daniel P. Berrangé
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2026-12-02  9:49 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: qemu-devel

On Wed, Dec 02, 2026 at 10:50:01AM +0400, marcandre.lureau@redhat.com wrote:
> > If we have corked data pending on the TLS channel, when uncorking
> > if we don't make progress sending any data, the code currently
> > busy-waits as it mistakenly expects QCRYPTO_TLS_SESSIONERR_BLOCK.
> > 
> > This return value is never set by the uncork method, as that will
> > always return the amount of outstanding data. IOW, to detect this
> > situation we need to look for the amount of corked data being
> > unchanged.
> > 
> > The busy-waiting would allow a lesser privileged, but none the less
> > authenticated & authorized, network client to create a denial of
> > service attack on the whole VM which can be owned by a user with
> > high privileges.
> > 
> > Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/5027
> > Fixes: CVE-2026-141376
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > Message-ID: <20261201181559.3015655-1-berrange@redhat.com>
> > ---
> >  io/channel-tls.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/io/channel-tls.c b/io/channel-tls.c
> > index 5b0524e68dde..1da9cd08ef04 100644
> > --- a/io/channel-tls.c
> > +++ b/io/channel-tls.c
> > @@ -462,7 +462,7 @@ static ssize_t qio_channel_tls_writev(QIOChannel *ioc,
> >       */
> >      while (tioc->corked) {
> >          ssize_t ret = qcrypto_tls_session_write_uncork(tioc->session, errp);
> > -        if (ret == QCRYPTO_TLS_SESSION_ERR_BLOCK) {
> > +        if (ret == tioc->corked) {
> 
> Given ret will be promoted to size_t, we should check ret < 0 before
> this comparison. Otherwise:

It is safe because 'tioc->corked' will never be negative, so if
ret is -1, it will always fall through to the ret < 0 check.
None the less I'll reverse the checks to make this more obvious.

> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> -- 
> Marc-André Lureau <marcandre.lureau@redhat.com>
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



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

end of thread, other threads:[~2026-12-02  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 18:15 [PATCH for 11.2] io: fix busy-wait when uncorking Daniel P. Berrangé
2026-12-01 22:36 ` Eric Blake
2026-12-02  9:30   ` Daniel P. Berrangé
2026-12-02  6:50 ` marcandre.lureau
2026-12-02  9:49   ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.