1. 29 Jun, 2015 18 commits
    • Russ Cox's avatar
      runtime: fix broken arm builds · 8b99bb7b
      Russ Cox authored
      Change-Id: I08de33aacb3fc932722286d69b1dd70ffe787c89
      Reviewed-on: https://go-review.googlesource.com/11697Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      8b99bb7b
    • Russ Cox's avatar
      cmd/link: record missing pcdata tables correctly · 434e0bc0
      Russ Cox authored
      The old code was recording the current table output offset,
      so the table from the next function would be used instead of
      the runtime realizing that there was no table at all.
      
      Add debug constant in runtime to check this for every function
      at startup. It's too expensive to do that by default, but we can
      do the last five functions. The end of the table is usually where
      the C symbols end up, so that's where the problems typically are.
      
      Fixes #10747.
      Fixes #11396.
      
      Change-Id: I13592e78017969fc22979fa902e19e1b151d41b1
      Reviewed-on: https://go-review.googlesource.com/11657Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Russ Cox <rsc@golang.org>
      434e0bc0
    • Austin Clements's avatar
      runtime: reset mark state before checkmark and gctrace=2 mark · 1b917484
      Austin Clements authored
      Currently we fail to reset the live heap accounting state before the
      checkmark mark and before the gctrace=2 extra mark. As a result, if
      either are enabled, at the end of GC it thinks there are 0 bytes of
      live heap, which causes the GC controller to initiate a new GC
      immediately, regardless of the true heap size.
      
      Fix this by factoring this state reset into a function and calling it
      before all three possible marks.
      
      This function should be merged with gcResetGState, but doing so
      requires some additional cleanup, so it will wait for after the
      freeze. Filed #11427 for this cleanup.
      
      Fixes #10492.
      
      Change-Id: Ibe46348916fc8368fac6f086e142815c970a6f4d
      Reviewed-on: https://go-review.googlesource.com/11561Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      1b917484
    • Austin Clements's avatar
      runtime: don't free stack spans during GC · d57056ba
      Austin Clements authored
      Memory for stacks is manually managed by the runtime and, currently
      (with one exception) we free stack spans immediately when the last
      stack on a span is freed. However, the garbage collector assumes that
      spans can never transition from non-free to free during scan or mark.
      This disagreement makes it possible for the garbage collector to mark
      uninitialized objects and is blocking us from re-enabling the bad
      pointer test in the garbage collector (issue #9880).
      
      For example, the following sequence will result in marking an
      uninitialized object:
      
      1. scanobject loads a pointer slot out of the object it's scanning.
         This happens to be one of the special pointers from the heap into a
         stack. Call the pointer p and suppose it points into X's stack.
      
      2. X, running on another thread, grows its stack and frees its old
         stack.
      
      3. The old stack happens to be large or was the last stack in its
         span, so X frees this span, setting it to state _MSpanFree.
      
      4. The span gets reused as a heap span.
      
      5. scanobject calls heapBitsForObject, which loads the span containing
         p, which is now in state _MSpanInUse, but doesn't necessarily have
         an object at p. The not-object at p gets marked, and at this point
         all sorts of things can go wrong.
      
      We already have a partial solution to this. When shrinking a stack, we
      put the old stack on a queue to be freed at the end of garbage
      collection. This was done to address exactly this problem, but wasn't
      a complete solution.
      
      This commit generalizes this solution to both shrinking and growing
      stacks. For stacks that fit in the stack pool, we simply don't free
      the span, even if its reference count reaches zero. It's fine to reuse
      the span for other stacks, and this enables that. At the end of GC, we
      sweep for cached stack spans with a zero reference count and free
      them. For larger stacks, we simply queue the stack span to be freed at
      the end of GC. Ideally, we would reuse these large stack spans the way
      we can small stack spans, but that's a more invasive change that will
      have to wait until after the freeze.
      
      Fixes #11267.
      
      Change-Id: Ib7f2c5da4845cc0268e8dc098b08465116972a71
      Reviewed-on: https://go-review.googlesource.com/11502Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      d57056ba
    • Austin Clements's avatar
      runtime: remove unused _GCsweep state · f73b2fca
      Austin Clements authored
      We don't use this state. _GCoff means we're sweeping in the
      background. This makes it clear in the next commit that _GCoff and
      only _GCoff means sweeping.
      
      Change-Id: I416324a829ba0be3794a6cf3cf1655114cb6e47c
      Reviewed-on: https://go-review.googlesource.com/11501Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      f73b2fca
    • Russ Cox's avatar
      cmd/cgo: fix a problem with 'go build -compiler gccgo' · 4e61c516
      Russ Cox authored
      Port of https://golang.org/cl/154360045 to Git.
      Original author is Xia Bin <snyh@snyh.org> (already a contributor).
      
      Fixes #8945.
      
      Change-Id: I28bcaf3348794202ca59fbc3466bd7b9670030e4
      Reviewed-on: https://go-review.googlesource.com/11658Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      4e61c516
    • Austin Clements's avatar
      runtime: always clear stack barriers on G exit · 840965f8
      Austin Clements authored
      Currently the runtime fails to clear a G's stack barriers in gfput if
      the G's stack allocation is _FixedStack bytes. This causes the runtime
      to panic if the following sequence of events happens:
      
      1) The runtime installs stack barriers on a G.
      
      2) The G exits by calling runtime.Goexit. Since this does not
         necessarily return through the stack barriers installed on the G,
         there may still be untriggered stack barriers left on the G's stack
         in recorded in g.stkbar.
      
      3) The runtime calls gfput to add the exiting G to the free pool. If
         the G's stack allocation is _FixedStack bytes, we fail to clear
         g.stkbar.
      
      4) A new G starts and allocates the G that was just added to the free
         pool.
      
      5) The new G begins to execute and overwrites the stack slots that had
         stack barriers in them.
      
      6) The garbage collector enters mark termination, attempts to remove
         stack barriers from the new G, and finds that they've been
         overwritten.
      
      Fix this by clearing the stack barriers in gfput in the case where it
      reuses the stack.
      
      Fixes #11256.
      
      Change-Id: I377c44258900e6bcc2d4b3451845814a8eeb2bcf
      Reviewed-on: https://go-review.googlesource.com/11461Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      840965f8
    • Dmitry Savintsev's avatar
      encoding/binary: update protobuf documentation link · fac7b86a
      Dmitry Savintsev authored
      Updated the protobuf documentation URL (code.google.com deprecated)
      to avoid a redirect.
      
      Change-Id: I134f6e4a2bf2bba699942883bf6347bc61700bcb
      Reviewed-on: https://go-review.googlesource.com/11634Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      fac7b86a
    • Rob Pike's avatar
      fmt: restore padding for %x on byte slices and strings · a76c1a5c
      Rob Pike authored
      Also improve the documentation. A prior fix in this release
      changed the properties for empty strings and slices, incorrectly.
      Previous behavior is now restored and better documented.
      
      Add lots of tests.
      
      The behavior is that when using a string-like format (%s %q %x %X)
      a byte slice is equivalent to a string, and printed as a unit. The padding
      applies to the entire object. (The space and sharp flags apply
      elementwise.)
      
      Fixes #11422.
      Fixes #10430.
      
      Change-Id: I758f0521caf71630437e43990ec6d6c9a92655e3
      Reviewed-on: https://go-review.googlesource.com/11600Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      a76c1a5c
    • Rob Pike's avatar
      doc: fix typo in faq · c97e73d8
      Rob Pike authored
      Change-Id: Id2cfa63d4c749503f729097654d7cbd2b252f192
      Reviewed-on: https://go-review.googlesource.com/11660Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      c97e73d8
    • Rob Pike's avatar
      doc: update FAQ for Go 1.5 · 694b244e
      Rob Pike authored
      Change-Id: I4befb21d0811819ce0a5721421a2f6df7a9b62fa
      Reviewed-on: https://go-review.googlesource.com/11605Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      694b244e
    • Brad Fitzpatrick's avatar
      net/http: fix now-flaky TransportAndServerSharedBodyRace test · 1bab3a16
      Brad Fitzpatrick authored
      TestTransportAndServerSharedBodyRace got flaky after
      issue #9662 was fixed by https://golang.org/cl/11412, which made
      servers hang up on clients when a Handler stopped reading its body
      early.
      
      This test was affected by a race between the the two goroutines in the
      test both only reading part of the request, which was an unnecessary
      detail for what the test was trying to test (concurrent Read/Close
      races on an *http.body)
      
      Also remove an unused remnant from an old test from which this one was
      derived. And make the test not deadlock when it fails. (which was why
      the test was showing up as 2m timeouts on the dashboard)
      
      Fixes #11418
      
      Change-Id: Ic83d18aef7e09a9cd56ac15e22ebed75713026cb
      Reviewed-on: https://go-review.googlesource.com/11610
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      1bab3a16
    • Alex Brainman's avatar
      syscall: return error instead of panicking in windows StartProcess · 0bafe0e5
      Alex Brainman authored
      Fixes #11417
      
      Change-Id: Iacea829a48b39df0a4f751b06b19e918fbb713d0
      Reviewed-on: https://go-review.googlesource.com/11604Reviewed-by: default avatarRob Pike <r@golang.org>
      0bafe0e5
    • Keith Randall's avatar
      cmd/link/internal/ld: exclude only real container symbols from symtab · 214c7a2c
      Keith Randall authored
      It looks like the test for whether symbols contain subsymbols is wrong.
      In particular, symbols in C libraries are mistakenly considered container
      symbols.
      
      Fix the test so only symbols which actually have a subsymbol
      are excluded from the symtab.  When linking cgo programs the list
      of containers is small, something like:
      
      container _/home/khr/sandbox/symtab/misc/cgo/test(.text)<74>
      container _/home/khr/sandbox/symtab/misc/cgo/test/issue8828(.text)<75>
      container _/home/khr/sandbox/symtab/misc/cgo/test/issue9026(.text)<76>
      container runtime/cgo(.text)<77>
      
      I'm not sure this is the right fix.  In particular I can't reproduce
      the original problem.  Anyone have a repro they can try and see if
      this fix works?
      
      Fixes #10747
      Fixes #11396
      
      Change-Id: Id8b016389d33348b4a791fdcba0f9db8ae71ebf3
      Reviewed-on: https://go-review.googlesource.com/11652Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      214c7a2c
    • Adam Langley's avatar
      encoding/asn1: don't parse invalid UTF-8. · 0a6df4a8
      Adam Langley authored
      Invalid UTF-8 triggers an error when marshaling but, previously, not
      when unmarshaling. This means that ASN.1 structures were not
      round-tripping.
      
      This change makes invalid UTF-8 in a string marked as UTF-8 to be an
      error when Unmarshaling.
      
      Fixes #11126.
      
      Change-Id: Ic37be84d21dc5c03983525e244d955a8b1e1ff14
      Reviewed-on: https://go-review.googlesource.com/11056
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      0a6df4a8
    • Adam Langley's avatar
      encoding/asn1: be stricter by reserialising parsed times. · fdd921c9
      Adam Langley authored
      The time package does normalisation of times: for example day zero is
      converted to the last day of the previous month and the 31st of February
      is moved into March etc. This makes the ASN.1 parsing a little
      worryingly lax.
      
      This change causes the parser to reserialise parsed times to ensure that
      they round-trip correctly and thus were not normalised.
      
      Fixes #11134.
      
      Change-Id: I3988bb95153a7b33d64ab861fbe51b1a34a359e9
      Reviewed-on: https://go-review.googlesource.com/11094
      Run-TryBot: Adam Langley <agl@golang.org>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      fdd921c9
    • Alex Brainman's avatar
      runtime: store syscall parameters in m not on stack · 85d4d46f
      Alex Brainman authored
      Stack can move during callback, so libcall struct cannot be stored on stack.
      asmstdcall updates return values and errno in libcall struct parameter, but
      these could be at different location when callback returns.
      Store these in m, so they are not affected by GC.
      
      Fixes #10406
      
      Change-Id: Id01c9d2b4b44530494e6d9e9e1c875261ce477cd
      Reviewed-on: https://go-review.googlesource.com/10370Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      85d4d46f
    • Alex Brainman's avatar
      cmd/go: reset read-only flag during TestIssue10952 · 3b7841b3
      Alex Brainman authored
      git sets read-only flag on all its repo files on Windows.
      os.Remove cannot delete these files.
      
      Fixes windows build
      
      Change-Id: Icaf72470456b88a1c26295caecd4e0d3dc22a1b6
      Reviewed-on: https://go-review.googlesource.com/11602Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      3b7841b3
  2. 28 Jun, 2015 2 commits
  3. 27 Jun, 2015 7 commits
  4. 26 Jun, 2015 13 commits