mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: eliminate poisonStack checks
We haven't used poisonStack since we switched to 1-bit stack maps
(4d0f3a1), but the checks are still there. However, nothing prevents
us from genuinely allocating an object at this address on 32-bit and
causing the runtime to crash claiming that it's found a bad pointer.
Since we're not using poisonStack anyway, just pull it out.
Fixes #15831.
Change-Id: Ia6ef604675b8433f75045e369f5acd4644a5bb38
Reviewed-on: https://go-review.googlesource.com/24211
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
fca9fc52c8
commit
9e8fa1e99c
2 changed files with 3 additions and 4 deletions
|
|
@ -145,7 +145,7 @@ func writebarrierptr(dst *uintptr, src uintptr) {
|
||||||
if !writeBarrier.needed {
|
if !writeBarrier.needed {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if src != 0 && (src < sys.PhysPageSize || src == poisonStack) {
|
if src != 0 && src < sys.PhysPageSize {
|
||||||
systemstack(func() {
|
systemstack(func() {
|
||||||
print("runtime: writebarrierptr *", dst, " = ", hex(src), "\n")
|
print("runtime: writebarrierptr *", dst, " = ", hex(src), "\n")
|
||||||
throw("bad pointer in write barrier")
|
throw("bad pointer in write barrier")
|
||||||
|
|
@ -164,7 +164,7 @@ func writebarrierptr_nostore(dst *uintptr, src uintptr) {
|
||||||
if !writeBarrier.needed {
|
if !writeBarrier.needed {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if src != 0 && (src < sys.PhysPageSize || src == poisonStack) {
|
if src != 0 && src < sys.PhysPageSize {
|
||||||
systemstack(func() { throw("bad pointer in write barrier") })
|
systemstack(func() { throw("bad pointer in write barrier") })
|
||||||
}
|
}
|
||||||
writebarrierptr_nostore1(dst, src)
|
writebarrierptr_nostore1(dst, src)
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,6 @@ const (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
uintptrMask = 1<<(8*sys.PtrSize) - 1
|
uintptrMask = 1<<(8*sys.PtrSize) - 1
|
||||||
poisonStack = uintptrMask & 0x6868686868686868
|
|
||||||
|
|
||||||
// Goroutine preemption request.
|
// Goroutine preemption request.
|
||||||
// Stored into g->stackguard0 to cause split stack check failure.
|
// Stored into g->stackguard0 to cause split stack check failure.
|
||||||
|
|
@ -594,7 +593,7 @@ func adjustpointers(scanp unsafe.Pointer, cbv *bitvector, adjinfo *adjustinfo, f
|
||||||
pp := (*uintptr)(add(scanp, i*sys.PtrSize))
|
pp := (*uintptr)(add(scanp, i*sys.PtrSize))
|
||||||
retry:
|
retry:
|
||||||
p := *pp
|
p := *pp
|
||||||
if f != nil && 0 < p && p < _PageSize && debug.invalidptr != 0 || p == poisonStack {
|
if f != nil && 0 < p && p < _PageSize && debug.invalidptr != 0 {
|
||||||
// Looks like a junk value in a pointer slot.
|
// Looks like a junk value in a pointer slot.
|
||||||
// Live analysis wrong?
|
// Live analysis wrong?
|
||||||
getg().m.traceback = 2
|
getg().m.traceback = 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue