-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all: add internal/asan and internal/msan packages #64611
Comments
cc @golang/runtime |
With internal/msan, do we actually need to export them in the runtime? We can arrange internal/msan to call the assembly functions (e.g. |
@cherrymui That works for me, I was trying to structure internal/msan the same way internal/asan is implemented, but it makes sense to call the assembly directly. |
Taking this out of the proposal process as we can proceed without adding new runtime APIs. |
Change https://go.dev/cl/548695 mentions this issue: |
The internal/msan package contains helper functions for manually instrumenting code for the memory sanitizer. It exports the private msan routines in runtime uncoditionally, making the functions a no-op if the build flag "msan" is not present. For golang#64611
The internal/msan package contains helper functions for manually instrumenting code for the memory sanitizer. It exports the private msan routines in runtime uncoditionally, making the functions a no-op if the build flag "msan" is not present. For golang#64611
The internal/msan package contains helper functions for manually instrumenting code for the memory sanitizer. It exports the private msan routines in runtime uncoditionally, making the functions a no-op if the build flag "msan" is not present. For golang#64611
Change https://go.dev/cl/548676 mentions this issue: |
The internal/msan package contains helper functions for manually instrumenting code for the memory sanitizer. It exports the private msan routines in runtime uncoditionally, making the functions a no-op if the build flag "msan" is not present. For golang#64611
With the tree now reopened, I would like to confirm whether the addition of internal/asan and internal/msan is acceptable to the runtime team, as the NeedsDecision label is still associated with this issue. I have prepared https://go.dev/cl/548676 and https://go.dev/cl/548695 in case we decide to proceed with this. Thanks. |
This all looks reasonable to me. I'd like to see a follow-up CL that uses these new packages to clean up some of the rest of the tree. Thanks! |
I'm looking forward to working on the cleanup and fixing stdlib tests that currently fail with asan/msan. Is it okay if I also submit a CL to x/devapp/owners adding these new packages? The runtime team would be the primary maintainer, and I can take on the secondary maintainer role if that is acceptable for the team. |
Thanks for working on this. I think this can be two steps. Refactoring first, then adding the notations to tests. This is probably cleaner and clearer. |
The internal/asan package contains helper functions for manually instrumenting code for the address sanitizer. It reexports the asan routines in runtime unconditionally, making the functions a no-op if the build flag "asan" is not present. For #64611 Change-Id: Ie79e698aea7a6d969afd2a5f008c084c9545b1a5 GitHub-Last-Rev: e658670 GitHub-Pull-Request: #64635 Reviewed-on: https://go-review.googlesource.com/c/go/+/548695 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The internal/asan package contains helper functions for manually instrumenting code for the address sanitizer. It reexports the asan routines in runtime unconditionally, making the functions a no-op if the build flag "asan" is not present. For golang#64611 Change-Id: Ie79e698aea7a6d969afd2a5f008c084c9545b1a5 GitHub-Last-Rev: e658670 GitHub-Pull-Request: golang#64635 Reviewed-on: https://go-review.googlesource.com/c/go/+/548695 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The internal/msan package contains helper functions for manually instrumenting code for the memory sanitizer. It exports the private msan routines in runtime unconditionally, making the functions a no-op if the build flag "msan" is not present. For #64611 Change-Id: If43f29e112ac79a47083c9dbdf2c61a0641e80b1 GitHub-Last-Rev: 0a644bd GitHub-Pull-Request: #64637 Reviewed-on: https://go-review.googlesource.com/c/go/+/548676 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/566735 mentions this issue: |
Change https://go.dev/cl/566755 mentions this issue: |
Now with internal/asan and internal/msan available we can cleanup syscall's duplicated definitions. For #64611 Change-Id: If714d04ed2d32a4ed27305b3e3dc64ba8cdd1b61 GitHub-Last-Rev: e52fff1 GitHub-Pull-Request: #65935 Reviewed-on: https://go-review.googlesource.com/c/go/+/566755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Change https://go.dev/cl/572755 mentions this issue: |
The len parameter runtime.asan{read,write} is of type uintptr. Match its type in Read and Write. For #64611 Change-Id: I0be278c38a357e600521ced87c0e23038a11e8a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/572755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
There are a couple issues where having asan/msan enabled throw off tests for memory allocations, see #64257 and #64256.
Most tests already skip these memory allocation assertions when they detect that
race
is enabled, but such functionality is not exposed for asan and msan.Here is one example of such test:
One alternative is using the
asan
andmsan
build tags to skip certain tests, but that does not work in the middle of a test, only for entire files.There is
runtime.msanenabled
,runtime.asanenabled
,syscall.asanenabled
we could use, but they are private to their respective packages.It is worth noting that syscall and runtime duplicate some code related to asan:
I propose we create
internal/asan
andinternal/msan
packages akin tointernal/race
. Then syscall and runtime would callinternal/asan.Enabled
and syscall could useASanRead
,ASanWrite
as well, without having this logic duplicated.The tests can also use
internal/asan.Enabled
to check if they should skip tests that allocate memory, which most tests already do currently by checkingrace.Enabled
. We can also use these insidetestenv.SkipIfOptimizationOff/testenv.OptimizationOff
to make this process more seamless.Here is the proposed apis for these new internal packages:
internal/asan
internal/msan
The only place that uses msan currently is the runtime, but having access to a msan.Enabled would be useful in tests as well and would make a good trio with
internal/asan
andinternal/race
. Other packages might be able to use the exported functions more easily as well.The proposed api for internal/msan would then be:
The text was updated successfully, but these errors were encountered: