-
Notifications
You must be signed in to change notification settings - Fork 109
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
errno not always set correctly on failure #461
Comments
I suppose this is tangentially related to #423 . |
So I am thinking of adding
on line 321: Lines 298 to 323 in af8ab2d
We should then review other snmalloc/src/pal/pal_bsd_aligned.h Lines 32 to 55 in af8ab2d
and add the same to the |
We probably need to do something here too snmalloc/src/mem/chunkallocator.h Lines 194 to 198 in af8ab2d
|
|
I can confirm that setting |
Previously this test would emit an error message but not abort if the `errno` was not as expected on failure. This was because the `return` in the `null == true` case prevented the check for `failed == true` at the end of `check_result` from being reached. To resolve this just abort immediately instead of instead of setting `failed` to true, as in the null case. See microsoft#461.
…space. This resolves a test failure in the malloc functional test. See microsoft#461.
Previously this test would emit an error message but not abort if the errno was not as expected on failure. This was because the return in the null == true case prevented the check for failed == true at the end of check_result from being reached. To resolve this just abort immediately instead of instead of setting failed to true, as in the null case. See microsoft#461.
…ace. This resolves a test failure in the malloc functional test. See microsoft#461.
I think |
…ace. This resolves a test failure in the malloc functional test. See microsoft#461.
…ace. This resolves a test failure in the malloc functional test. See microsoft#461.
This was not being done for certain cases as per microsoft#461. Note that malloc and calloc are probably still not setting errno for those cases but this is not currently tested...
Correctly set errno on failure and improve the related test. Previously the malloc test would emit an error message but not abort if the errno was not as expected on failure. This was because the return in the null == true case prevented the check for failed == true at the end of check_result from being reached. To resolve this just abort immediately as in the null case. Also add tests of allocations that are expected to fail for calloc and malloc. To make the tests pass we need to set errno in several places, making sure to keep this off the fast path. We must also take care not to attempt to zero nullptr in case of calloc failure. See #461 and #463.
The malloc test contains some calls that are expected to fail such as attempts to allocate very large chunks of memory. Currently these return
nullptr
but do not seterrno
toENOMEM
as required by the SUSv2 standard (at least according to the Linux manpage formalloc
). Unfortunatelycheck_result
notices the incorrecterrno
but does not fail the test due to thereturn
here so the test emits an error message but does not fail, for example:Note that there is a suspicious check for
realloc(-1)
in override here but I'm sure if this is related to the failure.The text was updated successfully, but these errors were encountered: