efi/libstub: arm64: Force Image reallocation if BSS was not reserved
stable inclusion from stable-5.10.60 commit feb4a01d3ece8bed055a47366ca20c257c03868f bugzilla: 177018 https://gitee.com/openeuler/kernel/issues/I4EAUG Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=feb4a01d3ece8bed055a47366ca20c257c03868f -------------------------------- [ Upstream commit 5b94046e ] Distro versions of GRUB replace the usual LoadImage/StartImage calls used to load the kernel image with some local code that fails to honor the allocation requirements described in the PE/COFF header, as it does not account for the image's BSS section at all: it fails to allocate space for it, and fails to zero initialize it. Since the EFI stub itself is allocated in the .init segment, which is in the middle of the image, its BSS section is not impacted by this, and the main consequence of this omission is that the BSS section may overlap with memory regions that are already used by the firmware. So let's warn about this condition, and force image reallocation to occur in this case, which works around the problem. Fixes: 82046702 ("efi/libstub/arm64: Replace 'preferred' offset with alignment check") Signed-off-by: NArd Biesheuvel <ardb@kernel.org> Tested-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NChen Jun <chenjun102@huawei.com> Acked-by: NWeilong Chen <chenweilong@huawei.com> Signed-off-by: NChen Jun <chenjun102@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Showing
想要评论请 注册 或 登录