-
Notifications
You must be signed in to change notification settings - Fork 112
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
OpenBSD build fix proposal. #258
Conversation
Seems on this system pages are not discarded in due time thus some of unit tests are failing, leading to memory corruption. Marking those pages not accessible instead and test pass now.
Don't you need the converse to be set in In particular, we have code to do this. It was added to simulate the Windows like commit model on Posix: Lines 137 to 139 in 17d5a3e
Lines 158 to 160 in 17d5a3e
It seems very strange that this is would be required. Is there an OS bug we can track for this? |
I did not really need to but for consistency sure.
OpenBSD does not have bug tracker per see, just old school mailing list, I did not find any bug related to however was reading the uvm map code https://github.com/openbsd/src/blob/2d2e8ab08946096eec777725afff21569594ceef/sys/uvm/uvm_map.c#L4704 seems should have done it. However with some test (e.g. perf-contention-*) got some use after free issues. |
What kind of CPU are you using for the tests? |
Virtualized environement, usual x86 64 bits host. Note that the FreeBSD guest works ok with same resources allocation. |
I don't think we should be seeing corruption even if the pages are not returned fast enough, at worst we should be seeing too much physical memory usage. I wonder if there's a bug in the |
Or maybe MADV_FREE has not same semantic as other systems ? |
Digged out an old thread somewhere https://groups.google.com/g/golang-dev/c/oLlj0ssS4Vg |
That thread seems to be pointing to a FreeBSD bug that @nwf recently found and diagnosed that doing |
perf-contention-16 for example aborts at mem/superslab.h, line 110 with master branch. |
@devnexen thank you for the extra information. I believe the problem is the following.
This means the very end of the meta-data can become zeroed. Getting the original is fine, but getting random stuff is very bad. I am not convinced being zeroed is right, but it is not tripping any debug tests on Windows. I think this is actually a "bug" across platforms. If zeros are fine, then this would not exhibit on any correctly implemented platform. If zeros are not fine, then care is needed here. Can you confirm, does this fail on the 1MiB configuration? Or only 16MiB? The 1MiB would not have this issue, as the meta-data fits into the first 4KiB. The original assumption with this code was all the meta-data was in the first page, but #102 broke that assumption. The simplest fix would be to move the initialisation code to always occur: Lines 86 to 100 in 8990c34
|
Indeed I purposely only highlighted the 16MB case, the 1MB's is fine. |
@devnexen I have replicated this on WSL by just simulating the zeroing immediately. I will fix this as high-priority. |
#259 should fix this on OpenBSD. It also adds checks on Linux, so we don't regress this behaviour. |
Seems on this system pages are not discarded in due time
thus some of unit tests are failing, leading to memory corruption.
Marking those pages not accessible instead and test pass now.