[PATCH] D119296: KCFI sanitizer

Sami Tolvanen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 24 15:46:29 PDT 2022


samitolvanen added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/MachineInstr.h:265
+      PointerSumTypeMember<EIIK_PostInstrSymbol, MCSymbol *>,
+      PointerSumTypeMember<EIIK_CFIType, PointerEmbeddedInt<uint32_t, 32>>,
+      PointerSumTypeMember<EIIK_OutOfLine, ExtraInfo *>>
----------------
samitolvanen wrote:
> This fails on 32-bit architectures as `PointerEmbeddedInt` doesn't allow storing 32 bits in a 32-bit pointer:
> ```
>   // Note: This '<' is correct; using '<=' would result in some shifts
>   // overflowing their storage types.
>   static_assert(Bits < sizeof(uintptr_t) * CHAR_BIT,
>                 "Cannot embed more bits than we have in a pointer!")
> ```
`PointerSumType` also needs space for a tag, which we don't have in a 32-bit pointer. Looks like we just need to always store `CFIType` in `ExtraInfo` to avoid this issue, similarly to `HeapAllocMarker`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296



More information about the cfe-commits mailing list