[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aSV6E1a4tL_Vt8cz@google.com>
Date: Tue, 25 Nov 2025 09:42:43 +0000
From: Mostafa Saleh <smostafa@...gle.com>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: linux-mm@...ck.org, iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, corbet@....net, joro@...tes.org,
will@...nel.org, robin.murphy@....com, akpm@...ux-foundation.org,
vbabka@...e.cz, surenb@...gle.com, mhocko@...e.com,
jackmanb@...gle.com, hannes@...xchg.org, ziy@...dia.com,
david@...hat.com, lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com, rppt@...nel.org, xiaqinxin@...wei.com
Subject: Re: [PATCH v3 1/4] drivers/iommu: Add page_ext for
IOMMU_DEBUG_PAGEALLOC
On Mon, Nov 24, 2025 at 05:31:12PM -0800, Randy Dunlap wrote:
> I missed one other thing:
>
> On 11/24/25 3:13 PM, Randy Dunlap wrote:
> >
> >
> > On 11/24/25 12:08 PM, Mostafa Saleh wrote:
> >> Add a new config IOMMU_DEBUG_PAGEALLOC, which registers new data to
> >> page_ext.
> >>
> >> This config will be used by the IOMMU API to track pages mapped in
> >> the IOMMU to catch drivers trying to free kernel memory that they
> >> still map in their domains, causing all types of memory corruption.
> >>
> >> This behaviour is disabled by default and can be enabled using
> >> kernel cmdline iommu.debug_pagealloc.
> >>
> >> Signed-off-by: Mostafa Saleh <smostafa@...gle.com>
> >> ---
> >> .../admin-guide/kernel-parameters.txt | 6 ++++
> >> drivers/iommu/Kconfig | 19 +++++++++++
> >> drivers/iommu/Makefile | 1 +
> >> drivers/iommu/iommu-debug-pagealloc.c | 32 +++++++++++++++++++
> >> include/linux/iommu-debug-pagealloc.h | 17 ++++++++++
> >> mm/page_ext.c | 4 +++
> >> 6 files changed, 79 insertions(+)
> >> create mode 100644 drivers/iommu/iommu-debug-pagealloc.c
> >> create mode 100644 include/linux/iommu-debug-pagealloc.h
> >>
> >> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> >> index 6c42061ca20e..dddf435a1c11 100644
> >> --- a/Documentation/admin-guide/kernel-parameters.txt
> >> +++ b/Documentation/admin-guide/kernel-parameters.txt
> >> @@ -2557,6 +2557,12 @@
> >> 1 - Bypass the IOMMU for DMA.
> >> unset - Use value of CONFIG_IOMMU_DEFAULT_PASSTHROUGH.
> >>
> >> + iommu.debug_pagealloc=
>
> Please note what format the option parameter value takes and possible values,
> like iommu.passthrough above here in the kernel-parameters.txt file.
I see, I was following the kernel's “debug_pagealloc”. Although, the
implementation understands “={0,1}”, I can add something as:
Format: { "0" | "1" }
0 - Sanitizer disabled.
1 - Sanitizer enabled, expect run-time overhead.
To make it more clear.
Thanks,
Mostafa
>
> >> + [KNL,EARLY] When CONFIG_IOMMU_DEBUG_PAGEALLOC is set, this
> >> + parameter enables the feature at boot time. By default, it
> >> + is disabled and the system behave the same way as a kernel
> >
> > behaves
> >
> >> + built without CONFIG_IOMMU_DEBUG_PAGEALLOC.
> >> +
> >> io7= [HW] IO7 for Marvel-based Alpha systems
> >> See comment before marvel_specify_io7 in
> >> arch/alpha/kernel/core_marvel.c.
> >
> >
>
> --
> ~Randy
>
Powered by blists - more mailing lists