1. 12 Nov, 2019 22 commits
    • David Chase's avatar
      cmd/compile: enable optimizer logging for inline-related events · 4d0ed149
      David Chase authored
      Change-Id: I72de8cb5e1df7a73e46a4b7e5b4e7290fcca4bc1
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204162
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      4d0ed149
    • Tobias Klauser's avatar
      syscall: fix epoll_event padding on linux/arm64 · 405a2f21
      Tobias Klauser authored
      EpollEvent needs padding before Fd as was already done for x/sys/unix in
      CL 21971.
      
      Fixes #35479
      
      Change-Id: Iee963f9e26d0a23d16d6bab736fd71ae7f502894
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206838
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      405a2f21
    • Robert Griesemer's avatar
      math/big: ensure correct test input · 1fe33e3c
      Robert Griesemer authored
      There is a (theoretical, but possible) chance that the
      random number values a, b used for TestDiv are 0 or 1,
      in which case the test would fail.
      
      This CL makes sure that a >= 1 and b >= 2 at all times.
      
      Fixes #35523.
      
      Change-Id: I6451feb94241249516a821cd0066e95a0c65b0ed
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206818
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1fe33e3c
    • Bryan C. Mills's avatar
      crypto/tls: retry ETIMEDOUT flakes in localPipe on dragonfly · 8c5dbba0
      Bryan C. Mills authored
      Fixes #29583
      
      Change-Id: Ia89433bddd4c9f67ec1f0150b730cde8a7e973ee
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206759
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8c5dbba0
    • Matthew Dempsky's avatar
      cmd/compile: fix -m=2 infinite loop in escape.go · 07513d20
      Matthew Dempsky authored
      This CL detects infinite loops due to negative dereference cycles
      during escape analysis, and terminates the loop gracefully. We still
      fail to print a complete explanation of the escape path, but esc.go
      didn't print *any* explanation for these test cases, so the release
      blocking issue here is simply that we don't infinite loop.
      
      Updates #35518.
      
      Change-Id: I39beed036e5a685706248852f1fa619af3b7abbc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206619
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      07513d20
    • Bryan C. Mills's avatar
      cmd/dist: save and restore original permissions in makeGOROOTUnwritable · fc7ee0ba
      Bryan C. Mills authored
      Also log a message and skip the Chmods if running as root.
      
      Updates #30316
      
      Change-Id: Ifb68d06ce845275a72d64c808407e8609df270bc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206757
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      fc7ee0ba
    • Ian Lance Taylor's avatar
      runtime: use pipe rather than note in TestSignalM · 99957b69
      Ian Lance Taylor authored
      At least on Darwin notewakeup is not async-signal-safe.
      
      Fixes #35276
      
      Change-Id: I1d7523715e8e77dbd7f21d9b1ed131e52d46cc41
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206078Reviewed-by: default avatarAustin Clements <austin@google.com>
      99957b69
    • Agniva De Sarker's avatar
      cmd/doc: show the package clause always · d22b5735
      Agniva De Sarker authored
      If no writes to the package buffer happen, then the package clause
      does not get printed. This is a bug for cases where a file just contains
      the package clause.
      
      We fix this by separating the printing of package clause to a new
      function and calling it from (*pkgBuffer).Write as well as (*Package).flush.
      
      Updates #31457
      
      Change-Id: Ia3bd0ea3963274c460a45d1e37fafc6ee0a197f0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206128
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      d22b5735
    • Rémy Oudompheng's avatar
      math/big: implement recursive algorithm for division · 194ae323
      Rémy Oudompheng authored
      The current division algorithm produces one word of result at a time,
      using 2-word division to compute the top word and mulAddVWW to compute
      the remainder. The top word may need to be adjusted by 1 or 2 units.
      
      The recursive version, based on Burnikel, Ziegler, "Fast Recursive Division",
      uses the same principles, but in a multi-word setting, so that
      multiplication benefits from the Karatsuba algorithm (and possibly later
      improvements).
      
      benchmark                             old ns/op        new ns/op      delta
      BenchmarkDiv/20/10-4                  38.2             38.3           +0.26%
      BenchmarkDiv/40/20-4                  38.7             38.5           -0.52%
      BenchmarkDiv/100/50-4                 62.5             62.6           +0.16%
      BenchmarkDiv/200/100-4                238              259            +8.82%
      BenchmarkDiv/400/200-4                311              338            +8.68%
      BenchmarkDiv/1000/500-4               604              649            +7.45%
      BenchmarkDiv/2000/1000-4              1214             1278           +5.27%
      BenchmarkDiv/20000/10000-4            38279            36510          -4.62%
      BenchmarkDiv/200000/100000-4          3022057          1359615        -55.01%
      BenchmarkDiv/2000000/1000000-4        310827664        54012939       -82.62%
      BenchmarkDiv/20000000/10000000-4      33272829421      1965401359     -94.09%
      BenchmarkString/10/Base10-4           158              156            -1.27%
      BenchmarkString/100/Base10-4          797              792            -0.63%
      BenchmarkString/1000/Base10-4         3677             3814           +3.73%
      BenchmarkString/10000/Base10-4        16633            17116          +2.90%
      BenchmarkString/100000/Base10-4       5779029          1793808        -68.96%
      BenchmarkString/1000000/Base10-4      889840820        85524031       -90.39%
      BenchmarkString/10000000/Base10-4     134338236860     4935657026     -96.33%
      
      Fixes #21960
      Updates #30943
      
      Change-Id: I134c6f81a47870c688ca95b6081eb9211def15a2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172018Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      194ae323
    • Rob Pike's avatar
      text/template: add error check for parenthesized first argument in pipeline · b8cb75fb
      Rob Pike authored
      An error check was missing: If the first argument of a pipeline is
      parenthesized, and the pipeline has further arguments, then
      syntactically the pipeline is a function invocation and there must
      be a "call". Tricky rare corner case, but easily caught.
      
      Add the error check and some tests to verify behavior.
      
      Fixes #31810.
      
      Change-Id: Ica80b7c11284e4ea9e8cc94a01dbbc9a67e42079
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206124Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b8cb75fb
    • Agniva De Sarker's avatar
      go/doc: document unicode quoting conversion · b60c7a5c
      Agniva De Sarker authored
      Fixes #30955
      
      Change-Id: I8a2bff5215ddf6c3a80b1e760cb72b0bb9a5e0d3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206122Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      b60c7a5c
    • Agniva De Sarker's avatar
      cmd/doc: show variables of unexported types for -all · 72e043e4
      Agniva De Sarker authored
      We use the typedValue map to prevent showing typed variables
      and constants from appearing in the VARIABLES/CONSTANTS section
      because they will be anyways shown in the TYPES section
      for that type.
      
      However, when a type is unexported, but the variable is exported,
      then unconditionally setting it to true in the map suppresses it
      from being shown in the VARIABLES section. Thus, we set the
      variable or constant in the typedValue map only when
      the type name is exported.
      
      Fixes #31067
      
      Change-Id: Id3ec4b313c9ea7e3ce6fe279680d56f65451719f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/206129
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      72e043e4
    • Filippo Valsorda's avatar
      crypto/tls: take key size into account in signature algorithm selection · c2edcf4b
      Filippo Valsorda authored
      Fixes #29793
      
      Change-Id: I6e389d166c2d9a2ba8664a41f4b9569f2481b27f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205177
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKatie Hockman <katie@golang.org>
      c2edcf4b
    • Filippo Valsorda's avatar
      crypto/tls: add CipherSuites, InsecureCipherSuites and CipherSuiteName · 0ee22d97
      Filippo Valsorda authored
      Fixes #30325
      
      Change-Id: I497110224bb73ecfcc4655698a794e7aa4a66925
      Reviewed-on: https://go-review.googlesource.com/c/go/+/175517
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      0ee22d97
    • Filippo Valsorda's avatar
      crypto/tls: add correct names for CHACHA20_POLY1305 cipher suite constants · e2cac315
      Filippo Valsorda authored
      The cipher suites were apparently renamed late in the standardization
      process, and we picked up the legacy name. We can't remove the old
      constants, but add correctly named ones.
      
      Fixes #32061
      
      Change-Id: I65ee25c12c10934391af88b76b18565da67453fa
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205068
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      e2cac315
    • Filippo Valsorda's avatar
      crypto/tls: re-enable RSA-PSS in TLS 1.2 again · 52a5bf4d
      Filippo Valsorda authored
      TLS 1.3, which requires RSA-PSS, is now enabled without a GODEBUG
      opt-out, and with the introduction of
      Certificate.SupportedSignatureAlgorithms (#28660) there is a
      programmatic way to avoid RSA-PSS (disable TLS 1.3 with MaxVersion and
      use that field to specify only PKCS#1 v1.5 SignatureSchemes).
      
      This effectively reverts 0b3a57b5,
      although following CL 205061 all of the signing-side logic is
      conveniently centralized in signatureSchemesForCertificate.
      
      Fixes #32425
      
      Change-Id: I7c9a8893bb5d518d86eae7db82612b9b2cd257d7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205063
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKatie Hockman <katie@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      52a5bf4d
    • Filippo Valsorda's avatar
      crypto/tls: implement Certificate.SupportedSignatureAlgorithms · 5b17b657
      Filippo Valsorda authored
      This will let applications stop crypto/tls from using a certificate key
      with an algorithm that is not supported by its crypto.Signer, like
      hardware backed keys that can't do RSA-PSS.
      
      Fixes #28660
      
      Change-Id: I294cc06bddf813fff35c5107540c4a1788e1dace
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205062
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      5b17b657
    • Filippo Valsorda's avatar
      crypto/tls: select only compatible chains from Certificates · eb93c684
      Filippo Valsorda authored
      Now that we have a full implementation of the logic to check certificate
      compatibility, we can let applications just list multiple chains in
      Certificates (for example, an RSA and an ECDSA one) and choose the most
      appropriate automatically.
      
      NameToCertificate only maps each name to one chain, so simply deprecate
      it, and while at it simplify its implementation by not stripping
      trailing dots from the SNI (which is specified not to have any, see RFC
      6066, Section 3) and by not supporting multi-level wildcards, which are
      not a thing in the WebPKI (and in crypto/x509).
      
      The performance of SupportsCertificate without Leaf is poor, but doesn't
      affect current users. For now document that, and address it properly in
      the next cycle. See #35504.
      
      While cleaning up the Certificates/GetCertificate/GetConfigForClient
      behavior, also support leaving Certificates/GetCertificate nil if
      GetConfigForClient is set, and send unrecognized_name when there are no
      available certificates.
      
      Fixes #29139
      Fixes #18377
      
      Change-Id: I26604db48806fe4d608388e55da52f34b7ca4566
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205059
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKatie Hockman <katie@golang.org>
      eb93c684
    • Filippo Valsorda's avatar
      crypto/tls: implement (*CertificateRequestInfo).SupportsCertificate · 4b216421
      Filippo Valsorda authored
      Also, add Version to CertificateRequestInfo, as the semantics of
      SignatureSchemes change based on version: the ECDSA SignatureSchemes are
      only constrained to a specific curve in TLS 1.3.
      
      Fixes #32426
      
      Change-Id: I7a551bea864799e98118349ac2476162893d1ffd
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205058
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      4b216421
    • Filippo Valsorda's avatar
      crypto/tls: implement (*ClientHelloInfo).SupportsCertificate · dd017384
      Filippo Valsorda authored
      We'll also use this function for a better selection logic from
      Config.Certificates in a later CL.
      
      Updates #32426
      
      Change-Id: Ie239574d02eb7fd2cf025ec36721c8c7e082d0bc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205057Reviewed-by: default avatarKatie Hockman <katie@golang.org>
      dd017384
    • Filippo Valsorda's avatar
      crypto/tls: refactor certificate and signature algorithm logic · ec732632
      Filippo Valsorda authored
      This refactors a lot of the certificate support logic to make it cleaner
      and reusable where possible. These changes will make the following CLs
      much simpler.
      
      In particular, the heavily overloaded pickSignatureAlgorithm is gone.
      That function used to cover both signing and verifying side, would work
      both for pre-signature_algorithms TLS 1.0/1.1 and TLS 1.2, and returned
      sigalg, type and hash.
      
      Now, TLS 1.0/1.1 and 1.2 are differentiated at the caller, as they have
      effectively completely different logic. TLS 1.0/1.1 simply use
      legacyTypeAndHashFromPublicKey as they employ a fixed hash function and
      signature algorithm for each public key type. TLS 1.2 is instead routed
      through selectSignatureScheme (on the signing side) or
      isSupportedSignatureAlgorithm (on the verifying side) and
      typeAndHashFromSignatureScheme, like TLS 1.3.
      
      On the signing side, signatureSchemesForCertificate was already version
      aware (for PKCS#1 v1.5 vs PSS support), so selectSignatureScheme just
      had to learn the Section 7.4.1.4.1 defaults for a missing
      signature_algorithms to replace pickSignatureAlgorithm.
      
      On the verifying side, pickSignatureAlgorithm was also checking the
      public key type, while isSupportedSignatureAlgorithm +
      typeAndHashFromSignatureScheme are not, but that check was redundant
      with the one in verifyHandshakeSignature.
      
      There should be no major change in behavior so far. A few minor changes
      came from the refactor: we now correctly require signature_algorithms in
      TLS 1.3 when using a certificate; we won't use Ed25519 in TLS 1.2 if the
      client didn't send signature_algorithms; and we don't send
      ec_points_format in the ServerHello (a compatibility measure) if we are
      not doing ECDHE anyway because there are no mutually supported curves.
      
      The tests also got simpler because they test simpler functions. The
      caller logic switching between TLS 1.0/1.1 and 1.2 is tested by the
      transcript tests.
      
      Updates #32426
      
      Change-Id: Ice9dcaea78d204718f661f8d60efdb408ba41577
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205061Reviewed-by: default avatarKatie Hockman <katie@golang.org>
      ec732632
    • Dmitri Shuralyov's avatar
      go/doc: add NewFromFiles with support for classifying examples · 4faada90
      Dmitri Shuralyov authored
      This CL is based on work started by Joe Tsai in CL 94855.
      It's rebased on top of the latest master branch, and
      addresses various code review comments and findings
      from attempting to use the original CL in practice.
      
      The testing package documents a naming convention for examples
      so that documentation tools can associate them with:
      
      • a package (Example or Example_suffix)
      • a function F (ExampleF or ExampleF_suffix)
      • a type T (ExampleT or ExampleT_suffix)
      • a method T.M (ExampleT_M or ExampleT_M_suffix)
      
      This naming convention is in widespread use and enforced
      via existing go vet checks.
      
      This change adds first-class support for classifying examples
      to go/doc, the package responsible for computing package
      documentation from Go AST.
      
      There isn't a way to supply test files to New that works well.
      External test files may have a package name with "_test" suffix,
      so ast.NewPackage may end up using the wrong package name if given
      test files. A workaround is to add test files to *ast.Package.Files
      after it is returned from ast.NewPackage:
      
      	pkg, _ := ast.NewPackage(fset, goFiles, ...)
      	for name, f := range testGoFiles {
      		pkg.Files[name] = f
      	}
      	p := doc.New(pkg, ...)
      
      But that is not a good API.
      
      After nearly 8 years, a new entry-point is added to the go/doc
      package, the function NewFromFiles. It accepts a Go package in
      the form of a list of parsed Go files (including _test.go files)
      and an import path. The caller is responsible with filtering out
      files based on build constraints, as was the case before with New.
      NewFromFiles computes package documentation from .go files,
      extracts examples from _test.go files and classifies them.
      
      Examples fields are added to Package, Type, and Func. They are
      documented to only be populated with examples found in _test.go
      files provided to NewFromFiles.
      
      The new behavior is:
      
      1. NewFromFiles computes package documentation from provided
         parsed .go files. It extracts examples from _test.go files.
      2. It assigns each Example to corresponding Package, Type,
         or Func.
      3. It sets the Suffix field in each example to the suffix.
      4. Malformed examples are skipped.
      
      This change implements behavior that matches the current behavior
      of existing godoc-like tools, and will enable them to rely on the
      logic in go/doc instead of reimplementing it themselves.
      
      Fixes #23864
      
      Change-Id: Iae834f2ff92fbd1c93a9bb7c2bf47d619bee05cf
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204830
      Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      4faada90
  2. 11 Nov, 2019 18 commits