]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: do not mark resource section as writable
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 8 Nov 2020 10:11:27 +0000 (11:11 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 14 Dec 2020 22:39:04 +0000 (22:39 +0000)
Resources are immutable, and all other linkers set this section to be
read-only and not read-write. Fix this oversight by removing the writable
flag.

Change-Id: Ib441bde6620be2000f1685df1ea7bfaebdbe7860
Reviewed-on: https://go-review.googlesource.com/c/go/+/268258
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>

src/cmd/link/internal/ld/pe.go

index d60aa55c36049f5593a5a7387e3e44de5b355fcb..adbf516d5c5bebecd4aa92841b3514fc534092aa 100644 (file)
@@ -1524,7 +1524,7 @@ func addpersrc(ctxt *Link) {
        data := ctxt.loader.Data(rsrcsym)
        size := len(data)
        h := pefile.addSection(".rsrc", size, size)
-       h.characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_CNT_INITIALIZED_DATA
+       h.characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA
        h.checkOffset(ctxt.Out.Offset())
 
        // relocation