1. 26 Feb, 2019 17 commits
  2. 25 Feb, 2019 4 commits
  3. 24 Feb, 2019 6 commits
  4. 23 Feb, 2019 1 commit
  5. 22 Feb, 2019 9 commits
  6. 21 Feb, 2019 1 commit
    • Cherry Zhang's avatar
      cmd/compile: flow interface data to heap if CONVIFACE of a non-direct interface escapes · 0349f29a
      Cherry Zhang authored
      Consider the following code:
      
      func f(x []*T) interface{} {
      	return x
      }
      
      It returns an interface that holds a heap copy of x (by calling
      convT2I or friend), therefore x escape to heap. The current
      escape analysis only recognizes that x flows to the result. This
      is not sufficient, since if the result does not escape, x's
      content may be stack allocated and this will result a
      heap-to-stack pointer, which is bad.
      
      Fix this by realizing that if a CONVIFACE escapes and we're
      converting from a non-direct interface type, the data needs to
      escape to heap.
      
      Running "toolstash -cmp" on std & cmd, the generated machine code
      are identical for all packages. However, the export data (escape
      tags) differ in the following packages. It looks to me that all
      are similar to the "f" above, where the parameter should escape
      to heap.
      
      io/ioutil/ioutil.go:118
      	old: leaking param: r to result ~r1 level=0
      	new: leaking param: r
      
      image/image.go:943
      	old: leaking param: p to result ~r0 level=1
      	new: leaking param content: p
      
      net/url/url.go:200
      	old: leaking param: s to result ~r2 level=0
      	new: leaking param: s
      
      (as a consequence)
      net/url/url.go:183
      	old: leaking param: s to result ~r1 level=0
      	new: leaking param: s
      
      net/url/url.go:194
      	old: leaking param: s to result ~r1 level=0
      	new: leaking param: s
      
      net/url/url.go:699
      	old: leaking param: u to result ~r0 level=1
      	new: leaking param: u
      
      net/url/url.go:775
      	old: (*URL).String u does not escape
      	new: leaking param content: u
      
      net/url/url.go:1038
      	old: leaking param: u to result ~r0 level=1
      	new: leaking param: u
      
      net/url/url.go:1099
      	old: (*URL).MarshalBinary u does not escape
      	new: leaking param content: u
      
      flag/flag.go:235
      	old: leaking param: s to result ~r0 level=1
      	new: leaking param content: s
      
      go/scanner/errors.go:105
      	old: leaking param: p to result ~r0 level=0
      	new: leaking param: p
      
      database/sql/sql.go:204
      	old: leaking param: ns to result ~r0 level=0
      	new: leaking param: ns
      
      go/constant/value.go:303
      	old: leaking param: re to result ~r2 level=0, leaking param: im to result ~r2 level=0
      	new: leaking param: re, leaking param: im
      
      go/constant/value.go:846
      	old: leaking param: x to result ~r1 level=0
      	new: leaking param: x
      
      encoding/xml/xml.go:518
      	old: leaking param: d to result ~r1 level=2
      	new: leaking param content: d
      
      encoding/xml/xml.go:122
      	old: leaking param: leaking param: t to result ~r1 level=0
      	new: leaking param: t
      
      crypto/x509/verify.go:506
      	old: leaking param: c to result ~r8 level=0
      	new: leaking param: c
      
      crypto/x509/verify.go:563
      	old: leaking param: c to result ~r3 level=0, leaking param content: c
      	new: leaking param: c
      
      crypto/x509/verify.go:615
      	old: (nothing)
      	new: leaking closure reference c
      
      crypto/x509/verify.go:996
      	old: leaking param: c to result ~r1 level=0, leaking param content: c
      	new: leaking param: c
      
      net/http/filetransport.go:30
      	old: leaking param: fs to result ~r1 level=0
      	new: leaking param: fs
      
      net/http/h2_bundle.go:2684
      	old: leaking param: mh to result ~r0 level=2
      	new: leaking param content: mh
      
      net/http/h2_bundle.go:7352
      	old: http2checkConnHeaders req does not escape
      	new: leaking param content: req
      
      net/http/pprof/pprof.go:221
      	old: leaking param: name to result ~r1 level=0
      	new: leaking param: name
      
      cmd/internal/bio/must.go:21
      	old: leaking param: w to result ~r1 level=0
      	new: leaking param: w
      
      Fixes #29353.
      
      Change-Id: I7e7798ae773728028b0dcae5bccb3ada51189c68
      Reviewed-on: https://go-review.googlesource.com/c/162829
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      0349f29a
  7. 20 Feb, 2019 2 commits
    • Herbie Ong's avatar
      go/build: add go1.13 release tag · 889aa5eb
      Herbie Ong authored
      Adding this early in the cycle to start regression testing in the master
      toolchain.
      
      Change-Id: Ia151429c4f94efbac0aa41ab6bc16e7462b0e303
      Reviewed-on: https://go-review.googlesource.com/c/163082
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      889aa5eb
    • Robert Griesemer's avatar
      text/scanner: don't liberally consume (invalid) floats or underbars · 34fb5855
      Robert Griesemer authored
      This is a follow-up on https://golang.org/cl/161199 which introduced
      the new Go 2 number literals to text/scanner.
      
      That change introduced a bug by allowing decimal and hexadecimal floats
      to be consumed even if the scanner was not configured to accept floats.
      
      This CL changes the code to not consume a radix dot '.' or exponent
      unless the scanner is configured to accept floats.
      
      This CL also introduces a new mode "AllowNumberbars" which controls
      whether underbars '_' are permitted as digit separators in numbers
      or not.
      
      There is a possibility that we may need to refine text/scanner
      further (e.g., the Float mode now includes hexadecimal floats
      which it didn't recognize before). We're very early in the cycle,
      so let's see how it goes.
      
      RELNOTE=yes
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Fixes #30320.
      
      Change-Id: I6481d314f0384e09ef6803ffad38dc529b1e89a3
      Reviewed-on: https://go-review.googlesource.com/c/163079Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      34fb5855