dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.54k stars 4.54k forks source link

[mini] Support stack protector codegen #61845

Open lambdageek opened 2 years ago

lambdageek commented 2 years ago

We should support generating AOT code compatible with -fstack-protector and emit CFI directives or the relevant LLVM bitcode, for mini AOT and LLVM AOT, respectively.

One use case is Android profiled AOT, see https://github.com/xamarin/xamarin-android/issues/6502 But it is something that may be useful on other targets

lambdageek commented 2 years ago

On LLVM, it looks like this is the ssp function attribute https://llvm.org/docs/LangRef.html#function-attributes. I'm not sure if it's enough to set the ssp flag on the functions we emit, or if we also need to change some other aspects of our LLVM backend. We would need to investigate.