Skip to content

Commit 4b29db3

Browse files
committed
Merge branch 'main' into 2.0
2 parents 95e87e1 + bb838f4 commit 4b29db3

16 files changed

Lines changed: 604 additions & 35 deletions

.pipelines/containerSourceData/rabbitmqserver/Dockerfile-rabbitmq-server

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ RUN set -eux; \
4040
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
4141

4242
# put commands inside of directories on the path
43-
RUN set -eux; \
44-
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.11.11/sbin/rabbitmqctl /usr/sbin/rabbitmqctl; \
45-
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.11.11/sbin/rabbitmq-server /usr/sbin/rabbitmq-server; \
46-
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.11.11/sbin/rabbitmq-plugins /usr/sbin/rabbitmq-plugins; \
47-
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.11.11/sbin/rabbitmq-diagnostics /usr/sbin/rabbitmq-diagnostics; \
48-
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.11.11/sbin/rabbitmq-defaults /usr/sbin/rabbitmq-defaults; \
49-
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.11.11/sbin/rabbitmq-env /usr/sbin/rabbitmq-env
43+
RUN VERSION=$(rpm -qa rabbitmq-server --queryformat '%{VERSION}\n'); \
44+
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-$VERSION/sbin/rabbitmqctl /usr/sbin/rabbitmqctl; \
45+
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-$VERSION/sbin/rabbitmq-server /usr/sbin/rabbitmq-server; \
46+
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-$VERSION/sbin/rabbitmq-plugins /usr/sbin/rabbitmq-plugins; \
47+
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-$VERSION/sbin/rabbitmq-diagnostics /usr/sbin/rabbitmq-diagnostics; \
48+
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-$VERSION/sbin/rabbitmq-defaults /usr/sbin/rabbitmq-defaults; \
49+
ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-$VERSION/sbin/rabbitmq-env /usr/sbin/rabbitmq-env
5050

5151
# run basic smoke test as rabbitmq user
5252
RUN set -eux; \
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
From 84b30b3380727ea94e05c438ab695ea24e38fb0c Mon Sep 17 00:00:00 2001
2+
From: Damien Neil <dneil@google.com>
3+
Date: Fri, 6 Oct 2023 09:51:19 -0700
4+
Subject: [PATCH] http2: limit maximum handler goroutines to
5+
MaxConcurrentStreams
6+
7+
When the peer opens a new stream while we have MaxConcurrentStreams
8+
handler goroutines running, defer starting a handler until one
9+
of the existing handlers exits.
10+
11+
Fixes golang/go#63417
12+
Fixes CVE-2023-39325
13+
14+
Change-Id: If0531e177b125700f3e24c5ebd24b1023098fa6d
15+
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2045854
16+
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
17+
Reviewed-by: Ian Cottrell <iancottrell@google.com>
18+
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
19+
Run-TryBot: Damien Neil <dneil@google.com>
20+
Reviewed-on: https://go-review.googlesource.com/c/net/+/534215
21+
Reviewed-by: Michael Pratt <mpratt@google.com>
22+
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
23+
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
24+
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
25+
Reviewed-by: Damien Neil <dneil@google.com>
26+
27+
Modified to apply to vendored code by: Daniel McIlvaney <damcilva@microsoft.com>
28+
- Adjusted paths
29+
- Removed reference to server_test.go
30+
---
31+
.../vendor/golang.org/x/net/http2/server.go | 66 ++++++++++++++++++-
32+
1 file changed, 64 insertions(+), 2 deletions(-)
33+
34+
diff --git a/src/runtime/vendor/golang.org/x/net/http2/server.go b/src/runtime/vendor/golang.org/x/net/http2/server.go
35+
index 8cb14f3..6000140 100644
36+
--- a/src/runtime/vendor/golang.org/x/net/http2/server.go
37+
+++ b/src/runtime/vendor/golang.org/x/net/http2/server.go
38+
@@ -581,9 +581,11 @@ type serverConn struct {
39+
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
40+
curClientStreams uint32 // number of open streams initiated by the client
41+
curPushedStreams uint32 // number of open streams initiated by server push
42+
+ curHandlers uint32 // number of running handler goroutines
43+
maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests
44+
maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes
45+
streams map[uint32]*stream
46+
+ unstartedHandlers []unstartedHandler
47+
initialStreamSendWindowSize int32
48+
maxFrameSize int32
49+
peerMaxHeaderListSize uint32 // zero means unknown (default)
50+
@@ -981,6 +983,8 @@ func (sc *serverConn) serve() {
51+
return
52+
case gracefulShutdownMsg:
53+
sc.startGracefulShutdownInternal()
54+
+ case handlerDoneMsg:
55+
+ sc.handlerDone()
56+
default:
57+
panic("unknown timer")
58+
}
59+
@@ -1028,6 +1032,7 @@ var (
60+
idleTimerMsg = new(serverMessage)
61+
shutdownTimerMsg = new(serverMessage)
62+
gracefulShutdownMsg = new(serverMessage)
63+
+ handlerDoneMsg = new(serverMessage)
64+
)
65+
66+
func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) }
67+
@@ -2022,8 +2027,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
68+
}
69+
}
70+
71+
- go sc.runHandler(rw, req, handler)
72+
- return nil
73+
+ return sc.scheduleHandler(id, rw, req, handler)
74+
}
75+
76+
func (sc *serverConn) upgradeRequest(req *http.Request) {
77+
@@ -2043,6 +2047,10 @@ func (sc *serverConn) upgradeRequest(req *http.Request) {
78+
sc.conn.SetReadDeadline(time.Time{})
79+
}
80+
81+
+ // This is the first request on the connection,
82+
+ // so start the handler directly rather than going
83+
+ // through scheduleHandler.
84+
+ sc.curHandlers++
85+
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
86+
}
87+
88+
@@ -2283,8 +2291,62 @@ func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *response
89+
return &responseWriter{rws: rws}
90+
}
91+
92+
+type unstartedHandler struct {
93+
+ streamID uint32
94+
+ rw *responseWriter
95+
+ req *http.Request
96+
+ handler func(http.ResponseWriter, *http.Request)
97+
+}
98+
+
99+
+// scheduleHandler starts a handler goroutine,
100+
+// or schedules one to start as soon as an existing handler finishes.
101+
+func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error {
102+
+ sc.serveG.check()
103+
+ maxHandlers := sc.advMaxStreams
104+
+ if sc.curHandlers < maxHandlers {
105+
+ sc.curHandlers++
106+
+ go sc.runHandler(rw, req, handler)
107+
+ return nil
108+
+ }
109+
+ if len(sc.unstartedHandlers) > int(4*sc.advMaxStreams) {
110+
+ return sc.countError("too_many_early_resets", ConnectionError(ErrCodeEnhanceYourCalm))
111+
+ }
112+
+ sc.unstartedHandlers = append(sc.unstartedHandlers, unstartedHandler{
113+
+ streamID: streamID,
114+
+ rw: rw,
115+
+ req: req,
116+
+ handler: handler,
117+
+ })
118+
+ return nil
119+
+}
120+
+
121+
+func (sc *serverConn) handlerDone() {
122+
+ sc.serveG.check()
123+
+ sc.curHandlers--
124+
+ i := 0
125+
+ maxHandlers := sc.advMaxStreams
126+
+ for ; i < len(sc.unstartedHandlers); i++ {
127+
+ u := sc.unstartedHandlers[i]
128+
+ if sc.streams[u.streamID] == nil {
129+
+ // This stream was reset before its goroutine had a chance to start.
130+
+ continue
131+
+ }
132+
+ if sc.curHandlers >= maxHandlers {
133+
+ break
134+
+ }
135+
+ sc.curHandlers++
136+
+ go sc.runHandler(u.rw, u.req, u.handler)
137+
+ sc.unstartedHandlers[i] = unstartedHandler{} // don't retain references
138+
+ }
139+
+ sc.unstartedHandlers = sc.unstartedHandlers[i:]
140+
+ if len(sc.unstartedHandlers) == 0 {
141+
+ sc.unstartedHandlers = nil
142+
+ }
143+
+}
144+
+
145+
// Run on its own goroutine.
146+
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
147+
+ defer sc.sendServeMsg(handlerDoneMsg)
148+
didPanic := true
149+
defer func() {
150+
rw.rws.stream.cancelCtx()
151+
--
152+
2.33.8
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
From 87bba52321835fa92f7c91be1b8eef89a93d2506 Mon Sep 17 00:00:00 2001
2+
From: Damien Neil <dneil@google.com>
3+
Date: Wed, 10 Jan 2024 13:41:39 -0800
4+
Subject: [PATCH] http2: close connections when receiving too many headers
5+
6+
Maintaining HPACK state requires that we parse and process
7+
all HEADERS and CONTINUATION frames on a connection.
8+
When a request's headers exceed MaxHeaderBytes, we don't
9+
allocate memory to store the excess headers but we do
10+
parse them. This permits an attacker to cause an HTTP/2
11+
endpoint to read arbitrary amounts of data, all associated
12+
with a request which is going to be rejected.
13+
14+
Set a limit on the amount of excess header frames we
15+
will process before closing a connection.
16+
17+
Thanks to Bartek Nowotarski for reporting this issue.
18+
19+
Fixes CVE-2023-45288
20+
Fixes golang/go#65051
21+
22+
Change-Id: I15df097268df13bb5a9e9d3a5c04a8a141d850f6
23+
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2130527
24+
Reviewed-by: Roland Shoemaker <bracewell@google.com>
25+
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
26+
Reviewed-on: https://go-review.googlesource.com/c/net/+/576155
27+
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
28+
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
29+
Reviewed-by: Than McIntosh <thanm@google.com>
30+
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
31+
---
32+
vendor/golang.org/x/net/http2/frame.go | 31 ++++++++++++++++++++++++++
33+
1 file changed, 31 insertions(+)
34+
35+
diff --git a/src/runtime/vendor/golang.org/x/net/http2/frame.go b/src/runtime/vendor/golang.org/x/net/http2/frame.go
36+
index c1f6b90..175c154 100644
37+
--- a/src/runtime/vendor/golang.org/x/net/http2/frame.go
38+
+++ b/src/runtime/vendor/golang.org/x/net/http2/frame.go
39+
@@ -1565,6 +1565,7 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
40+
if size > remainSize {
41+
hdec.SetEmitEnabled(false)
42+
mh.Truncated = true
43+
+ remainSize = 0
44+
return
45+
}
46+
remainSize -= size
47+
@@ -1577,6 +1578,36 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
48+
var hc headersOrContinuation = hf
49+
for {
50+
frag := hc.HeaderBlockFragment()
51+
+
52+
+ // Avoid parsing large amounts of headers that we will then discard.
53+
+ // If the sender exceeds the max header list size by too much,
54+
+ // skip parsing the fragment and close the connection.
55+
+ //
56+
+ // "Too much" is either any CONTINUATION frame after we've already
57+
+ // exceeded the max header list size (in which case remainSize is 0),
58+
+ // or a frame whose encoded size is more than twice the remaining
59+
+ // header list bytes we're willing to accept.
60+
+ if int64(len(frag)) > int64(2*remainSize) {
61+
+ if VerboseLogs {
62+
+ log.Printf("http2: header list too large")
63+
+ }
64+
+ // It would be nice to send a RST_STREAM before sending the GOAWAY,
65+
+ // but the struture of the server's frame writer makes this difficult.
66+
+ return nil, ConnectionError(ErrCodeProtocol)
67+
+ }
68+
+
69+
+ // Also close the connection after any CONTINUATION frame following an
70+
+ // invalid header, since we stop tracking the size of the headers after
71+
+ // an invalid one.
72+
+ if invalid != nil {
73+
+ if VerboseLogs {
74+
+ log.Printf("http2: invalid header: %v", invalid)
75+
+ }
76+
+ // It would be nice to send a RST_STREAM before sending the GOAWAY,
77+
+ // but the struture of the server's frame writer makes this difficult.
78+
+ return nil, ConnectionError(ErrCodeProtocol)
79+
+ }
80+
+
81+
if _, err := hdec.Write(frag); err != nil {
82+
return nil, ConnectionError(ErrCodeCompression)
83+
}
84+
--
85+
2.44.0
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From 6c1b60f80d28a7ac1b931ee04b516893c23700fa Mon Sep 17 00:00:00 2001
2+
From: Cameron Baird <cameronbaird@microsoft.com>
3+
Date: Thu, 22 Aug 2024 17:53:06 +0000
4+
Subject: [PATCH] Manually format patch for CVE-2024-24786
5+
6+
---
7+
.../protobuf/encoding/protojson/well_known_types.go | 3 +++
8+
.../protobuf/internal/encoding/json/decode.go | 2 +-
9+
2 files changed, 4 insertions(+), 1 deletion(-)
10+
11+
diff --git a/src/runtime/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go b/src/runtime/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go
12+
index c85f846..344c903 100644
13+
--- a/src/runtime/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go
14+
+++ b/src/runtime/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go
15+
@@ -348,6 +348,9 @@ func (d decoder) skipJSONValue() error {
16+
}
17+
}
18+
}
19+
+
20+
+ case json.EOF:
21+
+ return errors.New("unexpected EOF")
22+
}
23+
return nil
24+
}
25+
diff --git a/src/runtime/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go b/src/runtime/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go
26+
index b13fd29..b2be4e8 100644
27+
--- a/src/runtime/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go
28+
+++ b/src/runtime/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go
29+
@@ -121,7 +121,7 @@ func (d *Decoder) Read() (Token, error) {
30+
31+
case ObjectClose:
32+
if len(d.openStack) == 0 ||
33+
- d.lastToken.kind == comma ||
34+
+ d.lastToken.kind&(Name|comma) != 0 ||
35+
d.openStack[len(d.openStack)-1] != ObjectOpen {
36+
return Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())
37+
}
38+
--
39+
2.34.1
40+

SPECS/kata-containers-cc/kata-containers-cc.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313

1414
Name: kata-containers-cc
1515
Version: 3.2.0.azl2
16-
Release: 4%{?dist}
16+
Release: 5%{?dist}
1717
Summary: Kata Confidential Containers package developed for Confidential Containers on AKS
1818
License: ASL 2.0
1919
Vendor: Microsoft Corporation
2020
URL: https://github.com/microsoft/kata-containers
2121
Source0: https://github.com/microsoft/kata-containers/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
2222
Source1: %{name}-%{version}-cargo.tar.gz
2323
Source2: mariner-coco-build-uvm.sh
24+
Patch0: CVE-2023-45288.patch
25+
Patch1: CVE-2023-39325.patch
26+
Patch2: CVE-2024-24786.patch
2427

2528
ExclusiveArch: x86_64
2629

@@ -288,6 +291,9 @@ install -D -m 0755 %{_builddir}/%{name}-%{version}/tools/osbuilder/image-builder
288291
%exclude %{osbuilder}/tools/osbuilder/rootfs-builder/ubuntu
289292

290293
%changelog
294+
* Wed Nov 27 2024 Aadhar Agarwal <aadagarwal@microsoft.com> - 3.2.0.azl2-5
295+
- Add patches for CVE-2023-45288, CVE-2023-39325 and CVE-2024-24786
296+
291297
* Mon Sep 09 2024 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 3.2.0.azl2-4
292298
- Bump release to rebuild with go 1.22.7
293299

0 commit comments

Comments
 (0)