From 8d99e952885894ecf7b77429bdabf399eddc2a31 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 13 Jun 2018 16:52:04 +0200 Subject: [PATCH] Update deps --- Gopkg.lock | 6 +-- vendor/golang.org/x/net/http/httpguts/guts.go | 15 ------- vendor/golang.org/x/net/http2/server.go | 17 -------- vendor/golang.org/x/net/http2/server_test.go | 5 --- .../golang.org/x/net/http2/transport_test.go | 7 ++- vendor/golang.org/x/net/http2/write.go | 4 -- vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 +++++++ vendor/golang.org/x/sys/cpu/cpu_gccgo.c | 43 +++++++++++++++++++ vendor/golang.org/x/sys/cpu/cpu_gccgo.go | 26 +++++++++++ vendor/golang.org/x/sys/cpu/cpu_x86.go | 6 --- vendor/golang.org/x/sys/cpu/cpu_x86.s | 1 + .../x/sys/windows/security_windows.go | 4 +- .../x/sys/windows/syscall_windows_test.go | 6 +++ 13 files changed, 101 insertions(+), 55 deletions(-) create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.c create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.go diff --git a/Gopkg.lock b/Gopkg.lock index fddf1ca9..efef7eb8 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -154,7 +154,7 @@ "poly1305", "salsa20/salsa" ] - revision = "b47b1587369238182299fe4dad77d05b8b461e06" + revision = "8ac0e0d97ce45cd83d1d7243c060cb8461dda5e9" [[projects]] branch = "master" @@ -172,7 +172,7 @@ "ipv6", "proxy" ] - revision = "1e491301e022f8f977054da4c2d852decd59571f" + revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196" [[projects]] branch = "master" @@ -185,7 +185,7 @@ "windows/svc/eventlog", "windows/svc/mgr" ] - revision = "538ab54ba952cc4c7c705fa213fbf7993c97c175" + revision = "f4b713d59635e9af9041b0e1b1fd102d95812dbe" [[projects]] name = "golang.org/x/text" diff --git a/vendor/golang.org/x/net/http/httpguts/guts.go b/vendor/golang.org/x/net/http/httpguts/guts.go index 8255fd49..e6cd0ced 100644 --- a/vendor/golang.org/x/net/http/httpguts/guts.go +++ b/vendor/golang.org/x/net/http/httpguts/guts.go @@ -14,21 +14,6 @@ import ( "strings" ) -// SniffedContentType reports whether ct is a Content-Type that is known -// to cause client-side content sniffing. -// -// This provides just a partial implementation of mime.ParseMediaType -// with the assumption that the Content-Type is not attacker controlled. -func SniffedContentType(ct string) bool { - if i := strings.Index(ct, ";"); i != -1 { - ct = ct[:i] - } - ct = strings.ToLower(strings.TrimSpace(ct)) - return ct == "text/plain" || ct == "application/octet-stream" || - ct == "application/unknown" || ct == "unknown/unknown" || ct == "*/*" || - !strings.Contains(ct, "/") -} - // ValidTrailerHeader reports whether name is a valid header field name to appear // in trailers. // See RFC 7230, Section 4.1.2 diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index acf3b241..769c0fe5 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -2312,7 +2312,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { isHeadResp := rws.req.Method == "HEAD" if !rws.sentHeader { rws.sentHeader = true - var ctype, clen string if clen = rws.snapHeader.Get("Content-Length"); clen != "" { rws.snapHeader.Del("Content-Length") @@ -2326,7 +2325,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { if clen == "" && rws.handlerDone && bodyAllowedForStatus(rws.status) && (len(p) > 0 || !isHeadResp) { clen = strconv.Itoa(len(p)) } - _, hasContentType := rws.snapHeader["Content-Type"] if !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 { if cto := rws.snapHeader.Get("X-Content-Type-Options"); strings.EqualFold("nosniff", cto) { @@ -2339,20 +2337,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { ctype = http.DetectContentType(p) } } - - var noSniff bool - if bodyAllowedForStatus(rws.status) && (rws.sentContentLen > 0 || len(p) > 0) { - // If the content type triggers client-side sniffing on old browsers, - // attach a X-Content-Type-Options header if not present (or explicitly nil). - if _, ok := rws.snapHeader["X-Content-Type-Options"]; !ok { - if hasContentType { - noSniff = httpguts.SniffedContentType(rws.snapHeader.Get("Content-Type")) - } else if ctype != "" { - noSniff = httpguts.SniffedContentType(ctype) - } - } - } - var date string if _, ok := rws.snapHeader["Date"]; !ok { // TODO(bradfitz): be faster here, like net/http? measure. @@ -2371,7 +2355,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { endStream: endStream, contentType: ctype, contentLength: clen, - noSniff: noSniff, date: date, }) if err != nil { diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go index ffa40c0d..baab0f14 100644 --- a/vendor/golang.org/x/net/http2/server_test.go +++ b/vendor/golang.org/x/net/http2/server_test.go @@ -1810,7 +1810,6 @@ func TestServer_Response_TransferEncoding_chunked(t *testing.T) { {":status", "200"}, {"content-type", "text/plain; charset=utf-8"}, {"content-length", strconv.Itoa(len(msg))}, - {"x-content-type-options", "nosniff"}, } if !reflect.DeepEqual(goth, wanth) { t.Errorf("Got headers %v; want %v", goth, wanth) @@ -1999,7 +1998,6 @@ func TestServer_Response_LargeWrite(t *testing.T) { wanth := [][2]string{ {":status", "200"}, {"content-type", "text/plain; charset=utf-8"}, // sniffed - {"x-content-type-options", "nosniff"}, // and no content-length } if !reflect.DeepEqual(goth, wanth) { @@ -2214,7 +2212,6 @@ func TestServer_Response_Automatic100Continue(t *testing.T) { {":status", "200"}, {"content-type", "text/plain; charset=utf-8"}, {"content-length", strconv.Itoa(len(reply))}, - {"x-content-type-options", "nosniff"}, } if !reflect.DeepEqual(goth, wanth) { t.Errorf("Got headers %v; want %v", goth, wanth) @@ -2938,7 +2935,6 @@ func testServerWritesTrailers(t *testing.T, withFlush bool) { {"trailer", "Transfer-Encoding, Content-Length, Trailer"}, {"content-type", "text/plain; charset=utf-8"}, {"content-length", "5"}, - {"x-content-type-options", "nosniff"}, } if !reflect.DeepEqual(goth, wanth) { t.Errorf("Header mismatch.\n got: %v\nwant: %v", goth, wanth) @@ -3330,7 +3326,6 @@ func TestServerNoDuplicateContentType(t *testing.T) { {":status", "200"}, {"content-type", ""}, {"content-length", "41"}, - {"x-content-type-options", "nosniff"}, } if !reflect.DeepEqual(headers, want) { t.Errorf("Headers mismatch.\n got: %q\nwant: %q\n", headers, want) diff --git a/vendor/golang.org/x/net/http2/transport_test.go b/vendor/golang.org/x/net/http2/transport_test.go index 636f1557..17c09cab 100644 --- a/vendor/golang.org/x/net/http2/transport_test.go +++ b/vendor/golang.org/x/net/http2/transport_test.go @@ -145,10 +145,9 @@ func TestTransport(t *testing.T) { t.Errorf("Status = %q; want %q", g, w) } wantHeader := http.Header{ - "Content-Length": []string{"3"}, - "X-Content-Type-Options": []string{"nosniff"}, - "Content-Type": []string{"text/plain; charset=utf-8"}, - "Date": []string{"XXX"}, // see cleanDate + "Content-Length": []string{"3"}, + "Content-Type": []string{"text/plain; charset=utf-8"}, + "Date": []string{"XXX"}, // see cleanDate } cleanDate(res) if !reflect.DeepEqual(res.Header, wantHeader) { diff --git a/vendor/golang.org/x/net/http2/write.go b/vendor/golang.org/x/net/http2/write.go index a5120412..8a9711f6 100644 --- a/vendor/golang.org/x/net/http2/write.go +++ b/vendor/golang.org/x/net/http2/write.go @@ -186,7 +186,6 @@ type writeResHeaders struct { date string contentType string contentLength string - noSniff bool } func encKV(enc *hpack.Encoder, k, v string) { @@ -223,9 +222,6 @@ func (w *writeResHeaders) writeFrame(ctx writeContext) error { if w.contentLength != "" { encKV(enc, "content-length", w.contentLength) } - if w.noSniff { - encKV(enc, "x-content-type-options", "nosniff") - } if w.date != "" { encKV(enc, "date", w.date) } diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go new file mode 100644 index 00000000..f7cb4697 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go @@ -0,0 +1,16 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build !gccgo + +package cpu + +// cpuid is implemented in cpu_x86.s for gc compiler +// and in cpu_gccgo.c for gccgo. +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) + +// xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler +// and in cpu_gccgo.c for gccgo. +func xgetbv() (eax, edx uint32) diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo.c new file mode 100644 index 00000000..e363c7d1 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo.c @@ -0,0 +1,43 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build gccgo + +#include +#include + +// Need to wrap __get_cpuid_count because it's declared as static. +int +gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, + uint32_t *eax, uint32_t *ebx, + uint32_t *ecx, uint32_t *edx) +{ + return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx); +} + +// xgetbv reads the contents of an XCR (Extended Control Register) +// specified in the ECX register into registers EDX:EAX. +// Currently, the only supported value for XCR is 0. +// +// TODO: Replace with a better alternative: +// +// #include +// +// #pragma GCC target("xsave") +// +// void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { +// unsigned long long x = _xgetbv(0); +// *eax = x & 0xffffffff; +// *edx = (x >> 32) & 0xffffffff; +// } +// +// Note that _xgetbv is defined starting with GCC 8. +void +gccgoXgetbv(uint32_t *eax, uint32_t *edx) +{ + __asm(" xorl %%ecx, %%ecx\n" + " xgetbv" + : "=a"(*eax), "=d"(*edx)); +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo.go new file mode 100644 index 00000000..ba49b91b --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo.go @@ -0,0 +1,26 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build gccgo + +package cpu + +//extern gccgoGetCpuidCount +func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32) + +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { + var a, b, c, d uint32 + gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d) + return a, b, c, d +} + +//extern gccgoXgetbv +func gccgoXgetbv(eax, edx *uint32) + +func xgetbv() (eax, edx uint32) { + var a, d uint32 + gccgoXgetbv(&a, &d) + return a, d +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index 8842b7cf..71e288b0 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -8,12 +8,6 @@ package cpu const cacheLineSize = 64 -// cpuid is implemented in cpu_x86.s. -func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) - -// xgetbv with ecx = 0 is implemented in cpu_x86.s. -func xgetbv() (eax, edx uint32) - func init() { maxID, _, _, _ := cpuid(0, 0) diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.s b/vendor/golang.org/x/sys/cpu/cpu_x86.s index 4ff61e00..47f08412 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.s +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.s @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // +build 386 amd64 amd64p32 +// +build !gccgo #include "textflag.h" diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index f1ec5dc4..4f17a333 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -296,6 +296,7 @@ const ( TOKEN_ADJUST_PRIVILEGES TOKEN_ADJUST_GROUPS TOKEN_ADJUST_DEFAULT + TOKEN_ADJUST_SESSIONID TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | @@ -305,7 +306,8 @@ const ( TOKEN_QUERY_SOURCE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | - TOKEN_ADJUST_DEFAULT + TOKEN_ADJUST_DEFAULT | + TOKEN_ADJUST_SESSIONID TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY TOKEN_WRITE = STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | diff --git a/vendor/golang.org/x/sys/windows/syscall_windows_test.go b/vendor/golang.org/x/sys/windows/syscall_windows_test.go index 9c7133cc..0e27464e 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows_test.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows_test.go @@ -105,3 +105,9 @@ func ExampleLoadLibrary() { build := uint16(r >> 16) print("windows version ", major, ".", minor, " (Build ", build, ")\n") } + +func TestTOKEN_ALL_ACCESS(t *testing.T) { + if windows.TOKEN_ALL_ACCESS != 0xF01FF { + t.Errorf("TOKEN_ALL_ACCESS = %x, want 0xF01FF", windows.TOKEN_ALL_ACCESS) + } +}