]> Cypherpunks repositories - gostls13.git/commit
cmd/link: avoid writing to read-only memory in addstrdata
authorCherry Zhang <cherryyz@google.com>
Thu, 25 Apr 2019 16:09:42 +0000 (12:09 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 25 Apr 2019 17:52:31 +0000 (17:52 +0000)
commit93fcebaf31965760c3bc8c087cb7e46127397994
tree9183c29469d3a34abdda6c9fa008b642d9860a75
parent41d1bf0efc121c451f497ceae8df366622efd821
cmd/link: avoid writing to read-only memory in addstrdata

When the linker's -X flag is used, it will overwrite the symbol's
content (sym.P) in addstrdata. The symbol's content may be in
read-only memory, in which case overwriting it will fault. Do
copy-on-write to fix this.

Change-Id: I34d583f44c30d187042757e19a14c1ef7d3e613c
Reviewed-on: https://go-review.googlesource.com/c/go/+/173937
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/link/internal/ld/data.go
src/cmd/link/link_test.go