[devel] I: LTO in %optflags by default

Andrey Savchenko bircoph на altlinux.org
Ср Авг 25 09:53:29 MSK 2021


On Wed, 25 Aug 2021 08:46:40 +0300 Denis Medvedev wrote:
> В Wed, 25 Aug 2021 09:27:50 +0400
> "Ivan A. Melnikov" <iv на altlinux.org> пишет:
> 
> > On Tue, Aug 24, 2021 at 09:20:50PM +0300, Dmitry V. Levin wrote:
> > > Hi,
> > > 
> > > Пришло время включить в Сизифе LTO (link-time optimization).
> > > К сожалению, ещё не все пакеты собираются с этой оптимизацией,
> > > некоторые предстоит исправить.  
> > 
> > Скажите, а как это влияет на время сборки пакетов?
> > 
> > Это тестировалось только на основных архитектурах? На всех?
> > 
> 
> Я, конечно, понимаю, что запоздал с этим,
> но можно ли включить
> по умолчаниию заодно вот это:
> 
> 
> -mmitigate-rop
> Attempt to compile code without unintended return addresses, making ROP just a little harder.
> 
> -mindirect-branch=thunk -mfunction-return=thunk
> Enables retpoline (return trampolines) to mitigate some variants of Spectre V2. The second flag is necessary on Skylake+ due to the fact that the branch target buffer is vulnerable.

Но эти опции, ведь, не на всех архитектурах нужны, даже в основной
сборочнице. Поэтому если и включать, то выборочно в зависимости от
архитектуры.
 
> -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4
> choice of "-fstack-protector" does not protect all functions . You need -fstack-protector-all to guarantee guards are applied to all functions, although this will likely incur a performance penalty. Consider -fstack-protector-strong as a middle ground.
> The -Wstack-protector flag here gives warnings for any functions that aren't going to get protected.
> 
> -fstack-clash-protection
> Defeats a class of attacks called stack clashing.

Эта может поломать много приложений и может быть значимый удар по
производительности.
 
> ­-Wl,-z,relro,-z,now
> RELRO (read-only relocation). The options relro & now specified
> together are known as "Full RELRO". You can specify "Partial RELRO" by
> omitting the now flag. RELRO marks various ELF memory sections
> read­only (E.g. the GOT).

С точки зрения безопасности это хорошо, а вот тормоза даёт дикие,
особенно на тяжёлых приложениях типа LO. Возможно, в этом есть смысл
в специальных ветках, но в Сизиф такое не нужно тянуть.

Best regards,
Andrew Savchenko
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : отсутствует
Тип     : application/pgp-signature
Размер  : 833 байтов
Описание: отсутствует
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20210825/fdeec271/attachment-0001.bin>


Подробная информация о списке рассылки Devel