1. 14 May, 2014 3 commits
    • Guillaume J. Charmes's avatar
      archive/tar: Fix bug preventing untar · 51f3cbab
      Guillaume J. Charmes authored
      Do not use ustar format if we need the GNU one.
      Change \000 to \x00 for consistency
      Check for "ustar\x00" instead of "ustar\x00\x00" for conistency with tar
      and compatiblity with archive generated with older code (which was ustar\x00\x20\x00)
      Add test for long name + big file.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/99050043
      51f3cbab
    • Dmitriy Vyukov's avatar
      cmd/gc: fix out of bounds access · 8c2fefe8
      Dmitriy Vyukov authored
      AddressSanitizer says:
      
      AddressSanitizer: heap-buffer-overflow on address 0x60200001b6f3
      READ of size 6 at 0x60200001b6f3 thread T0
          #0 0x46741b in __interceptor_memcmp asan_interceptors.cc:337
          #1 0x4b5794 in compile src/cmd/6g/../gc/pgen.c:177
          #2 0x509b81 in funccompile src/cmd/gc/dcl.c:1457
          #3 0x520fe2 in p9main src/cmd/gc/lex.c:489
          #4 0x5e2e01 in main src/lib9/main.c:57
          #5 0x7fab81f7976c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226
          #6 0x4b16dc in _start (pkg/tool/linux_amd64/6g+0x4b16dc)
      
      0x60200001b6f3 is located 0 bytes to the right of 3-byte region [0x60200001b6f0,0x60200001b6f3)
      allocated by thread T0 here:
          #0 0x493ec8 in __interceptor_malloc asan_malloc_linux.cc:75
          #1 0x54d64e in mal src/cmd/gc/subr.c:459
          #2 0x5260d5 in yylex src/cmd/gc/lex.c:1605
          #3 0x52078f in p9main src/cmd/gc/lex.c:402
          #4 0x5e2e01 in main src/lib9/main.c:57
      
      If the memory block happens to be at the end of hunk and page bounadry,
      this out-of-bounds can lead to a crash.
      
      LGTM=dave, iant
      R=golang-codereviews, dave, iant
      CC=golang-codereviews
      https://golang.org/cl/93370043
      8c2fefe8
    • Mikio Hara's avatar
      net: fix documentation for SetLinger · d145f0f0
      Mikio Hara authored
      Fixes #7974.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/95320043
      d145f0f0
  2. 13 May, 2014 12 commits
  3. 12 May, 2014 14 commits
    • Russ Cox's avatar
      cmd/gc: fix liveness vs regopt mismatch for input variables · 26ad5d4f
      Russ Cox authored
      The inputs to a function are marked live at all times in the
      liveness bitmaps, so that the garbage collector will not free
      the things they point at and reuse the pointers, so that the
      pointers shown in stack traces are guaranteed not to have
      been recycled.
      
      Unfortunately, no one told the register optimizer that the
      inputs need to be preserved at all call sites. If a function
      is done with a particular input value, the optimizer will stop
      preserving it across calls. For single-word values this just
      means that the value recorded might be stale. For multi-word
      values like slices, the value recorded could be only partially stale:
      it can happen that, say, the cap was updated but not the len,
      or that the len was updated but not the base pointer.
      Either of these possibilities (and others) would make the
      garbage collector misinterpret memory, leading to memory
      corruption.
      
      This came up in a real program, in which the garbage collector's
      'slice len ≤ slice cap' check caught the inconsistency.
      
      Fixes #7944.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews, khr
      https://golang.org/cl/100370045
      26ad5d4f
    • Josh Bleecher Snyder's avatar
      cmd/gc: alias more variables during register allocation · 03c0f3fe
      Josh Bleecher Snyder authored
      This is joint work with Daniel Morsing.
      
      In order for the register allocator to alias two variables, they must have the same width, stack offset, and etype. Code generation was altering a variable's etype in a few places. This prevented the variable from being moved to a register, which in turn prevented peephole optimization. This failure to alias was very common, with almost 23,000 instances just running make.bash.
      
      This phenomenon was not visible in the register allocation debug output because the variables that failed to alias had the same name. The debugging-only change to bits.c fixes this by printing the variable number with its name.
      
      This CL fixes the source of all etype mismatches for 6g, all but one case for 8g, and depressingly few cases for 5g. (I believe that extending CL 6819083 to 5g is a prerequisite.) Fixing the remaining cases in 8g and 5g is work for the future.
      
      The etype mismatch fixes are:
      
      * [gc] Slicing changed the type of the base pointer into a uintptr in order to perform arithmetic on it. Instead, support addition directly on pointers.
      
      * [*g] OSPTR was giving type uintptr to slice base pointers; undo that. This arose, for example, while compiling copy(dst, src).
      
      * [8g] 64 bit float conversion was assigning int64 type during codegen, overwriting the existing uint64 type.
      
      Note that some etype mismatches are appropriate, such as a struct with a single field or an array with a single element.
      
      With these fixes, the number of registerizations that occur while running make.bash for 6g increases ~10%. Hello world binary size shrinks ~1.5%. Running all benchmarks in the standard library show performance improvements ranging from nominal to substantive (>10%); a full comparison using 6g on my laptop is available at https://gist.github.com/josharian/8f9b5beb46667c272064. The microbenchmarks must be taken with a grain of salt; see issue 7920. The few benchmarks that show real regressions are likely due to issue 7920. I manually examined the generated code for the top few regressions and none had any assembly output changes. The few benchmarks that show extraordinary improvements are likely also due to issue 7920.
      
      Performance results from 8g appear similar to 6g.
      
      5g shows no performance improvements. This is not surprising, given the discussion above.
      
      Update #7316
      
      LGTM=rsc
      R=rsc, daniel.morsing, bradfitz
      CC=dave, golang-codereviews
      https://golang.org/cl/91850043
      03c0f3fe
    • Russ Cox's avatar
      cmd/go: detect import cycle caused by test code · 2497c430
      Russ Cox authored
      The runtime was detecting the cycle already,
      but we can give a better error without even
      building the binary.
      
      Fixes #7789.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/96290043
      2497c430
    • Ian Lance Taylor's avatar
      cmd/go: link SWIG objects directly rather than using a shared library · 02cc45ad
      Ian Lance Taylor authored
      This change requires using SWIG version 3.0 or later.  Earlier
      versions of SWIG do not generate the pragmas required to use
      the external linker.
      
      Fixes #7155.
      Fixes #7156.
      
      LGTM=rsc
      R=rsc
      CC=golang-codereviews
      https://golang.org/cl/97120046
      02cc45ad
    • Russ Cox's avatar
      cmd/gc: fix escape analysis for slice of array · f078711b
      Russ Cox authored
      Fixes #7931.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/100390044
      f078711b
    • Fabrizio Milo's avatar
      net/http: fix flaky test · 7e8bc474
      Fabrizio Milo authored
      Prevent idle transport on race condition.
      
      Fixes #7847
      
      LGTM=bradfitz
      R=golang-codereviews, bradfitz
      CC=golang-codereviews
      https://golang.org/cl/96230044
      7e8bc474
    • Brad Fitzpatrick's avatar
      A+C: Fabrizio Milo (individual CLA) · fb392867
      Brad Fitzpatrick authored
      Generated by addca.
      
      R=gobot
      CC=golang-codereviews
      https://golang.org/cl/100390045
      fb392867
    • Russ Cox's avatar
      cmd/gc: record line number for auto-generated wrappers as <autogenerated>:1 · 9b976f5f
      Russ Cox authored
      Before we used line 1 of the first source file.
      This should be clearer.
      
      Fixes #4388.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/92250044
      9b976f5f
    • Brad Fitzpatrick's avatar
      undo CL 92210044 / 5cb21eee2d35 · c91aea6c
      Brad Fitzpatrick authored
      <enter reason for undo>
      
      ««« original CL description
      net: make use of SO_LINGER_SEC on darwin
      
      Fixes #7971.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/92210044
      »»»
      
      TBR=iant
      R=golang-codereviews
      CC=golang-codereviews
      https://golang.org/cl/96220049
      c91aea6c
    • Mikio Hara's avatar
      net: make use of SO_LINGER_SEC on darwin · 900d49bf
      Mikio Hara authored
      Fixes #7971.
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/92210044
      900d49bf
    • Russ Cox's avatar
      cmd/go: better error for install of 'test-only' package · f4096819
      Russ Cox authored
      Fixes #7915.
      
      LGTM=bradfitz
      R=golang-codereviews, bradfitz
      CC=golang-codereviews
      https://golang.org/cl/96210044
      f4096819
    • Russ Cox's avatar
      runtime: add copy of math.sqrt for use by arm softfloat · ee7bb07a
      Russ Cox authored
      If it's not used (such as on other systems or if softfloat
      is disabled) the linker will discard it.
      
      The alternative is to teach cmd/go that every binary
      depends on math implicitly on arm. I started down that
      path but it's too scary. If we're going to get dependencies
      right we should get dependencies right.
      
      Fixes #6994.
      
      LGTM=bradfitz, dave
      R=golang-codereviews, bradfitz, dave
      CC=golang-codereviews
      https://golang.org/cl/95290043
      ee7bb07a
    • Alex Brainman's avatar
      cmd/objdump: works with windows pe executables now · 20aa947c
      Alex Brainman authored
      Most code is copy from addr2line change 01dd67e5827f
      
      Update #7406
      Fixes #7937
      
      LGTM=iant
      R=golang-codereviews, iant, 0intro
      CC=golang-codereviews
      https://golang.org/cl/95090044
      20aa947c
    • Péter Surányi's avatar
      unicode: fix doc typo · 176041e4
      Péter Surányi authored
      LGTM=robert.hencke, iant
      R=golang-codereviews, robert.hencke, iant
      CC=golang-codereviews
      https://golang.org/cl/96230043
      176041e4
  4. 11 May, 2014 4 commits
  5. 10 May, 2014 3 commits
  6. 09 May, 2014 4 commits