]> Cypherpunks repositories - gostls13.git/commitdiff
all: update vendored golang.org/x/net
authorDamien Neil <dneil@google.com>
Tue, 6 Dec 2022 22:04:32 +0000 (14:04 -0800)
committerDamien Neil <dneil@google.com>
Wed, 7 Dec 2022 00:51:44 +0000 (00:51 +0000)
Pull in HTTP/2 security fix:

1e63c2f08a http2: limit canonical header cache by bytes, not entries

Fixes #56350

Change-Id: Ib14024ed894ba266f05d4a6e8c454234a45677d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/455717
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/go.mod
src/cmd/go.sum
src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
src/cmd/vendor/modules.txt
src/go.mod
src/go.sum
src/net/http/h2_bundle.go
src/vendor/modules.txt

index de652f289f3a84cb8d85ef240be47f721f2c3f4d..c1f0e0eac1a8aabd64d405b87bc50f877e7fdf3b 100644 (file)
@@ -7,7 +7,7 @@ require (
        golang.org/x/arch v0.1.1-0.20221116201807-1bb480fc256a
        golang.org/x/mod v0.7.0
        golang.org/x/sync v0.1.0
-       golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669
+       golang.org/x/sys v0.3.0
        golang.org/x/term v0.2.0
        golang.org/x/tools v0.3.1-0.20221121233702-060c049c4674
 )
index 432cbde88d901ba081e9063f9e8099748ad50106..bb72137ecfd851241dfe5d5b5dd516fe791e6fb0 100644 (file)
@@ -8,8 +8,8 @@ golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
 golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
 golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669 h1:pvmSpBoSG0gD2LLPAX15QHPig8xsbU0tu1sSAmResqk=
-golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
+golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM=
 golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
 golang.org/x/tools v0.3.1-0.20221121233702-060c049c4674 h1:Lv0Y+JVwLQF2YThz8ImE7rP2FSv/IzV9lS2k7bvua6U=
index 7a6ba43a7eeac82e0c2775d3931e805b52544f13..a49853e9d3af57851edca6eb0f85712a1a4f79bc 100644 (file)
@@ -367,6 +367,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
 //sys  IsWindowUnicode(hwnd HWND) (isUnicode bool) = user32.IsWindowUnicode
 //sys  IsWindowVisible(hwnd HWND) (isVisible bool) = user32.IsWindowVisible
 //sys  GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) = user32.GetGUIThreadInfo
+//sys  GetLargePageMinimum() (size uintptr)
 
 // Volume Management Functions
 //sys  DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
index 96ba8559c374ec19bc1131417f94ad1b72ec62f0..ac60052e44a79d160998bdc7eb0fa5b5a3a571e4 100644 (file)
@@ -252,6 +252,7 @@ var (
        procGetFileType                                          = modkernel32.NewProc("GetFileType")
        procGetFinalPathNameByHandleW                            = modkernel32.NewProc("GetFinalPathNameByHandleW")
        procGetFullPathNameW                                     = modkernel32.NewProc("GetFullPathNameW")
+       procGetLargePageMinimum                                  = modkernel32.NewProc("GetLargePageMinimum")
        procGetLastError                                         = modkernel32.NewProc("GetLastError")
        procGetLogicalDriveStringsW                              = modkernel32.NewProc("GetLogicalDriveStringsW")
        procGetLogicalDrives                                     = modkernel32.NewProc("GetLogicalDrives")
@@ -2180,6 +2181,12 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (
        return
 }
 
+func GetLargePageMinimum() (size uintptr) {
+       r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0)
+       size = uintptr(r0)
+       return
+}
+
 func GetLastError() (lasterr error) {
        r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
        if r0 != 0 {
index e092e672e94656f6e55569a6386189da45414142..414d8eb743d5ffa61142d1f6a34e56da812b1476 100644 (file)
@@ -37,7 +37,7 @@ golang.org/x/mod/zip
 # golang.org/x/sync v0.1.0
 ## explicit
 golang.org/x/sync/semaphore
-# golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669
+# golang.org/x/sys v0.3.0
 ## explicit; go 1.17
 golang.org/x/sys/internal/unsafeheader
 golang.org/x/sys/plan9
index 874b035dd2d574c3caac58723db06ac475852858..2a1261f925a84467e7229da868b15cfc65776b21 100644 (file)
@@ -4,10 +4,10 @@ go 1.20
 
 require (
        golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a
-       golang.org/x/net v0.2.1-0.20221117215542-ecf7fda6a59e
+       golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10
 )
 
 require (
-       golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669 // indirect
-       golang.org/x/text v0.4.1-0.20221110184632-c8236a6712b1 // indirect
+       golang.org/x/sys v0.3.0 // indirect
+       golang.org/x/text v0.5.0 // indirect
 )
index 3ff1619712fac4f7a0684872d793af923bee0d93..ef6748d5968c249b7c18edd0eaeb5e6a3fe08e5c 100644 (file)
@@ -1,8 +1,8 @@
 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a h1:diz9pEYuTIuLMJLs3rGDkeaTsNyRs6duYdFyPAxzE/U=
 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
-golang.org/x/net v0.2.1-0.20221117215542-ecf7fda6a59e h1:IVOjWZQH/57UDcpX19vSmMz8w3ohroOMWohn8qWpRkg=
-golang.org/x/net v0.2.1-0.20221117215542-ecf7fda6a59e/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
-golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669 h1:pvmSpBoSG0gD2LLPAX15QHPig8xsbU0tu1sSAmResqk=
-golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/text v0.4.1-0.20221110184632-c8236a6712b1 h1:MeNvOWn/3xRkkONM8Kq3bqSSC5YU33Xf00gGusqEuss=
-golang.org/x/text v0.4.1-0.20221110184632-c8236a6712b1/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc=
+golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
+golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
+golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
+golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
index e36b31dfc399ac89eb13cccac5ceeac74208c315..1e0b83d493a8e98d906da877e5b0ff571a961bf7 100644 (file)
@@ -4327,6 +4327,7 @@ type http2serverConn struct {
        maxFrameSize                int32
        peerMaxHeaderListSize       uint32            // zero means unknown (default)
        canonHeader                 map[string]string // http2-lower-case -> Go-Canonical-Case
+       canonHeaderKeysSize         int               // canonHeader keys size in bytes
        writingFrame                bool              // started writing a frame (on serve goroutine or separate)
        writingFrameAsync           bool              // started a frame on its own goroutine but haven't heard back on wroteFrameCh
        needsFrameFlush             bool              // last frame write wasn't a flush
@@ -4508,6 +4509,13 @@ func (sc *http2serverConn) condlogf(err error, format string, args ...interface{
        }
 }
 
+// maxCachedCanonicalHeadersKeysSize is an arbitrarily-chosen limit on the size
+// of the entries in the canonHeader cache.
+// This should be larger than the size of unique, uncommon header keys likely to
+// be sent by the peer, while not so high as to permit unreasonable memory usage
+// if the peer sends an unbounded number of unique header keys.
+const http2maxCachedCanonicalHeadersKeysSize = 2048
+
 func (sc *http2serverConn) canonicalHeader(v string) string {
        sc.serveG.check()
        http2buildCommonHeaderMapsOnce()
@@ -4523,14 +4531,10 @@ func (sc *http2serverConn) canonicalHeader(v string) string {
                sc.canonHeader = make(map[string]string)
        }
        cv = CanonicalHeaderKey(v)
-       // maxCachedCanonicalHeaders is an arbitrarily-chosen limit on the number of
-       // entries in the canonHeader cache. This should be larger than the number
-       // of unique, uncommon header keys likely to be sent by the peer, while not
-       // so high as to permit unreasonable memory usage if the peer sends an unbounded
-       // number of unique header keys.
-       const maxCachedCanonicalHeaders = 32
-       if len(sc.canonHeader) < maxCachedCanonicalHeaders {
+       size := 100 + len(v)*2 // 100 bytes of map overhead + key + value
+       if sc.canonHeaderKeysSize+size <= http2maxCachedCanonicalHeadersKeysSize {
                sc.canonHeader[v] = cv
+               sc.canonHeaderKeysSize += size
        }
        return cv
 }
index 0854beacdd92eb21d9f3c6343a3cc7363e200f2d..3e4bb5b90bc6726ba2c9e9f1230afc09dd6cf1e1 100644 (file)
@@ -7,7 +7,7 @@ golang.org/x/crypto/cryptobyte/asn1
 golang.org/x/crypto/hkdf
 golang.org/x/crypto/internal/alias
 golang.org/x/crypto/internal/poly1305
-# golang.org/x/net v0.2.1-0.20221117215542-ecf7fda6a59e
+# golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10
 ## explicit; go 1.17
 golang.org/x/net/dns/dnsmessage
 golang.org/x/net/http/httpguts
@@ -17,10 +17,10 @@ golang.org/x/net/idna
 golang.org/x/net/lif
 golang.org/x/net/nettest
 golang.org/x/net/route
-# golang.org/x/sys v0.2.1-0.20221110211117-d684c6f88669
+# golang.org/x/sys v0.3.0
 ## explicit; go 1.17
 golang.org/x/sys/cpu
-# golang.org/x/text v0.4.1-0.20221110184632-c8236a6712b1
+# golang.org/x/text v0.5.0
 ## explicit; go 1.17
 golang.org/x/text/secure/bidirule
 golang.org/x/text/transform