Skip to content

[libc++][hardening] XFAIL test in fast mode under HWASAN #78862

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

Conversation

vitalybuka
Copy link
Collaborator

@vitalybuka vitalybuka commented Jan 20, 2024

After #77883 FAST mode uses TRAP, and HWASAN
replaces TRAP with abort or error exit code.

On a quick looks it should be possible to avoid doing
that in HWASAN, but historically this is convention for all
sanitizers. Changing this behavior may existing users.

Other sanitizers are not affected because they don't
install TRAP handlers by default. But if they do, they also
replace TRAP with abort/exit.

Created using spr 1.3.4
@vitalybuka vitalybuka requested a review from a team as a code owner January 20, 2024 21:17
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 20, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 20, 2024

@llvm/pr-subscribers-libcxx

Author: Vitaly Buka (vitalybuka)

Changes

FAST mode uses TRAP, and HWASAN replaces TRAP
with abort or error exit code.


Full diff: https://github.com/llvm/llvm-project/pull/78862.diff

3 Files Affected:

  • (modified) libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp (+2)
  • (modified) libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp (+2)
  • (modified) libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp (+2)
diff --git a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
index a91ba041763749..23ef20d4e07819 100644
--- a/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
@@ -15,6 +15,8 @@
 // The ability to set a custom abort message is required to compare the assertion message (which only happens in the
 // debug mode).
 // XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+// HWASAN replaces TRAP with abort or error exit code.
+// XFAIL: libcpp-hardening-mode=fast && hwasan
 // Note that GCC doesn't support `-Wno-macro-redefined`.
 // ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_ENABLE_ASSERTIONS=1
 
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
index f78d5d70e58904..c3cdfa926c6cc8 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
@@ -13,6 +13,8 @@
 // The ability to set a custom abort message is required to compare the assertion message (which only happens in the
 // debug mode).
 // XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+// HWASAN replaces TRAP with abort or error exit code.
+// XFAIL: libcpp-hardening-mode=fast && hwasan
 // ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
 
 #include <cassert>
diff --git a/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
index 27542ee32bef94..854bf6c5da9cd6 100644
--- a/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
+++ b/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
@@ -13,6 +13,8 @@
 // The ability to set a custom abort message is required to compare the assertion message (which only happens in the
 // debug mode).
 // XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+// HWASAN replaces TRAP with abort or error exit code.
+// XFAIL: libcpp-hardening-mode=fast && hwasan
 // ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST
 
 #include <cassert>

@vitalybuka vitalybuka requested a review from var-const January 20, 2024 21:22
Copy link
Member

@var-const var-const left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for fixing this!

@var-const var-const added the hardening Issues related to the hardening effort label Jan 20, 2024
@var-const var-const changed the title [libc++][hardening] XFAIL test in FAST more HWASAN [libc++][hardening] XFAIL test in fast mode under HWASAN Jan 20, 2024
@var-const var-const merged commit aaa7de1 into main Jan 20, 2024
@var-const var-const deleted the users/vitalybuka/spr/libchardening-xfail-test-in-fast-more-hwasan branch January 20, 2024 21:37
@vitalybuka
Copy link
Collaborator Author

I didn't actually tested and expected to merge after https://lab.llvm.org/buildbot/#/builders/236/builds/8872
But it should not make things worse :)

var-const pushed a commit that referenced this pull request Jan 21, 2024
Follow up to #78862

These tests control hardening mode with `ADDITIONAL_COMPILE_FLAGS`, and
always set modes which use on TRAP. So we don't need to check
`libcpp-hardening-mode=fast`, and they must always fail with the current
HWASAN implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardening Issues related to the hardening effort libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants