1. 02 May, 2018 7 commits
  2. 01 May, 2018 30 commits
  3. 30 Apr, 2018 3 commits
    • Brian Kessler's avatar
      math/big: return nil for nonexistent ModInverse · 4d44a872
      Brian Kessler authored
      Currently, the behavior of z.ModInverse(g, n) is undefined
      when g and n are not relatively prime.  In that case, no
      ModInverse exists which can be easily checked during the
      computation of the ModInverse.  Because the ModInverse does
      not indicate whether the inverse exists, there are reimplementations
      of a "checked" ModInverse in crypto/rsa.  This change removes the
      undefined behavior.  If the ModInverse does not exist, the receiver z
      is unchanged and the return value is nil. This matches the behavior of
      ModSqrt for the case where the square root does not exist.
      
      name          old time/op    new time/op    delta
      ModInverse-4    2.40µs ± 4%    2.22µs ± 0%   -7.74%  (p=0.016 n=5+4)
      
      name          old alloc/op   new alloc/op   delta
      ModInverse-4    1.36kB ± 0%    1.17kB ± 0%  -14.12%  (p=0.008 n=5+5)
      
      name          old allocs/op  new allocs/op  delta
      ModInverse-4      10.0 ± 0%       9.0 ± 0%  -10.00%  (p=0.008 n=5+5)
      
      Fixes #24922
      
      Change-Id: If7f9d491858450bdb00f1e317152f02493c9c8a8
      Reviewed-on: https://go-review.googlesource.com/108996
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      4d44a872
    • Elias Naur's avatar
      runtime: perform crashes outside systemstack · b1d1ec91
      Elias Naur authored
      CL 93658 moved stack trace printing inside a systemstack call to
      sidestep complexity in case the runtime is in a inconsistent state.
      
      Unfortunately, debuggers generating backtraces for a Go panic
      will be confused and come up with a technical correct but useless
      stack. This CL moves just the crash performing - typically a SIGABRT
      signal - outside the systemstack call to improve backtraces.
      
      Unfortunately, the crash function now needs to be marked nosplit and
      that triggers the no split stackoverflow check. To work around that,
      split fatalpanic in two: fatalthrow for runtime.throw and fatalpanic for
      runtime.gopanic. Only Go panics really needs crashes on the right stack
      and there is enough stack for gopanic.
      
      Example program:
      
      package main
      
      import "runtime/debug"
      
      func main() {
      	debug.SetTraceback("crash")
      	crash()
      }
      
      func crash() {
      	panic("panic!")
      }
      
      Before:
      (lldb) bt
      * thread #1, name = 'simple', stop reason = signal SIGABRT
        * frame #0: 0x000000000044ffe4 simple`runtime.raise at <autogenerated>:1
          frame #1: 0x0000000000438cfb simple`runtime.dieFromSignal(sig=<unavailable>) at signal_unix.go:424
          frame #2: 0x0000000000438ec9 simple`runtime.crash at signal_unix.go:525
          frame #3: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758
          frame #4: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
          frame #5: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
          frame #6: 0x000000000042a980 simple at proc.go:1094
          frame #7: 0x0000000000438ec9 simple`runtime.crash at signal_unix.go:525
          frame #8: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758
          frame #9: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
          frame #10: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
          frame #11: 0x000000000042a980 simple at proc.go:1094
          frame #12: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758
          frame #13: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
          frame #14: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
          frame #15: 0x000000000042a980 simple at proc.go:1094
          frame #16: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
          frame #17: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
      
      After:
      (lldb) bt
      * thread #7, stop reason = signal SIGABRT
        * frame #0: 0x0000000000450024 simple`runtime.raise at <autogenerated>:1
          frame #1: 0x0000000000438d1b simple`runtime.dieFromSignal(sig=<unavailable>) at signal_unix.go:424
          frame #2: 0x0000000000438ee9 simple`runtime.crash at signal_unix.go:525
          frame #3: 0x00000000004264e3 simple`runtime.fatalpanic(msgs=<unavailable>) at panic.go:664
          frame #4: 0x0000000000425f1b simple`runtime.gopanic(e=<unavailable>) at panic.go:537
          frame #5: 0x0000000000470c62 simple`main.crash at simple.go:11
          frame #6: 0x0000000000470c00 simple`main.main at simple.go:6
          frame #7: 0x0000000000427be7 simple`runtime.main at proc.go:198
          frame #8: 0x000000000044ef91 simple`runtime.goexit at <autogenerated>:1
      
      Updates #22716
      
      Change-Id: Ib5fa35c13662c1dac2f1eac8b59c4a5824b98d92
      Reviewed-on: https://go-review.googlesource.com/110065
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      b1d1ec91
    • Balaram Makam's avatar
      cmd/asm: add vector instructions for ChaCha20Poly1305 on ARM64 · c789ce3f
      Balaram Makam authored
      This change provides VZIP1, VZIP2, VTBL instruction for supporting
      ChaCha20Poly1305 implementation later.
      
      Change-Id: Ife7c87b8ab1a6495a444478eeb9d906ae4c5ffa9
      Reviewed-on: https://go-review.googlesource.com/110015Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c789ce3f