2022-12-19 06:46:30

by Dan Li

[permalink] [raw]
Subject: Re: [RFC/RFT] CFI: Add support for gcc CFI in aarch64

+ Cc: [email protected]
On 12/18, Dan Li wrote:
> Based on Sami's patch[1], this patch makes the corresponding kernel
> configuration of CFI available when compiling the kernel with the gcc[2].
>
> The code after enabling cfi is as follows:
>
> int (*p)(void);
> int func (int)
> {
> p();
> }
>
> __cfi_func:
> .4byte 0x439d3502
> func:
> ......
> adrp x0, p
> add x0, x0, :lo12:p
> mov w1, 23592
> movk w1, 0x4601, lsl 16
> cmp w0, w1
> beq .L2
> ......
> bl cfi_check_failed
> .L2:
> blr x19
> ret
>
> In the compiler part[4], there are some differences from Sami's
> implementation[3], mainly including: