[PATCH] libphobos: Include <cet.h> to generate the CET marker for -fcf-protection

Iain Buclaw ibuclaw@gdcproject.org
Wed Sep 9 17:20:14 GMT 2020


Excerpts from H.J. Lu's message of September 9, 2020 7:08 pm:
> On Mon, Sep 7, 2020 at 7:09 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> On Mon, Sep 7, 2020 at 2:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>> >
>> > Hi,
>> >
>> > This patch removes whatever CET support was in the switchContext routine
>> > for x86 D runtime, and instead uses the ucontext fallback, which propely
>> > handles shadow stack handling.
>> >
>> > Rather than implementing support within D runtime itself, use libc
>> > getcontext/setcontext functions if CET is enabled instead.
>> >
>> > HJ, does this look reasonable before I commit it?  The detection has
>> > been done at configure-time, rather than adding a predefined version
>> > condition for CET within the compiler.
>> >
>> > Done regression testing on x86_64-linux-gnu/-m32/-mx32.
>> >
>> > Regards
>> > Iain.
>> >
>> > ---
>> > libphobos/ChangeLog:
>> >
>> >         PR d/95680
>> >         * Makefile.in: Regenerate.
>> >         * configure: Regenerate.
>> >         * configure.ac (DCFG_ENABLE_CET): Substitute.
>> >         * libdruntime/Makefile.in: Regenerate.
>> >         * libdruntime/config/x86/switchcontext.S: Remove CET support code.
>> >         * libdruntime/core/thread.d: Import gcc.config.  Don't set version
>> >         AsmExternal when GNU_Enable_CET is true.
>> >         * libdruntime/gcc/config.d.in (GNU_Enable_CET): Define.
>> >         * src/Makefile.in: Regenerate.
>> >         * testsuite/Makefile.in: Regenerate.
>>
>> Looks good.  I can try it on Tiger Lake after it has been checked in.
>>
> 
> Here is the patch to enable the CET marker for -fcf-protection.
> I saw some D run-time failures.  I will investigate them.
> 

Thanks, feel free to commit.

Iain.


More information about the Gcc-patches mailing list