Commit 8aac4069 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Jialin Zhang
Browse files

efi: libstub: Disable struct randomization

stable inclusion
from stable-v5.10.143
commit 94f0f30b2d9dcc3ac920029b518bff99f5b66f79
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0U6

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=94f0f30b2d9dcc3ac920029b518bff99f5b66f79



--------------------------------

commit 1a388792 upstream.

The EFI stub is a wrapper around the core kernel that makes it look like
a EFI compatible PE/COFF application to the EFI firmware. EFI
applications run on top of the EFI runtime, which is heavily based on
so-called protocols, which are struct types consisting [mostly] of
function pointer members that are instantiated and recorded in a
protocol database.

These structs look like the ideal randomization candidates to the
randstruct plugin (as they only carry function pointers), but of course,
these protocols are contracts between the firmware that exposes them,
and the EFI applications (including our stubbed kernel) that invoke
them. This means that struct randomization for EFI protocols is not a
great idea, and given that the stub shares very little data with the
core kernel that is represented as a randomizable struct, we're better
off just disabling it completely here.

Cc: <stable@vger.kernel.org> # v4.14+
Reported-by: default avatarDaniel Marth <daniel.marth@inso.tuwien.ac.at>
Tested-by: default avatarDaniel Marth <daniel.marth@inso.tuwien.ac.at>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 7a074423
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment