[libunwind] [PAC][libunwind] Pass ptrauth-qualified values as const references (PR #173765)
Anatoly Trosinenko via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 29 06:18:08 PST 2025
================
@@ -202,10 +202,12 @@ class _LIBUNWIND_HIDDEN LocalAddressSpace {
pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
pint_t datarelBase = 0, pint_t *resultAddr = nullptr);
- bool findFunctionName(pint_t addr, char *buf, size_t bufLen,
+ template <typename T>
----------------
atrosinenko wrote:
I wonder if replacing `template <typename T>` with something like `template <typename ProtectedPtrT>` could further decrease the possibility that this hack would be accidentally ignored/removed by the future developers updating this code, as I assume it is easier to ignore a comment than to ignore a type name written in the very same line :) I definitely do NOT recommend using this approach *instead* of a comment. Maybe such `typename`s could even be used as a kind of "named hacks" to refer to in the comments. Furthermore, it would be great to reflect the fact that this signed pointer type is a pointee ("referencee"?) itself and fit this description in 1-2 tens of letters :)
Well, this would still be hackish, but I agree that it is important to protect fixes for such hard-to-spot bugs from accidentally discarding. Ideally, such patterns should be caught by gadget scanner, I guess (or maybe even by the compiler itself - isn't #157779 somewhat relevant?).
By the way, is it possible to use a named `typedef` or something like this for reference-to-type? It would be great to simply refer to `bool findFunctionName(pint_arg_t addr, ...` and naturally attach the comment to the definition of `pint_arg_t`.
https://github.com/llvm/llvm-project/pull/173765
More information about the cfe-commits
mailing list