# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/grub2/hotfix-badram-infloop.patch # Copyright (C) 2024 - 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- Fix badram masks with all bits set as generated by memtest86+: badram 0x2dbf7f590,0xffffffffffffff80 inf. looping in low / high fill_mask iteration. --- grub-2.12/grub-core/mmap/mmap.c.vanilla 2024-03-05 22:25:47.314964030 +0100 +++ grub-2.12/grub-core/mmap/mmap.c 2024-03-06 00:42:04.675176109 +0100 @@ -452,6 +462,10 @@ return GRUB_ERR_NONE; } + /* There are currently few arch with full physical 64-bit address space. + Clear top bit as out mask loops will infinite loop with all bits set. */ + entry.mask &= (~(0ULL)) >> 1; + /* When part of a page is tainted, we discard the whole of it. There's no point in providing sub-page chunks. */ entry.mask &= ~(CHUNK_SIZE - 1);