# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/grub2/hotfix-badram-infloop.patch # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-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);