diff options
author | Virendra Thakur <virendrak@kpit.com> | 2022-12-22 12:21:22 +0530 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2023-01-19 07:49:31 -0500 |
commit | 6464eb9fc42ebc2a78c711c2ee91f77f8fbefb01 (patch) | |
tree | 0a829b4f0ec4c132ec8a3dfabb58196e188f3257 | |
parent | 82f77e2b3c5956c68f64a833f6af83ce522f617e (diff) | |
download | meta-openembedded-6464eb9fc42ebc2a78c711c2ee91f77f8fbefb01.tar.gz |
capnproto: Fix CVE-2022-46149
This patch contains a fix for CVE-2022-46149
Patch backported from :
https://github.com/capnproto/capnproto/commit/25d34c67863fd960af34fc4f82a7ca3362ee74b9
Signed-off-by: Virendra Thakur <virendrak@kpit.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | meta-oe/recipes-devtools/capnproto/capnproto_0.7.0.bb | 4 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/capnproto/files/CVE-2022-46149.patch | 49 |
2 files changed, 52 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/capnproto/capnproto_0.7.0.bb b/meta-oe/recipes-devtools/capnproto/capnproto_0.7.0.bb index cb748d3cb6..fa1751e566 100644 --- a/meta-oe/recipes-devtools/capnproto/capnproto_0.7.0.bb +++ b/meta-oe/recipes-devtools/capnproto/capnproto_0.7.0.bb | |||
@@ -5,7 +5,9 @@ SECTION = "console/tools" | |||
5 | LICENSE = "MIT" | 5 | LICENSE = "MIT" |
6 | LIC_FILES_CHKSUM = "file://../LICENSE;md5=a05663ae6cca874123bf667a60dca8c9" | 6 | LIC_FILES_CHKSUM = "file://../LICENSE;md5=a05663ae6cca874123bf667a60dca8c9" |
7 | 7 | ||
8 | SRC_URI = "git://github.com/sandstorm-io/capnproto.git;branch=release-${PV};protocol=https" | 8 | SRC_URI = "git://github.com/sandstorm-io/capnproto.git;branch=release-${PV};protocol=https \ |
9 | file://CVE-2022-46149.patch \ | ||
10 | " | ||
9 | SRCREV = "3f44c6db0f0f6c0cab0633f15f15d0a2acd01d19" | 11 | SRCREV = "3f44c6db0f0f6c0cab0633f15f15d0a2acd01d19" |
10 | 12 | ||
11 | S = "${WORKDIR}/git/c++" | 13 | S = "${WORKDIR}/git/c++" |
diff --git a/meta-oe/recipes-devtools/capnproto/files/CVE-2022-46149.patch b/meta-oe/recipes-devtools/capnproto/files/CVE-2022-46149.patch new file mode 100644 index 0000000000..b6b1fa6514 --- /dev/null +++ b/meta-oe/recipes-devtools/capnproto/files/CVE-2022-46149.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From 25d34c67863fd960af34fc4f82a7ca3362ee74b9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Kenton Varda <kenton@cloudflare.com> | ||
3 | Date: Wed, 23 Nov 2022 12:02:29 -0600 | ||
4 | Subject: [PATCH] Apply data offset for list-of-pointers at access time rather | ||
5 | than ListReader creation time. | ||
6 | |||
7 | Baking this offset into `ptr` reduced ops needed at access time but made the interpretation of `ptr` inconsistent depending on what type of list was expected. | ||
8 | |||
9 | CVE: CVE-2022-46149 | ||
10 | Upstream-Status: Backport [https://github.com/capnproto/capnproto/commit/25d34c67863fd960af34fc4f82a7ca3362ee74b9] | ||
11 | Signed-off-by: Virendra Thakur <virendrak@kpit.com> | ||
12 | --- | ||
13 | c++/src/capnp/layout.c++ | 4 ---- | ||
14 | c++/src/capnp/layout.h | 6 +++++- | ||
15 | 2 files changed, 5 insertions(+), 5 deletions(-) | ||
16 | |||
17 | Index: c++/src/capnp/layout.c++ | ||
18 | =================================================================== | ||
19 | --- c++.orig/src/capnp/layout.c++ | ||
20 | +++ c++/src/capnp/layout.c++ | ||
21 | @@ -2322,10 +2322,6 @@ struct WireHelpers { | ||
22 | break; | ||
23 | |||
24 | case ElementSize::POINTER: | ||
25 | - // We expected a list of pointers but got a list of structs. Assuming the first field | ||
26 | - // in the struct is the pointer we were looking for, we want to munge the pointer to | ||
27 | - // point at the first element's pointer section. | ||
28 | - ptr += tag->structRef.dataSize.get(); | ||
29 | KJ_REQUIRE(tag->structRef.ptrCount.get() > ZERO * POINTERS, | ||
30 | "Expected a pointer list, but got a list of data-only structs.") { | ||
31 | goto useDefault; | ||
32 | Index: c++/src/capnp/layout.h | ||
33 | =================================================================== | ||
34 | --- c++.orig/src/capnp/layout.h | ||
35 | +++ c++/src/capnp/layout.h | ||
36 | @@ -1235,8 +1235,12 @@ inline Void ListReader::getDataElement<V | ||
37 | } | ||
38 | |||
39 | inline PointerReader ListReader::getPointerElement(ElementCount index) const { | ||
40 | + // If the list elements have data sections we need to skip those. Note that for pointers to be | ||
41 | + // present at all (which already must be true if we get here), then `structDataSize` must be a | ||
42 | + // whole number of words, so we don't have to worry about unaligned reads here. | ||
43 | + auto offset = structDataSize / BITS_PER_BYTE; | ||
44 | return PointerReader(segment, capTable, reinterpret_cast<const WirePointer*>( | ||
45 | - ptr + upgradeBound<uint64_t>(index) * step / BITS_PER_BYTE), nestingLimit); | ||
46 | + ptr + offset + upgradeBound<uint64_t>(index) * step / BITS_PER_BYTE), nestingLimit); | ||
47 | } | ||
48 | |||
49 | // ------------------------------------------------------------------- | ||