Wrong permissions for non-STT_FUNC symbols in executable sections
The Morello-specific getPermissions
in lld/ELF/Arch/Cheri.cpp, used by both MorelloCapRelocsSection
and getMorelloSizeAndPermissions
, bogusly uses SHF_EXECINSTR
of the containing section to determine whether or not a non-STT_FUNC
symbol should be made executable. This is wrong and deviates from the correct semantics provided by the existing CHERI LLVM CheriCapRelocsSection
; only STT_FUNC
symbols should be executable, data (which conservatively includes STT_NOTYPE
) should not be, even if in .text
, as that makes constant pools executable.