В ядре Linux устранена следующая уязвимость:
riscv: запретить разыменование нулевого указателя в Machine_kexec_prepare()
Проблема разыменования нулевого указателя замечена в riscv.
Machine_kexec_prepare(), где image->segment[i].buf может быть NULL и
скопировано без проверки.
NULL-буф поступает из ima_add_kexec_buffer(), где kbuf добавляется
kexec_add_buffer(), но kbuf.buffer равен NULL, то он копируется без
проверка в Machine_kexec_prepare():
kexec_file_load
-> kimage_file_alloc_init()
-> kimage_file_prepare_segments()
-> ima_add_kexec_buffer()
-> kexec_add_buffer()
-> Machine_kexec_prepare()
-> память()
Устраните эту проблему, добавив проверку перед попыткой копирования данных.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: riscv: Prevent NULL pointer dereference in machine_kexec_prepare() A NULL pointer dereference issue is noticed in riscv's machine_kexec_prepare(), where image->segment[i].buf might be NULL and copied unchecked. The NULL buf comes from ima_add_kexec_buffer(), where kbuf is added by kexec_add_buffer(), but kbuf.buffer is NULL, then it is copied without a check in machine_kexec_prepare(): kexec_file_load -> kimage_file_alloc_init() -> kimage_file_prepare_segments() -> ima_add_kexec_buffer() -> kexec_add_buffer() -> machine_kexec_prepare() -> memcpy() Address this by adding a check before the data copy attempt.