Pointer authentication (PAC) for clang#60
Conversation
| public: | ||
| code_ptr() = default; | ||
| template <class F> | ||
| explicit code_ptr(const F& f) noexcept |
There was a problem hiding this comment.
Since it's an internal API (in namespace details), I don't think it's necessary to add constraints. If static_cast<O*>(f) won't compile, a hard error should be fine.
| } | ||
| bool operator==(std::nullptr_t) const noexcept { return p_ == nullptr; } | ||
| template <class... Args> | ||
| decltype(auto) operator()(Args&&... args) const { |
There was a problem hiding this comment.
Can this be optimized later for small objects? Maybe use the convert-to-function-ptr approach? (a user-defined type, if converts to function pointer, can be used like this obj(args) without defining operator())
There was a problem hiding this comment.
This type is just an equivalent to function pointers (see L99) in PAC mode. It is not intended for public use at all. But the idea to allow "proxy to decay to a function pointer" is a good one - I will implement it later, but not in this layer.
There was a problem hiding this comment.
It's only an efficiency concern. Passing arguments by reference (i.e., pointers in the calling convention) isn't ideal. Many libraries have some optimizations.
| class meta_ptr { | ||
| public: | ||
| meta_ptr() = default; | ||
| explicit meta_ptr(const T* p) noexcept |
There was a problem hiding this comment.
I believe no constraint is needed for this internal API either, but what constraints are you referring to assuming it would go public someday?
| } | ||
| bool operator==(std::nullptr_t) const noexcept { return p_ == nullptr; } | ||
| template <class... Args> | ||
| decltype(auto) operator()(Args&&... args) const { |
There was a problem hiding this comment.
It's only an efficiency concern. Passing arguments by reference (i.e., pointers in the calling convention) isn't ideal. Many libraries have some optimizations.
NOTE: This is PR 1 of n for the upcoming v5 major release, targeting the
feature/v5branch. Once the feature branch is stable, it will be merged intomain. This PR introduces critical ABI-breaking changes.Changes
detail/facade_meta_traits.h, which introduces two new public APIs:compact_facade_meta_traitsandflat_facade_meta_traits. These are metadata policy in v5. Currently onlycompact_facade_meta_traitsis used fromcore.h. Later this will become a new dimension offacade, and the reference fromcore.hwill be removed.detail::invoker,detail::inline_meta_storageanddetail::static_meta_storageare the implementation types of the meta traits. When PAC is enabled for compiler ABI, they will have the same level of security strength as virtual functions.Documentation will be updated separately.
(CI is not triggered for the new feature branch (filed #61). Manual CI: https://github.com/mingxwa/proxy/actions/runs/29681375711)
Resolves #7