https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356

--- Comment #10 from Arnd Bergmann <arnd at linaro dot org> ---
I sent a (rather crude) workaround to the kernel mailing list now, mainly to
get the crypto maintainers involved in this as well. I also did further testing
and found that in the entire kernel, this is the only place that caused this
particular problem:

- comparing gcc-7.1.1 and gcc-7.2.1, many of the 72326 functions with >64 byte
stack usage use less stack in gcc-7.2, only the AES code uses much more

- In 30 architectures I tested, the stack frames are more than twice as big as
the second-largest function, around 2KB for 32-bit architectures and 4KB for
64-bit architectures. The only exception is aarch64, which uses only 500 bytes
here.

- There are a handful of other functions that show a very substantial stack
size increase with UBSAN (enic_rq_service() 2240 bytes,
fnic_rq_cmpl_handler_cont() 2240 bytes, dsp3780I_EnableDSP() 1016 bytes), but
all of them are the same way in older compilers as well, those are not
regressions. 

- From looking at the assembler output for the AES cipher, it appears that
gcc-7.1 and gcc-8 are both worse than gcc-6, with or without UBSAN, but only
gcc-7.2 with UBSAN is drastically worse. As mentioned in my patch description,
this needs to be tested better. There is a test module in the kernel to measure
the throughput of the AES code, but I have not tried it myself.

https://patchwork.kernel.org/patch/10126567/

Reply via email to