mm-kmsan-handle-alloc-failures-in-kmsan_ioremap_page_range.patch removed from -mm tree
The quilt patch titled
Subject: mm: kmsan: handle alloc failures in kmsan_ioremap_page_range()
has been removed from the -mm tree. Its filename was
mm-kmsan-handle-alloc-failures-in-kmsan_ioremap_page_range.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Alexander Potapenko <[email protected]>
Subject: mm: kmsan: handle alloc failures in kmsan_ioremap_page_range()
Date: Thu, 13 Apr 2023 15:12:21 +0200
Similarly to kmsan_vmap_pages_range_noflush(), kmsan_ioremap_page_range() must also properly handle allocation/mapping failures. In the case of such, it must clean up the already created metadata mappings and return an error code, so that the error can be propagated to ioremap_page_range(). Without doing so, KMSAN may silently fail to bring the metadata for the page range into a consistent state, which will result in user-visible crashes when trying to access them.
---
include/linux/kmsan.h | 19 +++++++------ mm/kmsan/hooks.c | 55 ++++++++++++++++++++++++++++++++++------ mm/vmalloc.c | 4 +- 3 files changed, 59 insertions(+), 19 deletions(-)
include/linux/kmsan.h renamed from include/linux/kmsan.h~mm-kmsan-handle-alloc-failures-in-kmsan_ioremap_page_range +10 -9
@@ -160,11 +160,12 @@ void kmsan_vunmap_range_noflush(unsigned* @page_shift: page_shift argument passed to vmap_range_noflush(). * * KMSAN creates new metadata pages for the physical pages mapped into the -* virtual memory. +* virtual memory. Returns 0 on success, callers must check for non-zero return +* value. */ -void kmsan_ioremap_page_range (unsigned long addr,unsigned long end, -phys_addr_t phys_addr,pgprot_t prot, -unsigned int page_shift); +int kmsan_ioremap_page_range (unsigned long addr,unsigned long end, +phys_addr_t phys_addr,pgprot_t prot, +unsigned int page_shift);/** * kmsan_iounmap_page_range() - Notify KMSAN about a iounmap_page_range() call.
@@ -296,12 +297,12 @@ static inline void kmsan_vunmap_range_no { } -static inline void kmsan_ioremap_page_range (unsigned long start, -unsigned long end, -phys_addr_t phys_addr, -pgprot_t prot, -unsigned int page_shift) +static inline int kmsan_ioremap_page_range (unsigned long start, +unsigned long end, +phys_addr_t phys_addr,pgprot_t prot, +unsigned int page_shift) { +return 0 ; } static inline void kmsan_iounmap_page_range(unsigned long start,
mm/kmsan/hooks.c renamed from mm/kmsan/hooks.c~mm-kmsan-handle-alloc-failures-in-kmsan_ioremap_page_range +47 -8
82 lines not on this page · raw message
mm/vmalloc.c renamed from mm/vmalloc.c~mm-kmsan-handle-alloc-failures-in-kmsan_ioremap_page_range +2 -2
@@ -313,8 +313,8 @@ int ioremap_page_range(unsigned long add ioremap_max_page_shift);flush_cache_vmap (addr, end);if (!err) -kmsan_ioremap_page_range (addr, end, phys_addr, prot, - ioremap_max_page_shift); + err =kmsan_ioremap_page_range (addr, end, phys_addr, prot, + ioremap_max_page_shift);return err; }
_
Patches currently in -mm which might be from [email protected] are
mm-kmsan-apply-__must_check-to-non-void-functions.patch mm-apply-__must_check-to-vmap_pages_range_noflush.patch