1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:41:28 -06:00
Commit Graph

9 Commits

Author SHA1 Message Date
Matthew Dempsky
5324cf2d45 runtime: change sigset_all and sigset_none into constants on OpenBSD
OpenBSD's sigprocmask system call passes the signal mask by value
rather than reference, so vars are unnecessary.  Additionally,
declaring "var sigset_all = ^sigset_none" means sigset_all won't be
initialized until runtime_init is called, but the first call to
newosproc happens before then.

I've witnessed Go processes on OpenBSD crash from receiving SIGWINCH
on the newly created OS thread before it finished initializing.

Change-Id: I16995e7e466d5e7e50bcaa7d9490173789a0b4cc
Reviewed-on: https://go-review.googlesource.com/6440
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-02 08:30:39 +00:00
Matthew Dempsky
9f926e81c2 runtime: simplify OpenBSD semaphores
OpenBSD's thrsleep system call includes an "abort" parameter, which
specifies a memory address to be tested after being registered on the
sleep channel (i.e., capable of being woken up by thrwakeup).  By
passing a pointer to waitsemacount for this parameter, we avoid race
conditions without needing a lock.  Instead we just need to use
atomicload, cas, and xadd to mutate the semaphore count.

Change-Id: If9f2ab7cfd682da217f9912783cadea7e72283a8
Reviewed-on: https://go-review.googlesource.com/5563
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Joel Sing <jsing@google.com>
2015-02-25 02:30:11 +00:00
Matthew Dempsky
95ab84a34f runtime: fix accidentally exported OpenBSD constants
Change-Id: I2de63668a1c0152cc329df55c2d6d014e8183158
Reviewed-on: https://go-review.googlesource.com/4943
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-19 01:35:46 +00:00
Keith Randall
b2a950bb73 runtime: rename gothrow to throw
Rename "gothrow" to "throw" now that the C version of "throw"
is no longer needed.

This change is purely mechanical except in panic.go where the
old version of "throw" has been deleted.

sed -i "" 's/[[:<:]]gothrow[[:>:]]/throw/g' runtime/*.go

Change-Id: Icf0752299c35958b92870a97111c67bcd9159dc3
Reviewed-on: https://go-review.googlesource.com/2150
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2014-12-28 06:16:16 +00:00
Austin Clements
675eb72c28 runtime: run libc SIGSETXID and SIGCANCEL handlers on signal stack
These signals are used by glibc to broadcast setuid/setgid to all
threads and to send pthread cancellations.  Unlike other signals, the
Go runtime does not intercept these because they must invoke the libc
handlers (see issues #3871 and #6997).  However, because 1) these
signals may be issued asynchronously by a thread running C code to
another thread running Go code and 2) glibc does not set SA_ONSTACK
for its handlers, glibc's signal handler may be run on a Go stack.
Signal frames range from 1.5K on amd64 to many kilobytes on ppc64, so
this may overflow the Go stack and corrupt heap (or other stack) data.

Fix this by ensuring that these signal handlers have the SA_ONSTACK
flag (but not otherwise taking over the handler).

This has been a problem since Go 1.1, but it's likely that people
haven't encountered it because it only affects setuid/setgid and
pthread_cancel.

Fixes #9600.

Change-Id: I6cf5f5c2d3aa48998d632f61f1ddc2778dcfd300
Reviewed-on: https://go-review.googlesource.com/1887
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-23 01:33:36 +00:00
Keith Randall
6820be25da runtime: clean up & go-ify the hash function seeder
Change-Id: I0e95f8a5962c547da20e19a356ae1cf8375c9107
Reviewed-on: https://go-review.googlesource.com/1270
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-10 21:15:35 +00:00
Russ Cox
580cba42f4 [dev.cc] runtime: change set_sec to take int64
Fixes build.
Tested that all these systems can make.bash.

TBR=austin
CC=golang-codereviews
https://golang.org/cl/177770043
2014-11-14 14:50:00 -05:00
Joel Sing
9ad6b7e322 [dev.cc] runtime: convert openbsd/386 port to Go
LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/173200044
2014-11-15 03:55:14 +11:00
Joel Sing
ba603c3100 [dev.cc] runtime: convert openbsd/amd64 port to Go
LGTM=rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/171660043
2014-11-14 13:01:12 +11:00