Skip to content

Testing ASan for MSVC - #15978

Closed
cmb69 wants to merge 26 commits into
php:masterfrom
cmb69:cmb/asan-msvc
Closed

cmb69 wants to merge 26 commits into
php:masterfrom
cmb69:cmb/asan-msvc

Conversation

@cmb69

@cmb69 cmb69 commented Sep 21, 2024 •

Copy link
Copy Markdown
Member

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 a261b4cf46091e4586ffdcb340cb3b17e633ca89.
This reverts commit 5c420a52960dffe2f42ac36edd8bc6abefa39580.
This reverts commit 2339153350991347155921ddbe68f3e2a14b00f8.
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

cmb69 commented Nov 30, 2024

Copy link
Copy Markdown
Member Author

Finally green. \o/

@cmb69

cmb69 commented Dec 8, 2024 •

Copy link
Copy Markdown
Member Author

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