1
0
mirror of https://github.com/golang/go synced 2024-10-05 05:11:25 -06:00
go/src
Russ Cox 001438bdfe runtime: fix callwritebarrier
Given a call frame F of size N where the return values start at offset R,
callwritebarrier was instructing heapBitsBulkBarrier to scan the block
of memory [F+R, F+R+N). It should only scan [F+R, F+N). The extra N-R
bytes scanned might lead into the next allocated block in memory.
Because the scan was consulting the heap bitmap for type information,
scanning into the next block normally "just worked" in the sense of
not crashing.

Scanning the extra N-R bytes of memory is a problem mainly because
it causes the GC to consider pointers that might otherwise not be
considered, leading it to retain objects that should actually be freed.
This is very difficult to detect.

Luckily, juju turned up a case where the heap bitmap and the memory
were out of sync for the block immediately after the call frame, so that
heapBitsBulkBarrier saw an obvious non-pointer where it expected a
pointer, causing a loud crash.

Why is there a non-pointer in memory that the heap bitmap records as
a pointer? That is more difficult to answer. At least one way that it
could happen is that allocations containing no pointers at all do not
update the heap bitmap. So if heapBitsBulkBarrier walked out of the
current object and into a no-pointer object and consulted those bitmap
bits, it would be misled. This doesn't happen in general because all
the paths to heapBitsBulkBarrier first check for the no-pointer case.
This may or may not be what happened, but it's the only scenario
I've been able to construct.

I tried for quite a while to write a simple test for this and could not.
It does fix the juju crash, and it is clearly an improvement over the
old code.

Fixes #10844.

Change-Id: I53982c93ef23ef93155c4086bbd95a4c4fdaac9a
Reviewed-on: https://go-review.googlesource.com/10317
Reviewed-by: Austin Clements <austin@google.com>
2015-05-21 19:14:03 +00:00
..
archive archive/tar: fix error message 2015-05-04 21:27:45 +00:00
bufio
builtin
bytes bytes, strings: add LastIndexByte 2015-04-30 07:13:18 +00:00
cmd cmd/internal/obj: remove F3t field from Prog 2015-05-21 18:28:50 +00:00
compress compress/flate: simplify the TestDegenerateHuffmanCoding data. 2015-04-17 04:31:48 +00:00
container
crypto crypto/x509: be strict about trailing data. 2015-04-30 03:49:36 +00:00
database/sql
debug all: build and use go tool compile, go tool link 2015-05-21 17:32:03 +00:00
encoding encoding/gob: fix docs 2015-05-20 22:34:08 +00:00
errors
expvar expvar: swap Float sync. from mutex to atomic. 2015-04-12 23:07:50 +00:00
flag flag: Fix up a package comment a bit. 2015-05-19 02:18:40 +00:00
fmt fmt: allow for space and plus flags when computing widths 2015-05-11 18:34:19 +00:00
go all: retire architecture letter in file names, public API 2015-05-21 17:32:17 +00:00
hash hash/crc32: move reverse representation docs to an example 2015-05-04 00:19:22 +00:00
html html/template: fix string iteration in replacement operations 2015-05-19 22:45:50 +00:00
image image/gif: allow encoding a single-frame image whose top-left corner 2015-05-06 01:00:58 +00:00
index/suffixarray
internal internal/syscall/windows/registry: fix read overrun in GetStringsValue 2015-05-15 03:25:41 +00:00
io io: add CopyBuffer, a version of Copy in which the user provides a buffer 2015-04-15 15:59:16 +00:00
log log/syslog: make the BUG notes visible on golang.org 2015-04-22 21:09:53 +00:00
math math/big, cmd/internal/gc/big: fix vet detected printf problem 2015-05-14 05:34:40 +00:00
mime mime: Export RFC 2047 code 2015-05-11 18:50:32 +00:00
net net: document that ListenMulticastUDP is for simple applications 2015-05-20 22:30:52 +00:00
os os: eradicate smallpox after test 2015-05-06 17:38:57 +00:00
path path/filepath: skip test on darwin/arm64 2015-04-13 11:52:46 +00:00
reflect reflect: make PtrTo(FuncOf(...)) not crash 2015-05-16 00:51:05 +00:00
regexp regexp: trivial change in comments to update code.google.com link 2015-04-27 20:18:25 +00:00
runtime runtime: fix callwritebarrier 2015-05-21 19:14:03 +00:00
sort
strconv strconv: use 64bit uint for decimal conversion if available 2015-04-10 17:42:20 +00:00
strings strings: use LastIndexByte in LastIndex 2015-04-30 08:33:29 +00:00
sync sync/atomic: skip issue 7338 test on darwin/arm64 2015-04-12 02:47:43 +00:00
syscall syscall: don't run fcntl child process test on iOS 2015-05-15 16:41:12 +00:00
testing testing: fix typo 2015-05-12 23:39:00 +00:00
text text/template: fix race condition on function maps 2015-05-16 00:32:21 +00:00
time time: document that not all Unix time can be represented 2015-05-19 06:19:33 +00:00
unicode
unsafe
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash buildall.bash: exit 1 when make.bash fails 2015-05-17 01:40:33 +00:00
clean.bash
clean.bat
clean.rc
iostest.bash iostest.bash: run detect.go as part of iostest 2015-04-16 12:59:54 +00:00
make.bash
make.bat
Make.dist
make.rc
nacltest.bash nacltest.bash: remove syscall/fstest_nacl.go after test 2015-05-02 02:48:32 +00:00
race.bash
race.bat
run.bash build: correct quoting of args in run.bash 2015-05-09 04:23:47 +00:00
run.bat
run.rc