[PATCH] D119296: KCFI sanitizer

Sami Tolvanen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 16:22:53 PDT 2022


samitolvanen added a comment.

In D119296#3562409 <https://reviews.llvm.org/D119296#3562409>, @MaskRay wrote:

> ELF linkers don't error for two `SHN_ABS` `STB_GLOBAL` symbols of the same `st_value`.
> When the `st_value` fields differ, there will be a diagnostic. If needed, the specialized diagnostic can be added there.

After testing this a bit further, it looks like this won't work with LTO where we're not yet linking ELF object files. For example:

  $ llvm-modextract -b -n 0 -o - sound/soc/sh/rcar/dma.o | llvm-dis | grep __kcfi_typeid_rsnd_mod_get_status
  module asm ".globl __kcfi_typeid_rsnd_mod_get_status"
  module asm ".set __kcfi_typeid_rsnd_mod_get_status, 463955820"
  $ llvm-modextract -b -n 0 -o - sound/soc/sh/rcar/cmd.o | llvm-dis | grep __kcfi_typeid_rsnd_mod_get_status
  module asm ".globl __kcfi_typeid_rsnd_mod_get_status"
  module asm ".set __kcfi_typeid_rsnd_mod_get_status, 463955820"
  $ ld.lld -r -o test.o sound/soc/sh/rcar/dma.o sound/soc/sh/rcar/cmd.o
  ld.lld: error: duplicate symbol: __kcfi_typeid_rsnd_mod_get_status
  >>> defined in sound/soc/sh/rcar/dma.o
  >>> defined in sound/soc/sh/rcar/cmd.o

Do you have any thoughts on how to solve this without going back to a weak symbol?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296



More information about the llvm-commits mailing list