-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/compile,runtime: checkptr false negatives for tiny-alloced objects #38872
Comments
The problem does not occur if I removed |
I'd guess it has something to do with either scheduling of the concurrent GC, or with placement of |
If |
Why? It's not an error to convert from |
Ah right 👍 |
Hmm, but should the race detector emit an error when a 32-bit atomic op occurs concurrently with a 64-bit atomic op? My recollection is that on some 32-bit architectures, the 32-bit atomic ops use an entirely separate code path from the 64-bit ones, so I can't imagine that the memory model allows it. |
(Oh, right: the memory model doesn't define |
Filed that separately as #38881. |
Seems concurrent GC problem, because if I set |
This is worth discussing in #38881, but I think it's a red herring here. The 32-bit and 64-bit atomic ops that modify
Interesting. I wonder if there's a race condition in the calls to findObject in checkptrAlignment. Maybe it's not actually safe to call |
Hm, I'm not able to reproduce this on linux/amd64. I don't get any checkptr reports, even with |
Confirm that this does not happen on |
Yeah, not reporting on linux/amd64 is a false negative. (With the usual caveats that checkptr is best-effort, so some false negatives will be inevitable; though I can't immediately see why the behavior here would be OS-specific.) |
I'm not able to reproduce on darwin/amd64.
I checked out the Go release at 9b18968. |
@randall77 still reproduce for me in current latest commit 9f33108
|
Also reproduce on:
|
Operator error. I am now able to reproduce. Sorry for the runaround. |
This is definitely a correct report. A I can confirm that the problem reproduces exactly when the On Linux, the I can force an error on Linux by allocating 4 bytes at the start of
With that change, it now reports an error reliably on Linux. It is unfortunate that checkptr does not reliably report this as a violation. I think to fix that, we'd need to keep track of the separate allocations inside a tinyalloc. I don't think there's any easy way to do that, unfortunately. Possibly we could just turn off tinyalloc when checkptr is on. Certainly when checkptr is on because the race detector is on, the cost would be in the noise. With just checkptr, though, I'm not sure. @mdempsky what do you think? |
Of course, just turning off tinyalloc is not enough - that would just allocate |
@randall77 👍 , also, any thought on why |
Not sure. Probably just makes the allocation pattern more deterministic. |
In any case, there's no bug here worth fixing for 1.15. Punting to 1.16. |
@randall77 Thanks for reproducing and figuring out what's up. Agreed with your suggestions (being able to turn off tinyalloc, and randomly end-aligning objects rather than start-aligning them) would be good ways of making this fire more reliably. |
Ok, we'll do that for 1.16. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@mdempsky @randall77 related issue #35128 |
Hi @aclements, do you have any suggestion to solve this? |
It sounds like that path forward here is to at least top-align tiny allocs in checkptr mode and possible top-align all allocations (much harder). We're not planning to work on this during the freeze, so bumping to 1.17. |
@mdempsky Are we likely to fix this for 1.17? Should we move this to Backlog? Thanks. |
I have a CL kinda ready for this. I should mail it out. I think I was being too aggressive and tried doing it for all size classes. Just tinyalloc is easier. |
Change https://golang.org/cl/315029 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Consistent result between 10 times run.
What did you see instead?
The result is inconsistent, sometimes passes, sometimes
checkptr
report errors.cc @mdempsky
The text was updated successfully, but these errors were encountered: