1. 23 May, 2017 6 commits
    • Austin Clements's avatar
      runtime: fix stackCache=0 debug mode · 47542520
      Austin Clements authored
      Setting stackCache to 0 to disable stack caches for debugging hasn't
      worked for a long time. It causes stackalloc to fall back to full span
      allocation, round sub-page stacks down to 0 pages, and blow up.
      
      Fix this debug mode so it disables the per-P caches, but continues to
      use the global stack pools for small stacks, which correctly handle
      sub-page stacks. While we're here, rename stackCache to stackNoCache
      so it acts like the rest of the stack allocator debug modes where "0"
      is the right default value.
      
      Fixes #17291.
      
      Change-Id: If401c41cee3448513cbd7bb2e9334a8efab257a7
      Reviewed-on: https://go-review.googlesource.com/43637Reviewed-by: default avatarKeith Randall <khr@golang.org>
      47542520
    • Austin Clements's avatar
      runtime: fix stackFromSystem returning memory · 8a1c5b2e
      Austin Clements authored
      The stackFromSystem debug mode has two problems:
      
      1) It rounds the stack allocation to _PageSize. If the physical page
      size is >8K, this can cause unmapping the memory later to either
      under-unmap or over-unmap.
      
      2) It doesn't return the rounded-up allocation size to its caller, so
      when we later unmap the memory, we may pass the wrong length.
      
      Fix these problems by rounding the size up to the physical page size
      and putting that rounded-up size in the returned stack bounds.
      
      Fixes #17289.
      
      Change-Id: I6b854af3b06bb16e3750798397bb5e2a722ec1cb
      Reviewed-on: https://go-review.googlesource.com/43636Reviewed-by: default avatarKeith Randall <khr@golang.org>
      8a1c5b2e
    • Chris Broadfoot's avatar
      doc: document go1.8.2 and go1.7.6 · e16944da
      Chris Broadfoot authored
      Change-Id: I2ed2e8c4890a65288cf3066ebe3c1d9a16fb4c05
      Reviewed-on: https://go-review.googlesource.com/43990Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e16944da
    • Austin Clements's avatar
      runtime: don't corrupt arena bounds on low mmap · e5a5c03f
      Austin Clements authored
      If mheap.sysAlloc doesn't have room in the heap arena for an
      allocation, it will attempt to map more address space with sysReserve.
      sysReserve is given a hint, but can return any unused address range.
      Currently, mheap.sysAlloc incorrectly assumes the returned region will
      never fall between arena_start and arena_used. If it does,
      mheap.sysAlloc will blindly accept the new region as the new
      arena_used and arena_end, causing these to decrease and make it so any
      Go heap above the new arena_used is no longer considered part of the
      Go heap. This assumption *used to be* safe because we had all memory
      between arena_start and arena_used mapped, but when we switched to an
      arena_start of 0 on 32-bit, it became no longer safe.
      
      Most likely, we've only recently seen this bug occur because we
      usually start arena_used just above the binary, which is low in the
      address space. Hence, the kernel is very unlikely to give us a region
      before arena_used.
      
      Since mheap.sysAlloc is a linear allocator, there's not much we can do
      to handle this well. Hence, we fix this problem by simply rejecting
      the new region if it isn't after arena_end. In this case, we'll take
      the fall-back path and mmap a small region at any address just for the
      requested memory.
      
      Fixes #20259.
      
      Change-Id: Ib72e8cd621545002d595c7cade1e817cfe3e5b1e
      Reviewed-on: https://go-review.googlesource.com/43870Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      e5a5c03f
    • Joe Richey joerichey@google.com's avatar
      crypto/rand: use blocking getrandom call on Linux when supported · 95d991d3
      Joe Richey joerichey@google.com authored
      By changing getRandomLinux to immediately use the getrandom() syscall
      without GRND_NONBLOCK, we now only fall back to reading from
      /dev/urandom on Linux if the kernel does not support the getrandom()
      syscall. This means reads for crypto/rand will now block if the kernel
      has insufficient entropy on Linux kernels after v3.16.
      
      Before, if the kernel had insufficient entropy, it would fall back to
      reading from /dev/urandom. This would potentially return predictable
      data.
      
      Fixes #19274
      
      Change-Id: I1cb081ce2f3096f18ad2820e52ecdbd993dc2afc
      Reviewed-on: https://go-review.googlesource.com/43852Reviewed-by: default avatarFilippo Valsorda <hi@filippo.io>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      95d991d3
    • Alex Brainman's avatar
      os/exec: ignore some pipe write errors on windows · f3f29d1d
      Alex Brainman authored
      This change is windows version of CL 12152.
      It also extends test to cover scenarios reported on issue #20445.
      Some source files copied and renamed to make code clearer.
      
      Fixes #20445
      
      Change-Id: Idd2f636f27c6bd5cfe98017ba2df911358263382
      Reviewed-on: https://go-review.googlesource.com/43910
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f3f29d1d
  2. 22 May, 2017 14 commits
  3. 20 May, 2017 2 commits
  4. 19 May, 2017 12 commits
  5. 18 May, 2017 6 commits
    • Brad Fitzpatrick's avatar
      os: add some comments and remove an unused variable in rename func · ca598e3c
      Brad Fitzpatrick authored
      This slightly clarifies the just-submitted CL 40577.
      
      Updates #19647
      
      Change-Id: I5584ad0e1abbc31796e3e5752351857f2a13d6d7
      Reviewed-on: https://go-review.googlesource.com/43625
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      ca598e3c
    • Alessandro Arzilli's avatar
      cmd/compile: output DWARF lexical blocks for local variables · 2ad41a30
      Alessandro Arzilli authored
      Change compiler and linker to emit DWARF lexical blocks in .debug_info
      section when compiling with -N -l.
      
      Version of debug_info is updated from DWARF v2 to DWARF v3 since
      version 2 does not allow lexical blocks with discontinuous PC ranges.
      
      Remaining open problems:
      - scope information is removed from inlined functions
      - variables records do not have DW_AT_start_scope attributes so a
      variable will shadow other variables with the same name as soon as its
      containing scope begins, even before its declaration.
      
      Updates #6913.
      Updates #12899.
      
      Change-Id: Idc6808788512ea20e7e45bcf782453acb416fb49
      Reviewed-on: https://go-review.googlesource.com/40095
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      2ad41a30
    • Alexander Menzhinsky's avatar
      os: lstat oldname before renaming · 0f0a51f1
      Alexander Menzhinsky authored
      Fixes #19647
      
      Change-Id: Ife4f98cf2c55ee9490843797213dae2f2647b0a3
      Reviewed-on: https://go-review.googlesource.com/40577Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0f0a51f1
    • Mark Ryan's avatar
      encoding/base32: ensure base32 decoder propagates errors correctly · 1ea796ee
      Mark Ryan authored
      A number of issues in decoder.Read and newlineFilteringReader.Read were
      preventing errors from the reader supplying the encoded data from being
      propagated to the caller.  Fixing these issues revealed some additional
      problems in which valid decoded data was not always returned to the user
      when errors were actually propagated.
      
      This commit fixes both the error propagation and the lost decoded data
      problems.  It also adds some new unit tests to ensure errors are handled
      correctly by decoder.Read.  The new unit tests increase the test coverage
      of this package from 96.2% to 97.9%.
      
      Fixes #20044
      
      Change-Id: I1a8632da20135906e2d191c2a8825b10e7ecc4c5
      Reviewed-on: https://go-review.googlesource.com/42094Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1ea796ee
    • Josh Bleecher Snyder's avatar
      test: gofmt chan/*.go · 26a85211
      Josh Bleecher Snyder authored
      These are functional tests, so it is safe to gofmt them.
      
      Change-Id: I3067279c1d49809ac6a62054448ab8a6c3de9bda
      Reviewed-on: https://go-review.googlesource.com/43623Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      26a85211
    • Daniel Theophanes's avatar
      database/sql: allow drivers to support custom arg types · a9bf3b2e
      Daniel Theophanes authored
      Previously all arguments were passed through driver.IsValid.
      This checked arguments against a few fundamental go types and
      prevented others from being passed in as arguments.
      
      The new interface driver.NamedValueChecker may be implemented
      by both driver.Stmt and driver.Conn. This allows
      this new interface to completely supersede the
      driver.ColumnConverter interface as it can be used for
      checking arguments known to a prepared statement and
      arbitrary query arguments. The NamedValueChecker may be
      skipped with driver.ErrSkip after all special cases are
      exhausted to use the default argument converter.
      
      In addition if driver.ErrRemoveArgument is returned
      the argument will not be passed to the query at all,
      useful for passing in driver specific per-query options.
      
      Add a canonical Out argument wrapper to be passed
      to OUTPUT parameters. This will unify checks that need to
      be written in the NameValueChecker.
      
      The statement number check is also moved to the argument
      converter so the NamedValueChecker may remove arguments
      passed to the query.
      
      Fixes #13567
      Fixes #18079
      Updates #18417
      Updates #17834
      Updates #16235
      Updates #13067
      Updates #19797
      
      Change-Id: I89088bd9cca4596a48bba37bfd20d987453ef237
      Reviewed-on: https://go-review.googlesource.com/38533Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a9bf3b2e