[libcxx-commits] [PATCH] D95827: Avoid cast<T*> before T is constructed to pacify CFI checks

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 2 12:05:25 PST 2021


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

In D95827#2537371 <https://reviews.llvm.org/D95827#2537371>, @rnk wrote:

> In D95827#2536611 <https://reviews.llvm.org/D95827#2536611>, @ldionne wrote:
>
>> We could add `_LIBCPP_NO_CFI` on the problematic method, like we do for `std::addressof`. Can you try that out?
>
> Yep, it works.
>
> I haven't put together a test for this. Are there existing tests for CFI or sanitizers that I could use to build a test for this?

No, I don't think we have any. I see two options:

1. Add a buildbot that runs with CFI enabled.
2. Add a single `.sh.cpp` test that runs this specifically.

I think option (1) would be the best. Is it sufficient to add `-fsanitize=cfi -flto` when compiling a test file to reproduce the issue? If so, I think we could simply add a new CFI sanitizer configuration to Lit that does that, and add a corresponding job to run the whole test suite with CFI enabled. We can tackle that as a separate effort.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95827/new/

https://reviews.llvm.org/D95827



More information about the libcxx-commits mailing list