Dependence of instruction execution time on data on ARM and Intel CPUs

Eric Biggers, one of the developers of the Adiantum cipher and a kernel subsystem maintainer Linux fscrypt, предложил набор патчей для блокирования проблем с безопасностью, возникающих из-за особенности процессоров Intel, не гарантирующей постоянное время выполнения инструкций для разных обрабатываемых данных. В процессорах Intel проблема проявляется начиная с семейства Ice Lake. Аналогичная проблема наблюдается и в процессорах ARM.

Dependence of the execution time of instructions on the data processed in these instructions is regarded by the author of the patches as a vulnerability in processors, since such behavior cannot guarantee the security of cryptographic operations performed in the system. Many implementations of cryptographic algorithms rely on the fact that data does not affect the execution time of instructions, and violation of this behavior can lead to the creation of side-channel attacks that recover data based on analysis of the processing time.

Potentially, runtime dependence on data can also be used to organize attacks to determine kernel data from user space. According to Eric Biggers, even for instructions that perform addition and XOR operations, as well as for specialized AES-NI instructions, a constant execution time is not provided by default (the information is not confirmed by tests, according to other data, there is a delay of one cycle when multiplying vectors and counting bits ).

To disable this behavior, Intel and ARM have proposed new flags: the DIT (Data Independent Timing) PSTATE bit for ARM CPUs and the DOITM (Data Operand Independent Timing Mode) MSR bit for Intel CPUs, returning the old behavior with constant execution time. Intel and ARM recommend turning on protection as needed for critical code, but in reality, important calculations can occur in any part of the kernel and user space, so the possibility of permanently enabling DOITM and DIT modes for the entire kernel is being considered.

Для процессоров ARM в ветку ядра Linux 6.2 уже приняты патчи, меняющие поведение для ядра, но данные патчи рассматриваются как недостаточные, так как они охватывают только код ядра и не меняют поведение для пространства пользователя. Для процессоров Intel включение защиты пока находится только на стадии рецензирования. Измерение влияния патча на производительность пока не проводилось, но по данным из документации Intel включение режима DOITM снижает производительность (например, из-за отключения некоторых оптимизаций, таких как специфичная для определённых данных упреждающая загрузка) и в будущих моделях процессоров снижение производительности может усилиться.

Source: opennet.ru

Buy reliable hosting for sites with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster