Skip to content
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

Testing ASan for MSVC #15978

Closed
wants to merge 26 commits into from
Closed

Testing ASan for MSVC #15978

wants to merge 26 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Sep 21, 2024

If this works, this PR supersedes #6964.

From my limited testing, the crux to avoid the 0xc0000028 errors (STATUS_BAD_STACK, i.e. "An invalid or unaligned stack was encountered during an unwind operation."), is to enable ZEND_DEBUG. That may require further investigation, although it is probably not a bad idea to have debug assertions enabled when running with ASan. If we keep this, this PR likely supersedes #15544 as well.

TODO:

  • move ARG_ENABLE("sanitizer") out of the conditional (see how buildconf handles these when generating configure)
  • check clang (can we unify more? do we have to be more different?); maybe leave this for PHP next
  • fix the failing PHP_DEBUG related tests (ext/ffi and Zend\tests\return_types\internal_functions001.phpt)
  • check whether everything works as intended for phpize builds
  • check clang on Windows

Further notes:

cmb69 added 24 commits November 29, 2024 22:21
According to Microsoft, ASan is already supported as of Visual Studio
16.9, but that support might be limited, and we can't easily check
versions prior to 16.11 anyway, so we require 16.10 for now.

We also move the `ARG_ENABLE` to the top-level, since `ARG_*` has
special treatment by buildconf anyway, so there are no conditionally
declared `ARG_*`s.
This *might* "solve" the `C00000FF` (`STATUS_BAD_FUNCTION_TABLE`)
errors, we're seeing for some tests.
This is, of course, mandatory.
We're in need for speed regarding CI.
This reverts commit a261b4c.
This reverts commit 5c420a5.
These tests execute php.exe without passing the PATH, what might be a
more general issues, but at least with ASan enabled, the required DLLs
could usually not be found, resulting in the tests stalling.
For some reason, terminating the child process by sending CTRL+C won't
work under ASan instrumentation.  Since termination via CTRL+BREAK
works, there is apparently nothing fundamentally wrong, so we just
skip the test.
This reverts commit ec8fe7f.
These look related to php#15709, but apparently only fail with ASan
instrumentation.  Let's xfail these for now.
@cmb69
Copy link
Member Author

cmb69 commented Nov 30, 2024

Finally green. \o/

@cmb69
Copy link
Member Author

cmb69 commented Dec 8, 2024

The last pieces are now at #17086 and #17087, so I'm closing this draftexperiment.

@cmb69 cmb69 closed this Dec 8, 2024
@cmb69 cmb69 deleted the cmb/asan-msvc branch December 8, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant