[PATCH v2 08/12] crypto: x86/sm4 - fix crash with CFI enabled

Sami Tolvanen samitolvanen at google.com
Fri Nov 18 14:01:40 PST 2022


On Fri, Nov 18, 2022 at 12:53 PM Sami Tolvanen <samitolvanen at google.com> wrote:
>
> On Fri, Nov 18, 2022 at 12:27 PM Sami Tolvanen <samitolvanen at google.com> wrote:
> >
> > On Fri, Nov 18, 2022 at 12:10 PM Eric Biggers <ebiggers at kernel.org> wrote:
> > > Sami, is it expected that a CFI check isn't being generated for the indirect
> > > call to 'func' in sm4_avx_cbc_decrypt()?  I'm using LLVM commit 4a7be42d922af0.
> >
> > If the compiler emits an indirect call, it should also emit a CFI
> > check. What's the assembly code it generates here?
>
> With CONFIG_RETPOLINE, the check is emitted as expected, but I can
> reproduce this issue without retpolines. It looks like the cfi-type
> attribute is dropped from the machine instruction in one of the X86
> specific passes. I'll take a look.

This should now be fixed in ToT LLVM after commit 7c96f61aaa4c. Thanks
for spotting the issue!

Sami



More information about the linux-arm-kernel mailing list