В ядре Linux устранена следующая уязвимость: bpf: Значения байтов Reject >8 на обратных трамплинах btf_distill_func_proto() строит функциональную модель, используемую для батутов fentry/fexit/fmod_ret/fsession и struct_ops. Он принял 16-байтовое значение возврата __int128 с момента введения батута: __get_type_size () возвращает размер типа целого числа, а проверка типа возврата только отвергает ret < 0. Но батут BPF сохраняет только 8 байт возвратного значения (RAX на x86, т.е.
R0). Для типа attach, который читает возвращаемое значение цели, вторая половина (RDX / R3) не сохраняется и не восстанавливается, поэтому программа, прикрепленная к функции, возвращающей 16-байтное значение, портит значение, увиденное реальным абонентом, и сама соблюдает только половину его. struct_ops батут имеет такое же ограничение. Это влияет на типы attach, которые читают возвращаемое значение цели: fexit, fmod_ret и fsession (плюс _multi варианты fexit и fsession), и struct_ops. fentry/fentry_multi запускается до возвращения цели и не затрагивается.
Отклоните значение байта >8 для этих типов присоединений в bpf_check_attach_target() и bpf_check_attach_btf_id_multi(), а для struct_ops в bpf_struct_ops_desc_init().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: bpf: Reject >8 byte return values on return-reading trampoline paths btf_distill_func_proto() builds the function model used for the fentry/fexit/fmod_ret/fsession trampolines and struct_ops. It has accepted a 16-byte __int128 return value since the trampoline was introduced: __get_type_size() returns the integer's type size, and the return-type check only rejected ret < 0. But the BPF trampoline preserves only 8 bytes of the return value (RAX on x86, i.e. R0). For an attach type that reads the target's return value the second half (RDX / R3) is neither saved nor restored, so a program attached to a function returning a 16-byte value corrupts the value seen by the real caller and itself observes only half of it. struct_ops trampolines have the same limitation. This affects the attach types that read the target's return value: fexit, fmod_ret and fsession (plus the _multi variants of fexit and fsession), and struct_ops. fentry/fentry_multi run before the target returns and are unaffected. Reject a >8 byte return value for these attach types in bpf_check_attach_target() and bpf_check_attach_btf_id_multi(), and for struct_ops in bpf_struct_ops_desc_init().