[PATCH] D72167: Add support for __declspec(guard(nocf))

Andrew Paverd via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 06:37:08 PST 2020


ajpaverd added a comment.

In D72167#1803333 <https://reviews.llvm.org/D72167#1803333>, @dmajor wrote:

> Thanks for doing this!
>
> When I applied this patch and added `__declspec(guard(nocf))` to the function that was giving us trouble <https://searchfox.org/mozilla-central/rev/652014ca1183c56bc5f04daf01af180d4e50a91c/mozglue/misc/nsWindowsDllInterceptor.h#139>, I still crashed with a CFG failure in the caller, since the `nocf` function was inlined. When I additionally marked that function as `noinline`, then the CFG checks were omitted, as desired. Is this behavior with respect to inlining expected?
>
> You may want to mention "PR44096" in the commit message.


Thanks for testing this @dmajor! I think the expected behaviour is that the modifier (or lack thereof) should be preserved even if the function is inlined. The latest changes should achieve this by placing the `"guard_nocf"` attribute on the individual indirect call instructions rather than the function itself. Does this now work for your function without having to add `noinline`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72167





More information about the llvm-commits mailing list