[PATCH] D59780: Support Intel Control-flow Enforcement Technology

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 18:07:29 PST 2019


xiangzhangllvm added a comment.

In D59780#1778988 <https://reviews.llvm.org/D59780#1778988>, @MaskRay wrote:

> Apply two patches
>
>   -  uint64_t Plt = In.Plt->getVA();
>   +  uint64_t Plt = In.IBTPlt ? In.IBTPlt->getVA() : In.Plt->getVA();
>
>
>
>
>   --- i/lld/ELF/Driver.cpp
>   +++ w/lld/ELF/Driver.cpp
>   @@ -1705,2 +1705,4 @@ template <class ELFT> static uint32_t getAndFeatures() {
>   -    } else if (!features && config->requireCET)
>   -      error(toString(f) + ": --require-cet: file is not compatible with CET");
>   +    } else if (config->requireCET && !(features & GNU_PROPERTY_X86_FEATURE_1_IBT)) {
>   +      warn(toString(f) + ": --require-cet: file is not compatible with CET");
>   +      features |= GNU_PROPERTY_X86_FEATURE_1_IBT;
>   +    }
>
>
> @xiangzhangllvm The previous version I uploaded definitely did not work. I just applied a fix. Both i386 and x86_64 seem to work now, but there are still problems with the tests.
>
> You need either `arc patch D59780` or `curl -L 'https://reviews.llvm.org/D59780?download=true' | patch -p1` to apply the latest diff in your local repository.
>
> I have a separate patch to rename lld `--force-bti` to `-z force-bti`. I think `--force-ibt` or `-z force-ibt` may make more sense than `--require-cet`.


Thank you very much!
I checked the "X86-64 fail tests", the reason is just that you changed "error" to "warn".
 `--force-ibt` maybe use, (but to change `--force-ibt` to `--force-cet`, because 'cet' contains 'ibt' and 'shstk')
`--require-cet` is also needed, (strictly check the input files, make sure run ok in CET machines).
And I think it better to add `--try-cet` too, try to generate CET output if all inputs is CETed, this must be useful in bootstrap compiling program. (To let the whole program CETed step by step).

Any way, we can add the other "refined options" late, this time, just let '-force-cet' in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59780





More information about the llvm-commits mailing list