summaryrefslogtreecommitdiff
path: root/mm/Kconfig.debug
diff options
context:
space:
mode:
authorRik van Riel <riel@surriel.com>2023-07-19 22:41:37 +0300
committerMike Rapoport (IBM) <rppt@kernel.org>2023-07-24 08:52:56 +0300
commit9e46e4dcd9d6cd88342b028dbfa5f4fb7483d39c (patch)
tree06bd454aba113d778aec8d8243a7a9b8526c49e2 /mm/Kconfig.debug
parent6eaae198076080886b9e7d57f4ae06fa782f90ef (diff)
downloadlinux-9e46e4dcd9d6cd88342b028dbfa5f4fb7483d39c.tar.xz
mm,memblock: reset memblock.reserved to system init state to prevent UAF
The memblock_discard function frees the memblock.reserved.regions array, which is good. However, if a subsequent memblock_free (or memblock_phys_free) comes in later, from for example ima_free_kexec_buffer, that will result in a use after free bug in memblock_isolate_range. When running a kernel with CONFIG_KASAN enabled, this will cause a kernel panic very early in boot. Without CONFIG_KASAN, there is a chance that memblock_isolate_range might scribble on memory that is now in use by somebody else. Avoid those issues by making sure that memblock_discard points memblock.reserved.regions back at the static buffer. If memblock_free is called after memblock memory is discarded, that will print a warning in memblock_remove_region. Signed-off-by: Rik van Riel <riel@surriel.com> Link: https://lore.kernel.org/r/20230719154137.732d8525@imladris.surriel.com Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Diffstat (limited to 'mm/Kconfig.debug')
0 files changed, 0 insertions, 0 deletions