mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-28 19:06:51 +01:00
Now, as the page_ext holds count of IOMMU mappings, we can use it to assert that any page allocated/freed is indeed not in the IOMMU. The sanitizer doesn’t protect against mapping/unmapping during this period. However, that’s less harmful as the page is not used by the kernel. Reviewed-by: Samiullah Khawaja <skhawaja@google.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Mostafa Saleh <smostafa@google.com> Reviewed-by: Pranjal Shrivastava <praan@google.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
33 lines
860 B
C
33 lines
860 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2025 - Google Inc
|
|
* Author: Mostafa Saleh <smostafa@google.com>
|
|
* IOMMU API debug page alloc sanitizer
|
|
*/
|
|
|
|
#ifndef __LINUX_IOMMU_DEBUG_PAGEALLOC_H
|
|
#define __LINUX_IOMMU_DEBUG_PAGEALLOC_H
|
|
|
|
#ifdef CONFIG_IOMMU_DEBUG_PAGEALLOC
|
|
DECLARE_STATIC_KEY_FALSE(iommu_debug_initialized);
|
|
|
|
extern struct page_ext_operations page_iommu_debug_ops;
|
|
|
|
void __iommu_debug_check_unmapped(const struct page *page, int numpages);
|
|
|
|
static inline void iommu_debug_check_unmapped(const struct page *page, int numpages)
|
|
{
|
|
if (static_branch_unlikely(&iommu_debug_initialized))
|
|
__iommu_debug_check_unmapped(page, numpages);
|
|
}
|
|
|
|
#else
|
|
static inline void iommu_debug_check_unmapped(const struct page *page,
|
|
int numpages)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_IOMMU_DEBUG_PAGEALLOC */
|
|
|
|
#endif /* __LINUX_IOMMU_DEBUG_PAGEALLOC_H */
|