- 23 May, 2017 8 commits
-
-
Wade Simmons authored
We only need to read the number of bytes required to store the value "max - 1" to generate a random number in the range [0, max). Before, there was an off-by-one error where an extra byte was read from the io.Reader for inputs like "256" (right at the boundary for a byte). There was a similar off-by-one error in the logic for clearing bits and thus for any input that was a power of 2, there was a 50% chance the read would continue to be retried as the mask failed to remove a bit. Fixes #18165. Change-Id: I548c1368990e23e365591e77980e9086fafb6518 Reviewed-on: https://go-review.googlesource.com/43891Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Austin Clements authored
There are two copies each of the stackPreempt/_StackPreempt and stackFork/_StackFork constants. Remove the ones left over from C that are no longer used. Change-Id: I849604c72c11e4a0cb08e45e9817eb3f5a6ce8ba Reviewed-on: https://go-review.googlesource.com/43638Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
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: Keith Randall <khr@golang.org>
-
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: Keith Randall <khr@golang.org>
-
Chris Broadfoot authored
Change-Id: I2ed2e8c4890a65288cf3066ebe3c1d9a16fb4c05 Reviewed-on: https://go-review.googlesource.com/43990Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
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: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
-
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: Filippo Valsorda <hi@filippo.io> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
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: Brad Fitzpatrick <bradfitz@golang.org>
-
- 22 May, 2017 14 commits
-
-
Gustav Westling authored
Fixes #19478 Change-Id: I9fc186610d79fd003e7b5d88c0955286ebe7d3cf Reviewed-on: https://go-review.googlesource.com/38634Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Albert Nigmatzianov authored
Small performance gain: name old time/op new time/op delta Itoa-4 95.4ns ± 4% 95.6ns ± 3% ~ (p=0.256 n=45+46) Println-4 480ns ± 4% 476ns ± 5% -0.87% (p=0.003 n=45+45) PrintlnNoFlags-4 316ns ± 3% 299ns ± 4% -5.38% (p=0.000 n=42+44) name old alloc/op new alloc/op delta Itoa-4 0.00B 0.00B ~ (all equal) Println-4 21.0B ± 0% 21.0B ± 0% ~ (all equal) PrintlnNoFlags-4 21.0B ± 0% 21.0B ± 0% ~ (all equal) name old allocs/op new allocs/op delta Itoa-4 0.00 0.00 ~ (all equal) Println-4 2.00 ± 0% 2.00 ± 0% ~ (all equal) PrintlnNoFlags-4 2.00 ± 0% 2.00 ± 0% ~ (all equal) Change-Id: Idcd03609a5a437a69ffa7004a673bf0b8d22e7ad Reviewed-on: https://go-review.googlesource.com/38056Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
-
Dhananjay Nakrani authored
Fixes #20435. Change-Id: I15576f36b26d01642c1187325baea82d3077e578 Reviewed-on: https://go-review.googlesource.com/43777Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Steven Hartland authored
Due to the fact that -cover injects additional code to the original source, tests run with -cover will often have incorrect line numbers. Also includes docs for -list regexp missed by ba8ff87d Updates #6329 Change-Id: I87f0618ac31e96071bca61055cc17c0cbdee208a Reviewed-on: https://go-review.googlesource.com/38640Reviewed-by: Rob Pike <r@golang.org>
-
Volker Dobler authored
The jarKey function handles broken PublicSuffixList implementations but no test verified it. Change-Id: Ifb76de9e8c3941f3b08d3e43970056e023013457 Reviewed-on: https://go-review.googlesource.com/38357Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Robert Griesemer authored
When restoring syms, we must also restore the original Lastlineno. Bug introduced with https://golang.org/cl/41390/. Fixes #20415. Change-Id: Ie81d36279d717e330951b52f42dcee4b0025b9f0 Reviewed-on: https://go-review.googlesource.com/43811Reviewed-by: Matthew Dempsky <mdempsky@google.com>
-
Volker Dobler authored
According to RFC 6255 a cookie value may contain neither spaces " " nor commas ",". But browsers seem to handle these pretty well and such values are not uncommon in the wild so we do allow spaces and commas in cookie values too. Up to now we use the double-quoted wire format only for cookie values with leading and/or trailing spaces and commas. Values with internal spaces/commas are sent without the optional double quotes. This seems to be a problem for some agents. This CL changes the behaviour for cookie values with spaces or commas: Such values are always sent in double quotes. This should not have any impact on existing agents and the increases of data transmitted is negligible. Fixes #18627 Change-Id: I575a98d589e048aa39d976a3c984550daaca730a Reviewed-on: https://go-review.googlesource.com/37328 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Tristan Colgate authored
Trailers that are not announced in the Trailer must be passed on to the downstream client. Rather than iterate over each and find missing trailer values, this re-adds all trailers to the headers if there is a disparity between the number of announced trailers and the final number. This fixes #20437 Change-Id: I867e85f45feff68616a9a9bd6f65f12d73825eb7 Reviewed-on: https://go-review.googlesource.com/43712Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Alberto Donizetti authored
Change-Id: I020cd3d10a441ba4047800fdf4f93433c458398a Reviewed-on: https://go-review.googlesource.com/43717Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Daniel Theophanes authored
Query and Exec functions on DB first attempt to get a cached connection before requesting the connection pool to ignore the cache and get a new connection. This change aligns Stmt to that behavior as well. Fixes #20433 Change-Id: Idda5f61927289d7ad0882effa3a50ffc9efd88e6 Reviewed-on: https://go-review.googlesource.com/43790 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Steven Hartland authored
Allow the memory limit passed into ReadForm to be used as the memory limit for processing non-file form data as well as file form data, rather than the existing behaviour of the memory limit only applying to the file parts and the non-file parts being arbitrarily limited to 10MB. This ensures backwards compatibility while still providing the user with control over the amount of non-file data that can be processed instead of enforcing an arbitrary 10MB limit. Change-Id: I53c09eae00147d3ff2d6bdfd4e50949267932c3d Reviewed-on: https://go-review.googlesource.com/38195Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Emmanuel Odeke authored
Ensure that the implicitly created redirect for "/route" after "/route/" has been registered doesn't lose the query string information. Fixes #17841. Change-Id: Ib7df9242fab8c9368a18fc0da678003d6bec63b8 Reviewed-on: https://go-review.googlesource.com/43779 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Ben Shi authored
Many instructions can not have a .S suffix, such as MULS, SWI, CLZ, CMP, STREX and others. And so do .P and .W suffixes. Even wrong assembly code is generated for some instructions with invalid suffixes. This patch tries to simplify .S/.W/.P checks. And a wrong assembly test for arm is added. fixes #20377 Change-Id: Iba1c99d9e6b7b16a749b4d93ca2102e17c5822fe Reviewed-on: https://go-review.googlesource.com/43561Reviewed-by: Cherry Zhang <cherryyz@google.com>
-
Rob Phoenix authored
Further examples to support the net package. Updates #5757 Change-Id: I9b65521d211f6c404b9103c1eaf22b0772eb242e Reviewed-on: https://go-review.googlesource.com/43711Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
-
- 20 May, 2017 2 commits
-
-
Mikio Hara authored
This is a followup to https://go-review.googlesource.com/37039. Updates #19435. Change-Id: Ia795bd5158d26effa56e897698208ccf73f9e0d2 Reviewed-on: https://go-review.googlesource.com/43693Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This is a followup to https://go-review.googlesource.com/37038. Updates #19435. Change-Id: If3d56bca0e8816d1a169f5cf97f27b20695a9955 Reviewed-on: https://go-review.googlesource.com/43692Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
- 19 May, 2017 12 commits
-
-
Brad Fitzpatrick authored
It was removed in CL 27325. Fixes #20431 Change-Id: I6842851444186e19029d040f61fdf4f87a3103a6 Reviewed-on: https://go-review.googlesource.com/43771Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Kevin Burke authored
Change-Id: I72a10cd5dfb863f8219bb3b5b8280c017f523cf4 Reviewed-on: https://go-review.googlesource.com/42856Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
-
Daniel Martí authored
Instead of just printing the value, print the original node to make the error more human-friendly. Also print the value if its string form is different than the original node, to make sure it's obvious what value was duplicated. This means that "case '@', '@':", which used to print: duplicate case 64 in switch Will now print: duplicate case '@' (value 64) in switch Factor this logic out into its own function to reuse it in range cases and any other place where we might want to print a node and its value in the future. Also needed to split the errorcheck files because expression switch case duplicates are now detected earlier, so they stop the compiler before it gets to generating the AST and detecting the type switch case duplicates. Fixes #20112. Change-Id: I9009b50dec0d0e705e5de9c9ccb08f1dce8a5a99 Reviewed-on: https://go-review.googlesource.com/41852 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
-
Austin Clements authored
Android O black-lists the select system call because its libc, Bionic, does not use this system call. Replace our use of select with pselect6 (which is allowed) on the platforms that support targeting Android. linux/arm64 already uses pselect6 because there is no select on arm64, so only linux/amd64 and linux/arm need changing. pselect6 has been available since Linux 2.6.16, which is before Go's minimum requirement. Fixes #20409. Change-Id: Ic526b5b259a9e01d2f145a1f4d2e76e8c49ce809 Reviewed-on: https://go-review.googlesource.com/43641 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This change makes {TCP,UDP,IP,Unix}Conn types compliant of syscall.Conn interface and adds type rawConn as an implementation of syscall.RawConn interface. By this change, the long-standing issues regarding unsupported socket options and system calls can be solved partly and the broken x/net packages due to https://go-review.googlesource.com/36799 can be repaired. Fixes #3661. Updates #9661. Updates #19051. Updates #19435. Change-Id: Ic996b040418b54f6d043bc70591789d5a5b23270 Reviewed-on: https://go-review.googlesource.com/37039 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This change adds RawControl, RawRead and RawWrite methods to type FD to make the runtime-integrated network poller work together with a user-defined function. The methods are used via the net package from external packages and type FD is considered as an implementation of syscall.Conn and syscall.RawConn interfaces. Updates #19435. Change-Id: I4ad04b10ffddb2b54fa8d70587440960d73c0a2d Reviewed-on: https://go-review.googlesource.com/37038 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This change adds Conn and RawConn interfaces which can be used to manipulate raw network connection end points typically represented as socket descriptors. Fixes #19435. Change-Id: Ide2d28eeab91bfd27473ab47a87bec69950b64c9 Reviewed-on: https://go-review.googlesource.com/37913 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
-
Alex Brainman authored
Change-Id: Ic6d2de92e1f533a9f9a0cd6d7dab463bdafb0e11 Reviewed-on: https://go-review.googlesource.com/43691Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
-
Alex Brainman authored
Change-Id: If5cb80c3c086684ce6c2e8ed9bb23b2a20c8aacd Reviewed-on: https://go-review.googlesource.com/43690Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Alex Brainman authored
Recent CL 41834 made windows Stat work for all symlinks. But CL 41834 also made Stat slow. John Starks sugested (see https://github.com/golang/go/issues/19922#issuecomment-300031421) to use GetFileAttributesEx for files and directories instead. This makes Stat as fast as at go1.9. I see these improvements on my Windows 7 name old time/op new time/op delta StatDot 26.5µs ± 1% 20.6µs ± 2% -22.37% (p=0.000 n=9+10) StatFile 22.8µs ± 2% 6.2µs ± 1% -72.69% (p=0.000 n=10+10) StatDir 21.0µs ± 2% 6.1µs ± 3% -71.12% (p=0.000 n=10+9) LstatDot 20.1µs ± 1% 20.7µs ± 6% +3.37% (p=0.000 n=9+10) LstatFile 6.23µs ± 1% 6.36µs ± 8% ~ (p=0.587 n=9+10) LstatDir 6.10µs ± 0% 6.14µs ± 4% ~ (p=0.590 n=9+10) and on my Windows XP name old time/op new time/op delta StatDot-2 20.6µs ± 0% 10.8µs ± 0% -47.44% (p=0.000 n=10+10) StatFile-2 20.2µs ± 0% 7.9µs ± 0% -60.91% (p=0.000 n=8+10) StatDir-2 19.3µs ± 0% 7.6µs ± 0% -60.51% (p=0.000 n=10+9) LstatDot-2 10.8µs ± 0% 10.8µs ± 0% -0.48% (p=0.000 n=10+8) LstatFile-2 7.83µs ± 0% 7.83µs ± 0% ~ (p=0.844 n=10+8) LstatDir-2 7.59µs ± 0% 7.56µs ± 0% -0.46% (p=0.000 n=10+10) Updates #19922 Change-Id: Ice1fb5825defb05c79bab4dec0692e0fd1bcfcd5 Reviewed-on: https://go-review.googlesource.com/43071Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Kevin Burke authored
Change-Id: I4b8f1b61c10f60ddb3687759af0be1641c1f78ce Reviewed-on: https://go-review.googlesource.com/43111Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
-
David du Colombier authored
TestScopeRanges has been added in CL 40095. This test is failing on Plan 9 because executables don't have a DWARF symbol table. Fixes #20418. Change-Id: I6dd3baa636998134ccd042203c8b5c3199a4d6e1 Reviewed-on: https://go-review.googlesource.com/43670 Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
-
- 18 May, 2017 4 commits
-
-
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: Ian Lance Taylor <iant@golang.org>
-
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: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Alexander Menzhinsky authored
Fixes #19647 Change-Id: Ife4f98cf2c55ee9490843797213dae2f2647b0a3 Reviewed-on: https://go-review.googlesource.com/40577Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
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: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-