1. 27 Jun, 2017 3 commits
  2. 26 Jun, 2017 2 commits
  3. 23 Jun, 2017 5 commits
    • runtime: complete defer handling in CgocallBackDone · f1857c63
          
          When C code calls a Go function, it actually calls a function
          generated by cgo. That function is written in Go, and, among other
          things, it calls the real Go function like this:
                  CgocallBack()
                  defer CgocallBackDone()
                  RealGoFunction()
          The deferred CgocallBackDone function enters syscall mode as we return
          to C. Typically the C function will then eventually return to Go.
          
          However, in the case where the C function is running on a thread
          created in C, it will not return to Go. For that case we will have
          allocated an m struct, with an associated g struct, for the duration
          of the Go code, and when the Go is complete we will return the m and g
          to a free list.
          
          That all works, but we are running in a deferred function, which means
          that we have been invoked by deferreturn, and deferreturn expects to
          do a bit of cleanup to record that the defer has been completed. Doing
          that cleanup while using an m and g that have already been returned to
          the free list is clearly a bad idea. It was kind of working because
          deferreturn was holding the g pointer in a local variable, but there
          were races with some other thread picking up and using the newly freed g.
          It was also kind of working because of a special check in freedefer;
          that check is no longer necessary.
          
          This patch changes the special case of releasing the m and g to do the
          defer cleanup in CgocallBackDone itself.
          
          This patch also checks for the special case of a panic through
          CgocallBackDone. In that special case, we don't want to release the m
          and g. Since we are returning to C code that was not called by Go
          code, we know that the panic is not going to be caught and we are
          going to exit the program. So for that special case we keep the m and
          g structs so that the rest of the panic code can use them.
          
          Reviewed-on: https://go-review.googlesource.com/46530
      
      From-SVN: r249611
      Ian Lance Taylor committed
    • os: align siginfo argument to waitid · 3c76bd92
          
          Backport https://golang.org/cl/46511 from gc trunk, as it may fix a
          bug reported for gccgo running on MIPS
          (https://groups.google.com/d/msg/golang-dev/sDg-t1_DPw0/-AJmLxgPBQAJ).
          
          Reviewed-on: https://go-review.googlesource.com/46571
      
      From-SVN: r249599
      Ian Lance Taylor committed
    • runtime: don't crash if no p in kickoff · bb96aa67
          
          The kickoff function for g0 can be invoked without a p, for example
          from mcall(exitsyscall0) in exitsyscall after exitsyscall has cleared
          the p field. The assignment gp.param = nil will invoke a write barrier.
          If gp.param is not already nil, this will require a p. Avoid the problem
          for a specific case that is known to be OK: when the value in gp.param
          is a *g.
          
          Reviewed-on: https://go-review.googlesource.com/46512
      
      From-SVN: r249595
      Ian Lance Taylor committed
    • runtime: improve handling of panic during deferred function · 54357b3b
          
          When a panic occurs while processing a deferred function that
          recovered an earlier panic, we shouldn't report the recovered panic
          in the panic stack trace. Stop doing so by keeping track of the panic
          that triggered a defer, marking it as aborted if we see the defer again,
          and discarding aborted panics when a panic is recovered. This is what
          the gc runtime does.
          
          The test for this is TestRecursivePanic in runtime/crash_test.go.
          We don't run that test yet, but we will soon.
          
          Reviewed-on: https://go-review.googlesource.com/46461
      
      From-SVN: r249590
      Ian Lance Taylor committed
  4. 22 Jun, 2017 14 commits
  5. 21 Jun, 2017 8 commits
  6. 14 Jun, 2017 5 commits
  7. 13 Jun, 2017 2 commits
  8. 12 Jun, 2017 1 commit
    • runtime: ignore _Gscan bit when checking status in CgocallDone · a282a875
          
          Also always access the atomicstatus field atomically.
          
          The effect of not checking the _Gscan bit is that if the GC decides to
          scan the stack just as the goroutine is leaving the system call, the
          goroutine might fail to call exitsyscall.  Then then typically causes
          a runtime assertion failure later on.  If we do call exitsyscall as we
          should, it will stall (in casgstatus) until the _Gscan bit is cleared.
          
          No separate test.  I've observed causing sporadic failures running the
          misc/cgo tests, but we don't currently have a way to run those
          routinely for gccgo.  I should fix that.
          
          Reviewed-on: https://go-review.googlesource.com/45392
      
      From-SVN: r249138
      Ian Lance Taylor committed