いろいろ備忘録日記

主に .NET とか Go とか Flutter とか Python絡みのメモを公開しています。

Goメモ-154 (go run したら unsupported VMA range って出た)(Chromebook, ARM64)

概要

以下、自分のChromebookの環境で発生しました。忘れないうちにメモメモ。

発生することは、最近のWindowsマシンとかMac使っていると無いと思いますが。。。

こんな感じ

$ make run
go get -d ./...
go run -race github.com/devlights/try-golang/cmd/trygolang -onetime -example ""
FATAL: ThreadSanitizer: unsupported VMA range
FATAL: Found 39 - Supported 48
exit status 66
make: *** [Makefile:65: run] Error 1
FATAL: ThreadSanitizer: unsupported VMA range
FATAL: Found 39 - Supported 48

ってエラーが出ていますね。

VMA (Virtual Memory Address) 絡みでエラーが出ているのがわかります。私の chromebook は、39bitのVMAまでしかサポートしていないから怒られているっぽい。

CPUの情報

私の chromebook さんの情報はこんな感じ。

$ lscpu 
Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          6
On-line CPU(s) list:             0-5
Thread(s) per core:              1
Core(s) per socket:              6
Socket(s):                       1
Vendor ID:                       ARM
Model:                           2
Model name:                      Cortex-A72
Stepping:                        r0p2
BogoMIPS:                        48.00
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Branch predictor hardening
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid

情報を探してみる

VMA絡みなので、 -race オプションが関係してるんだろなーって予想します (エラーメッセージにも、思いっきり ThreadSanitizer って出てるので) が、情報を調べるのはとても大事。

以下を発見。

github.com

同じ現象のことについて記載されている issue がありました。内容見ると、やはり -race 絡み。

上記 issue にて以下のコメントを発見。以下、内容を引用。

Currently data race works fine on the kernel configured with 48-bits VMA which is popular. Data race doesn't support the kernel configured with 39-bit VMA and 42-bit VMA because the shadow memory calculated in TSAN runtime will be out of the address space. I will investigate how to support 39-bit VMA in TSAN runtime.

39, 42 ビットの VMA はサポートしていないみたいですね。

対策

race detector が、データ競合を検出するために、元のプログラムに対してもにょもにょしようとするけど、対応していないVMA構成なのでエラーになってるということでしたので、-race を外して実行したらいいだけと判断。

$ make run
go get -d ./...
go run github.com/devlights/try-golang/cmd/trygolang -onetime -example ""
ENTER EXAMPLE NAME: quit

ちゃんと起動できた。

とりあえず、これで自分的にはオケ.

参考資料

github.com

golang.org

www.ertl.jp

stackoverflow.com

stackoverflow.com


過去の記事については、以下のページからご参照下さい。

  • いろいろ備忘録日記まとめ

devlights.github.io

サンプルコードは、以下の場所で公開しています。

  • いろいろ備忘録日記サンプルソース置き場

github.com

github.com

github.com