All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Sakoman <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][langdale 07/20] qemu: backport the fix for CVE-2022-3165
Date: Tue,  1 Nov 2022 16:41:57 -1000	[thread overview]
Message-ID: <d63c5b210b50a2c332a5c309298ec13b510cc7c8.1667356805.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1667356805.git.steve@sakoman.com>

From: Ross Burton <ross.burton@arm.com>

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit d820389728b0f5e085954b4f995da2b2014acedf)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/recipes-devtools/qemu/qemu.inc           |  1 +
 .../qemu/qemu/CVE-2022-3165.patch             | 59 +++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch

diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 612abd240a..3908aa0c7c 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -29,6 +29,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \
            file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \
            file://arm-cpreg-fix.patch \
+           file://CVE-2022-3165.patch \
            "
 UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
 
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch b/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch
new file mode 100644
index 0000000000..3b4a6694c2
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch
@@ -0,0 +1,59 @@
+CVE: CVE-2022-3165
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From d307040b18bfcb1393b910f1bae753d5c12a4dc7 Mon Sep 17 00:00:00 2001
+From: Mauro Matteo Cascella <mcascell@redhat.com>
+Date: Sun, 25 Sep 2022 22:45:11 +0200
+Subject: [PATCH] ui/vnc-clipboard: fix integer underflow in
+ vnc_client_cut_text_ext
+
+Extended ClientCutText messages start with a 4-byte header. If len < 4,
+an integer underflow occurs in vnc_client_cut_text_ext. The result is
+used to decompress data in a while loop in inflate_buffer, leading to
+CPU consumption and denial of service. Prevent this by checking dlen in
+protocol_client_msg.
+
+Fixes: CVE-2022-3165
+Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support")
+Reported-by: TangPeng <tangpeng@qianxin.com>
+Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
+Message-Id: <20220925204511.1103214-1-mcascell@redhat.com>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ ui/vnc.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/ui/vnc.c b/ui/vnc.c
+index 6a05d06147..acb3629cd8 100644
+--- a/ui/vnc.c
++++ b/ui/vnc.c
+@@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
+         if (len == 1) {
+             return 8;
+         }
++        uint32_t dlen = abs(read_s32(data, 4));
+         if (len == 8) {
+-            uint32_t dlen = abs(read_s32(data, 4));
+             if (dlen > (1 << 20)) {
+                 error_report("vnc: client_cut_text msg payload has %u bytes"
+                              " which exceeds our limit of 1MB.", dlen);
+@@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
+         }
+ 
+         if (read_s32(data, 4) < 0) {
+-            vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)),
+-                                    read_u32(data, 8), data + 12);
++            if (dlen < 4) {
++                error_report("vnc: malformed payload (header less than 4 bytes)"
++                             " in extended clipboard pseudo-encoding.");
++                vnc_client_error(vs);
++                break;
++            }
++            vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12);
+             break;
+         }
+         vnc_client_cut_text(vs, read_u32(data, 4), data + 8);
+-- 
+GitLab
+
-- 
2.25.1



  parent reply	other threads:[~2022-11-02  2:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  2:41 [OE-core][langdale 00/20] Patch review Steve Sakoman
2022-11-02  2:41 ` [OE-core][langdale 01/20] openssl: CVE-2022-3358 Using a Custom Cipher with NID_undef may lead to NULL encryption Steve Sakoman
2022-11-03 15:54   ` Patrick Williams
2022-11-03 16:28     ` Steve Sakoman
2022-11-03 16:48       ` Patrick Williams
2022-11-02  2:41 ` [OE-core][langdale 02/20] libx11: apply the fix for CVE-2022-3554 Steve Sakoman
2022-11-02  2:41 ` [OE-core][langdale 03/20] xserver-xorg: ignore CVE-2022-3553 as it is XQuartz-specific Steve Sakoman
2022-11-02  2:41 ` [OE-core][langdale 04/20] xserver-xorg: backport fixes for CVE-2022-3550 and CVE-2022-3551 Steve Sakoman
2022-11-02  2:41 ` [OE-core][langdale 05/20] tiff: fix a number of CVEs Steve Sakoman
2022-11-02  2:41 ` [OE-core][langdale 06/20] tiff: fix a typo for CVE-2022-2953.patch Steve Sakoman
2022-11-02  2:41 ` Steve Sakoman [this message]
2022-11-02  2:41 ` [OE-core][langdale 08/20] meson: make wrapper options sub-command specific Steve Sakoman
2022-11-02  2:41 ` [OE-core][langdale 09/20] meson: upgrade 0.63.2 -> 0.63.3 Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 10/20] vim: Upgrade 9.0.0598 -> 9.0.0614 Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 11/20] pango: upgrade 1.50.9 -> 1.50.10 Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 12/20] mtools: upgrade 4.0.40 -> 4.0.41 Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 13/20] ifupdown: upgrade 0.8.37 -> 0.8.39 Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 14/20] mesa: only apply patch to fix ALWAYS_INLINE for native Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 15/20] buildtools-tarball: export certificates to python and curl Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 16/20] qemu-native: Add PACKAGECONFIG option for jack Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 17/20] runqemu: Do not perturb script environment Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 18/20] runqemu: Fix gl-es argument from causing other arguments to be ignored Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 19/20] overlayfs: Allow not used mount points Steve Sakoman
2022-11-02  2:42 ` [OE-core][langdale 20/20] gnutls: upgrade 3.7.7 -> 3.7.8 Steve Sakoman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d63c5b210b50a2c332a5c309298ec13b510cc7c8.1667356805.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.