aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-11[release-branch.go1.5] go1.5.4go1.5.4release-branch.go1.5Andrew Gerrand
Change-Id: I7b62b2f358d2c2540e8d84e5c4739cfba73a19d1 Reviewed-on: https://go-review.googlesource.com/21827 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Andrew Gerrand <adg@golang.org>
2016-04-08runtime: leave directory before removing it in TestDLLPreloadMitigationAlex Brainman
Fixes #15120 Change-Id: I1d9a192ac163826bad8b46e8c0b0b9e218e69570 Reviewed-on: https://go-review.googlesource.com/21520 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/21681 Run-TryBot: Andrew Gerrand <adg@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-04-08syscall: point to x/sys in DLL loading docs, update syscall generatorBrad Fitzpatrick
Updates the syscall generator for patchset 4 of https://golang.org/cl/21388. Updates #14959 Change-Id: Icbd6df489887d3dcc076dfc73d4feb1376abaf8b Reviewed-on: https://go-review.googlesource.com/21428 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-on: https://go-review.googlesource.com/21680 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08runtime, syscall: only search for Windows DLLs in the System32 directoryBrad Fitzpatrick
Make sure that for any DLL that Go uses itself, we only look for the DLL in the Windows System32 directory, guarding against DLL preloading attacks. (Unless the Windows version is ancient and LoadLibraryEx is unavailable, in which case the user probably has bigger security problems anyway.) This does not change the behavior of syscall.LoadLibrary or NewLazyDLL if the DLL name is something unused by Go itself. This change also intentionally does not add any new API surface. Instead, x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in: https://golang.org/cl/21388 Updates #14959 Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9 Reviewed-on: https://go-review.googlesource.com/21140 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/21639 Run-TryBot: Andrew Gerrand <adg@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08crypto/rsa, crypto/ecdsa: fail earlier on zero parametersBrad Fitzpatrick
Change-Id: Ia6ed49d5ef3a256a55e6d4eaa1b4d9f0fc447013 Reviewed-on: https://go-review.googlesource.com/21560 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-on: https://go-review.googlesource.com/21638 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Andrew Gerrand <adg@golang.org>
2016-04-08crypto/dsa: eliminate invalid PublicKey earlyRobert Griesemer
For PublicKey.P == 0, Verify will fail. Don't even try. Change-Id: I1009f2b3dead8d0041626c946633acb10086d8c8 Reviewed-on: https://go-review.googlesource.com/21533 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/21637
2016-01-27[release-branch.go1.5] doc: update install from source instructions for go1.5.3Alberto Donizetti
Fixes #14020 Change-Id: I454c2613912a7efcb464c6e6f3ac2e0ec89fb719 Reviewed-on: https://go-review.googlesource.com/18750 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/18945
2016-01-13[release-branch.go1.5] go1.5.3go1.5.3Chris Broadfoot
Change-Id: Id0700749ff51122cd3e0793f5d6adb50121bfe6c Reviewed-on: https://go-review.googlesource.com/18595 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-13[release-branch.go1.5] math/big: fix nat testRuss Cox
Go 1.5 does not have nat.utoa(16) but has nat.hexString(). Change-Id: Iac91c8bf3c6cd404f255f75d237c2d3b84d99359 Reviewed-on: https://go-review.googlesource.com/18613 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-13[release-branch.go1.5] doc: document Go 1.5.3Russ Cox
Change-Id: I9b4b76abfba66ff655aef55b43d9b4721aba604a Reviewed-on: https://go-review.googlesource.com/18587 Reviewed-by: Chris Broadfoot <cbro@golang.org> Reviewed-on: https://go-review.googlesource.com/18594 Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13[release-branch.go1.5] math/big: fix Exp(x, x, x) for certain large xRuss Cox
Fixes #13907. Change-Id: Ieaa5183f399b12a9177372212adf481c8f0b4a0d Reviewed-on: https://go-review.googlesource.com/18491 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Vlad Krasnov <vlad@cloudflare.com> Reviewed-by: Adam Langley <agl@golang.org> Reviewed-on: https://go-review.googlesource.com/18586 Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-13[release-branch.go1.5] math/big: fix carry propagation in Int.Exp Montgomery ↵Russ Cox
code Fixes #13515. Change-Id: I7dd5fbc816e5ea135f7d81f6735e7601f636fe4f Reviewed-on: https://go-review.googlesource.com/17672 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-on: https://go-review.googlesource.com/18585
2015-12-07[release-branch.go1.5] doc: add heading IDs to Code of ConductChris Broadfoot
Fixes #13514 Change-Id: I3903d3926ed4f5d54cfb77209d93c950b832b933 Reviewed-on: https://go-review.googlesource.com/17511 Reviewed-by: Francesc Campoy Flores <campoy@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/17512 Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-12-04doc: correct ordering of go1.5 minor revisionsChris Broadfoot
Fixes #13474 Change-Id: Ic86e54f6bc67db46504f7d43a0666647af308177 Reviewed-on: https://go-review.googlesource.com/17404 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/17406 Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-12-03[release-branch.go1.5] go1.5.2go1.5.2Chris Broadfoot
Change-Id: I65289f4019a975126d4cda3fd26379829912c0cd Reviewed-on: https://go-review.googlesource.com/17336 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-03[release-branch.go1.5] doc: correct release date for go1.5.2Chris Broadfoot
Change-Id: I6bee207db7485f96a499f51b2d1346c35e086d41 Reviewed-on: https://go-review.googlesource.com/17337 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/17338 Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-12-03[release-branch.go1.5] doc: document go1.5.2Chris Broadfoot
Change-Id: Ib6a9e131113523e6b1e5b7604480028b9ffbfa93 Reviewed-on: https://go-review.googlesource.com/17178 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-on: https://go-review.googlesource.com/17335 Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-11-24[release-branch.go1.5] doc: add Code of ConductAndrew Gerrand
Fixes #13073 Change-Id: I4fd9c6c61f1b9d49f66816839ca35209b4147ae3 Reviewed-on: https://go-review.googlesource.com/17167 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/17168 Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-24[release-branch.go1.5] runtime: take stack barrier lock during copystackAustin Clements
Commit bbd1a1c prevented SIGPROF from scanning stacks that were being copied, but it didn't prevent a stack copy (specifically a stack shrink) from happening while SIGPROF is scanning the stack. As a result, a stack copy may adjust stack barriers while SIGPROF is in the middle of scanning a stack, causing SIGPROF to panic when it detects an inconsistent stack barrier. Fix this by taking the stack barrier lock while adjusting the stack. In addition to preventing SIGPROF from scanning this stack, this will block until any in-progress SIGPROF is done scanning the stack. For 1.5.2. Fixes #13362. Updates #12932. Change-Id: I422219c363054410dfa56381f7b917e04690e5dd Reviewed-on: https://go-review.googlesource.com/17191 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/17194
2015-11-24[release-branch.go1.5] runtime: improve stack barrier debuggingAustin Clements
This improves stack barrier debugging messages in various ways: 1) Rather than printing only the remaining stack barriers (of which there may be none, which isn't very useful), print all of the G's stack barriers with a marker at the position the stack itself has unwound to and a marker at the problematic stack barrier (where applicable). 2) Rather than crashing if we encounter a stack barrier when there are no more stkbar entries, print the same debug message we would if we had encountered a stack barrier at an unexpected location. Hopefully this will help with debugging #12528. Change-Id: I2e6fe6a778e0d36dd8ef30afd4c33d5d94731262 Reviewed-on: https://go-review.googlesource.com/17147 Reviewed-by: Rick Hudson <rlh@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/17193 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-23[release-branch.go1.5] misc/ios: keep whole buffer in go_darwin_arm_execDavid Crawshaw
The existing go_darwin_arm_exec.go script does not work with Xcode 7, not due to any significant changes, but just ordering and timing of statements from lldb. Unfortunately the current design of go_darwin_arm_exec.go makes it not obvious what gets stuck where, so this moves from a moving buffer window to a complete buffer of the lldb output. The result is easier code to follow, and it works with Xcode 7. Updates #12660. Change-Id: I3b8b890b0bf4474119482e95d84e821a86d1eaed Reviewed-on: https://go-review.googlesource.com/16634 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-on: https://go-review.googlesource.com/17146
2015-11-23[release-branch.go1.5] cmd/cgo: ignore vars with no name or type if they ↵Ian Lance Taylor
have a AttrSpecification Fixes #13344. Change-Id: I33c6721fd33d144c85c87840ddf27ce15aa72328 Reviewed-on: https://go-review.googlesource.com/17151 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/17145 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-23[release-branch.go1.5] cmd/go: disable TestNoteReading on dragonflyRuss Cox
It started failing on the dragonfly builder at an unrelated commit (one that changed the wording in a few comments in the compiler). Created #13364 to track this. Change-Id: I462880bed8ff565a9950e7e185de97d43999c5e2 Reviewed-on: https://go-review.googlesource.com/17143 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/17144
2015-11-23[release-branch.go1.5] runtime: fix bad signal stack when using cgo-created ↵Russ Cox
threads and async signals Cgo-created threads transition between having associated Go g's and m's and not. A signal arriving during the transition could think it was safe and appropriate to run Go signal handlers when it was in fact not. Avoid the race by masking all signals during the transition. Fixes #12277. Change-Id: Ie9711bc1d098391d58362492197a7e0f5b497d14 Reviewed-on: https://go-review.googlesource.com/16915 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/17141
2015-11-23[release-branch.go1.5] cmd/go: fix Go buildid reading on SolarisShawn Walker-Salas
TestNoteReading fails on Solaris with linkmode=external due to some assumptions made about how ELF .note sections are written by some linkers. On current versions of Solaris and older derivatives, SHF_ALLOC is intentionally ignored for .note sections unless the .note section is assigned to the text segment via a mapfile. Also, if .note sections are assigned to the text segment, no PT_NOTE program header will be created thwarting Go's attempts at attempting to quickly find the .note. Furthermore, Go assumes that the relevant note segment will be placed early in the file while the Solaris linker currently places the note segment last in the file, additionally thwarting Go's optimisation attempts that read only the first 16KB of the file to find the buildid. The fix is to detect when the note section is outside of the first 16KB of the file and then fallback to additionally reading that section of the file. This way, in future versions of Solaris when this linking behaviour is changed, the fast path will always succeed and we'll only be slower if it fails; likewise, any other linker that does this will also just work. Fixes #12178 Change-Id: I61c1dc3f744ae3ad63938386d2ace8a432c0efe1 Reviewed-on: https://go-review.googlesource.com/14210 Run-TryBot: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-on: https://go-review.googlesource.com/17142 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-23[release-branch.go1.5] runtime: make it possible to call syscall on solaris ↵Shenghou Ma
without g The nosplit stack is now much bigger, so we can afford to allocate libcall on stack. Fix asmsysvicall6 to not update errno if g == nil. These two fixes TestCgoCallbackGC on solaris, which used to stuck in a loop. Change-Id: Id1b13be992dae9f059aa3d47ffffd37785300933 Reviewed-on: https://go-review.googlesource.com/17076 Run-TryBot: Minux Ma <minux@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/17140 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-11-23[release-branch.go1.5] runtime: make asmcgocall work without a gRuss Cox
Solaris needs to make system calls without a g, and Solaris uses asmcgocall to make system calls. I know, I know. I hope this makes CL 16915, fixing #12277, work on Solaris. Change-Id: If988dfd37f418b302da9c7096f598e5113ecea87 Reviewed-on: https://go-review.googlesource.com/17072 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/17129
2015-11-23[release-branch.go1.5] cmd/go: skip TestNoteReading2K on WindowsRuss Cox
It's intended primarily as a torture test for OS X. Apparently Windows can't take it. Updates fix for #12327. Change-Id: If2af249ea8e2f55bff8f232dce06172e6fef9f49 Reviewed-on: https://go-review.googlesource.com/17073 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/17128 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-23[release-branch.go1.5] cmd/go: fix loading of buildid on OS X executablesRuss Cox
This is a bit of a belt-and-suspenders fix. On OS X, we now parse the Mach-O file to find the __text section, which is arguably the more proper fix. But it's a bit worrisome to depend on a name like __text not changing, so we also read more of the initial file (now 32 kB, up from 8 kB) and scan that too. Fixes #12327. Change-Id: I3a201a3dc278d24707109bb3961c3bdd8b8a0b7b Reviewed-on: https://go-review.googlesource.com/17038 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/17127
2015-11-23[release-branch.go1.5] cmd/link: link go.o firstRuss Cox
Does not fix #12327 but nicer anyway. Change-Id: I4ad730a4ca833d76957b7571895b3a08a6a530d4 Reviewed-on: https://go-review.googlesource.com/16964 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/17126
2015-11-23[release-branch.go1.5] cmd/compile: fix crash with -race on large expr ↵Russ Cox
containing string->[]byte conversion The assumption is that there are no nested function calls in complex expressions. For the most part that assumption is true. It wasn't for these calls inserted during walk. Fix that. I looked through all the calls to mkcall in walk and these were the only cases that emitted calls, that could be part of larger expressions (like not delete), and that were not already handled. Fixes #12225. Change-Id: Iad380683fe2e054d480e7ae4e8faf1078cdd744c Reviewed-on: https://go-review.googlesource.com/17034 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/17125
2015-11-23[release-branch.go1.5] cmd/compile: fix Val vs Opt collisionRuss Cox
Fixes #12686. Change-Id: I7a9f49dbd1f60b1d0240de57787753b425f9548c Reviewed-on: https://go-review.googlesource.com/17031 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/17124
2015-11-20[release-branch.go1.5] runtime: prevent sigprof during all stack barrier opsAustin Clements
A sigprof during stack barrier insertion or removal can crash if it detects an inconsistency between the stkbar array and the stack itself. Currently we protect against this when scanning another G's stack using stackLock, but we don't protect against it when unwinding stack barriers for a recover or a memmove to the stack. This commit cleans up and improves the stack locking code. It abstracts out the lock and unlock operations. It uses the lock consistently everywhere we perform stack operations, and pushes the lock/unlock down closer to where the stack barrier operations happen to make it more obvious what it's protecting. Finally, it modifies sigprof so that instead of spinning until it acquires the lock, it simply doesn't perform a traceback if it can't acquire it. This is necessary to prevent self-deadlock. Updates #11863, which introduced stackLock to fix some of these issues, but didn't go far enough. Updates #12528. Change-Id: I9d1fa88ae3744d31ba91500c96c6988ce1a3a349 Reviewed-on: https://go-review.googlesource.com/17036 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/17057
2015-11-20[release-branch.go1.5] runtime: fix new stack barrier checkRuss Cox
During a crash showing goroutine stacks of all threads (with GOTRACEBACK=crash), it can be that f == nil. Only happens on Solaris; not sure why. Change-Id: Iee2c394a0cf19fa0a24f6befbc70776b9e42d25a Reviewed-on: https://go-review.googlesource.com/17110 Reviewed-by: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/17122 Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-20[release-branch.go1.5] runtime: handle sigprof in stackBarrierAustin Clements
Currently, if a profiling signal happens in the middle of stackBarrier, gentraceback may see inconsistencies between stkbar and the barriers on the stack and it will certainly get the wrong return PC for stackBarrier. In most cases, the return PC won't be a PC at all and this will immediately abort the traceback (which is considered okay for a sigprof), but if it happens to be a valid PC this may sent gentraceback down a rabbit hole. Fix this by detecting when the gentraceback starts in stackBarrier and simulating the completion of the barrier to get the correct initial frame. Change-Id: Ib11f705ac9194925f63fe5dfbfc84013a38333e6 Reviewed-on: https://go-review.googlesource.com/17035 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/17056
2015-11-17[release-branch.go1.5] runtime: handle sysReserve returning a pointer below ↵Austin Clements
the arena In mheap.sysAlloc, if an allocation at arena_used would exceed arena_end (but wouldn't yet push us past arena_start+_MaxArean32), it trie to extend the arena reservation by another 256 MB. It extends the arena by calling sysReserve, which, on 32-bit, calls mmap without MAP_FIXED, which means the address is just a hint and the kernel can put the mapping wherever it wants. In particular, mmap may choose an address below arena_start (the kernel also chose arena_start, so there could be lots of space below it). Currently, we don't detect this case and, if it happens, mheap.sysAlloc will corrupt arena_end and arena_used then return the low pointer to mheap.grow, which will crash when it attempts to index in to h_spans with an underflowed index. Fix this by checking not only that that p+p_size isn't too high, but that p isn't too low. Fixes #13143. Change-Id: I8d0f42bd1484460282a83c6f1a6f8f0df7fb2048 Reviewed-on: https://go-review.googlesource.com/16927 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/16988 Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] runtime: avoid stat underflow crashAustin Clements
If the area returned by sysReserve in mheap.sysAlloc is outside the usable arena, we sysFree it. We pass a fake stat pointer to sysFree because we haven't added the allocation to any stat at that point. However, we pass a 0 stat, so sysFree panics when it decrements the stat because the fake stat underflows. Fix this by setting the fake stat to the allocation size. Updates #13143 (this is a prerequisite to fixing that bug). Change-Id: I61a6c9be19ac1c95863cf6a8435e19790c8bfc9a Reviewed-on: https://go-review.googlesource.com/16926 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/16987 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] runtime: ignore rt_sigaction error if it is for SIGRTMAXMichael Hudson-Doyle
A forward port of https://codereview.appspot.com/124900043/ which somehow got lost somewhere. Fixes #13024 Change-Id: Iab128899e65c51d90f6704e3e1b2fc9326e3a1c2 Reviewed-on: https://go-review.googlesource.com/16853 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/16986 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-17[release-branch.go1.5] runtime: make SIGPROF skip stacks that are being copiedAustin Clements
sigprof tracebacks the stack across systemstack switches to make profile tracebacks more complete. However, it does this even if the user stack is currently being copied, which means it may be in an inconsistent state that will cause the traceback to panic. One specific way this can happen is during stack shrinking. Some goroutine blocks for STW, then enters gchelper, which then assists with root marking. If that root marking happens to pick the original goroutine and its stack needs to be shrunk, it will begin to copy that stack. During this copy, the stack is generally inconsistent and, in particular, the actual locations of the stack barriers and their recorded locations are temporarily out of sync. If a SIGPROF happens during this inconsistency, it will walk the stack all the way back to the blocked goroutine and panic when it fails to unwind the stack barriers. Fix this by disallowing jumping to the user stack during SIGPROF if that user stack is in the process of being copied. Fixes #12932. Change-Id: I9ef694c2c01e3653e292ce22612418dd3daff1b4 Reviewed-on: https://go-review.googlesource.com/16819 Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/16985 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] net: fix off by one error while counting interfaces ↵Alex Brainman
on windows Fixes #12301 Change-Id: I8d01ec9551c6cff7e6129e06a7deb36a3be9de41 Reviewed-on: https://go-review.googlesource.com/16751 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/16984 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] cmd/internal/obj/ppc64: fix assembly of SRADCC with ↵Michael Hudson-Doyle
immediate sradi and sradi. hide the top bit of their immediate argument apart from the rest of it, but the code only handled the sradi case. I'm pretty sure this is the only instruction missing (a couple of the rotate instructions encode their immediate the same way but their handling looks OK). This fixes the failure of "GOARCH=amd64 ~/go/bin/go install -v runtime" as reported in the bug. Fixes #11987 Change-Id: I0cdefcd7a04e0e8fce45827e7054ffde9a83f589 Reviewed-on: https://go-review.googlesource.com/16710 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/16983 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] cmd/link: support new 386/amd64 relocationsIan Lance Taylor
The GNU binutils recently picked up support for new 386/amd64 relocations. Add support for them in the Go linker when doing an internal link. The 386 relocation R_386_GOT32X was proposed in https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I . It can be treated as identical to the R_386_GOT32 relocation. The amd64 relocations R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX were proposed in https://groups.google.com/forum/#!topic/x86-64-abi/n9AWHogmVY0 . They can both be treated as identical to the R_X86_64_GOTPCREL relocation. The purpose of the new relocations is to permit additional linker relaxations in some cases. We do not attempt to support those cases. While we're at it, remove the unused and in some cases out of date _COUNT names from ld/elf.go. Fixes #13114. Change-Id: I34ef07f6fcd00cdd2996038ecf46bb77a49e968b Reviewed-on: https://go-review.googlesource.com/16529 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/16982 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] cmd/compile: do not let regopt use REGTMP on ppc64Michael Hudson-Doyle
ppc64 codegen assumes that it is OK to stomp on r31 at any time, but it is not excluded from the set of registers that regopt is allowed to use. Fixes #12597 Change-Id: I29c7655e32abd22f3c21d88427b73e4fca055233 Reviewed-on: https://go-review.googlesource.com/15245 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/16981 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] runtime: adjust huge page flags only on huge page ↵Austin Clements
granularity This fixes an issue where the runtime panics with "out of memory" or "cannot allocate memory" even though there's ample memory by reducing the number of memory mappings created by the memory allocator. Commit 7e1b61c worked around issue #8832 where Linux's transparent huge page support could dramatically increase the RSS of a Go process by setting the MADV_NOHUGEPAGE flag on any regions of pages released to the OS with MADV_DONTNEED. This had the side effect of also increasing the number of VMAs (memory mappings) in a Go address space because a separate VMA is needed for every region of the virtual address space with different flags. Unfortunately, by default, Linux limits the number of VMAs in an address space to 65530, and a large heap can quickly reach this limit when the runtime starts scavenging memory. This commit dramatically reduces the number of VMAs. It does this primarily by only adjusting the huge page flag at huge page granularity. With this change, on amd64, even a pessimal heap that alternates between MADV_NOHUGEPAGE and MADV_HUGEPAGE must reach 128GB to reach the VMA limit. Because of this rounding to huge page granularity, this change is also careful to leave large used and unused regions huge page-enabled. This change reduces the maximum number of VMAs during the runtime benchmarks with GODEBUG=scavenge=1 from 692 to 49. Fixes #12233. Change-Id: Ic397776d042f20d53783a1cacf122e2e2db00584 Reviewed-on: https://go-review.googlesource.com/15191 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-on: https://go-review.googlesource.com/16980 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] multipart: fixes problem parsing mime/multipart of ↵Francisco Claude
certain lengths When parsing the multipart data, if the delimiter appears but doesn't finish with -- or \n or \r\n, it assumes the data can be consumed. This is incorrect when the peeking buffer finishes with --delimiter- Fixes #12662 Change-Id: I329556a9a206407c0958289bf7a9009229120bb9 Reviewed-on: https://go-review.googlesource.com/14652 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/16969 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] runtime: preserve R11 in darwin/arm entrypointDavid Crawshaw
The _rt0_arm_darwin_lib entrypoint has to conform to the darwin ARMv7 calling convention, which requires functions to preserve the value of R11. Go uses R11 as the liblink REGTMP register, so save it manually. Also avoid using R4, which is also callee-save. Fixes #12590 Change-Id: I9c3b374e330f81ff8fc9c01fa20505a33ddcf39a Reviewed-on: https://go-review.googlesource.com/14603 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/16968 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] runtime: unblock special glibc signals on each threadIan Lance Taylor
Glibc uses some special signals for special thread operations. These signals will be used in programs that use cgo and invoke certain glibc functions, such as setgid. In order for this to work, these signals need to not be masked by any thread. Before this change, they were being masked by programs that used os/signal.Notify, because it carefully masks all non-thread-specific signals in all threads so that a dedicated thread will collect and report those signals (see ensureSigM in signal1_unix.go). This change adds the two glibc special signals to the set of signals that are unmasked in each thread. Fixes #12498. Change-Id: I797d71a099a2169c186f024185d44a2e1972d4ad Reviewed-on: https://go-review.googlesource.com/14297 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-on: https://go-review.googlesource.com/16967 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] runtime/cgo: explicitly link msvcrt on windowsShenghou Ma
It's because runtime links to ntdll, and ntdll exports a couple incompatible libc functions. We must link to msvcrt first and then try ntdll. Fixes #12030. Change-Id: I0105417bada108da55f5ae4482c2423ac7a92957 Reviewed-on: https://go-review.googlesource.com/14472 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/16966 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-17[release-branch.go1.5] cmd/compile/internal/gc: handle weird map literals in ↵Keith Randall
key dedup We compute whether two keys k1 and k2 in a map literal are duplicates by constructing the expression OEQ(k1, k2) and calling the constant expression evaluator on that expression, then extracting the boolean result. Unfortunately, the constant expression evaluator can fail for various reasons. I'm not really sure why it is dying in the case of 12536, but to be safe we should use the result only if we get a constant back (if we get a constant back, it must be boolean). This probably isn't a permanent fix, but it should be good enough for 1.5.2. A permanent fix would be to ensure that the constant expression evaluator can always work for map literal keys, and if not the compiler should generate an error saying that the key isn't a constant (or isn't comparable to some specific other key). This patch has the effect of allowing the map literal to compile when constant eval of the OEQ fails. If the keys are really equal (which the map impl will notice at runtime), one will overwrite the other in the resulting map. Not great, but better than a compiler crash. Fixes #12536 Change-Id: Ic151a5e3f131c2e8efa0c25c9218b431c55c1b30 Reviewed-on: https://go-review.googlesource.com/14400 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/16965 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-13[release-branch.go1.5] runtime: memmove/memclr pointers atomicallyKeith Randall
Make sure that we're moving or zeroing pointers atomically. Anything that is a multiple of pointer size and at least pointer aligned might have pointers in it. All the code looks ok except for the 1-pointer-sized moves. Fixes #13160 Update #12552 Change-Id: Ib97d9b918fa9f4cc5c56c67ed90255b7fdfb7b45 Reviewed-on: https://go-review.googlesource.com/16668 Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/16910 Reviewed-by: Russ Cox <rsc@golang.org>