]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.17] misc/wasm, cmd/link: do not let command line args overwrite...
authorMichael Knyszek <mknyszek@google.com>
Thu, 2 Sep 2021 20:51:59 +0000 (16:51 -0400)
committerMichael Knyszek <mknyszek@google.com>
Thu, 7 Oct 2021 14:54:47 +0000 (14:54 +0000)
commit4925e0766f8a92ab82913b3564228645613290f5
tree9cf396f098341f0e7746de4c89a6b160c83b8675
parentb18ba59aaf078eb3af589ff9b3df6d62e61f4810
[release-branch.go1.17] misc/wasm, cmd/link: do not let command line args overwrite global data

On Wasm, wasm_exec.js puts command line arguments at the beginning
of the linear memory (following the "zero page"). Currently there
is no limit for this, and a very long command line can overwrite
the program's data section. Prevent this by limiting the command
line to 4096 bytes, and in the linker ensuring the data section
starts at a high enough address (8192).

(Arguably our address assignment on Wasm is a bit confusing. This
is the minimum fix I can come up with.)

Thanks to Ben Lubar for reporting this issue.

Change by Cherry Mui <cherryyz@google.com>.

For #48797
Fixes #48800
Fixes CVE-2021-38297

Change-Id: I0f50fbb2a5b6d0d047e3c134a88988d9133e4ab3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1205933
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/354592
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
misc/wasm/wasm_exec.js
src/cmd/link/internal/ld/data.go