linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mostafa Saleh <smostafa@google.com>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: linux-mm@kvack.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	corbet@lwn.net, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, akpm@linux-foundation.org, vbabka@suse.cz,
	surenb@google.com, mhocko@suse.com, jackmanb@google.com,
	hannes@cmpxchg.org, ziy@nvidia.com, david@redhat.com,
	lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
	rppt@kernel.org, xiaqinxin@huawei.com, rdunlap@infradead.org
Subject: Re: [PATCH v4 1/4] iommu: Add page_ext for IOMMU_DEBUG_PAGEALLOC
Date: Fri, 12 Dec 2025 18:37:31 +0000	[thread overview]
Message-ID: <aTxg6yHWdFrW41ZC@google.com> (raw)
In-Reply-To: <341bbfd9-e6bb-4d1e-b9c0-9077dc3eaba3@linux.intel.com>

On Fri, Dec 12, 2025 at 10:17:11AM +0800, Baolu Lu wrote:
> On 12/11/25 20:59, 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@google.com>
> > ---
> >   .../admin-guide/kernel-parameters.txt         |  9 ++++++
> >   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, 82 insertions(+)
> >   create mode 100644 drivers/iommu/iommu-debug-pagealloc.c
> >   create mode 100644 include/linux/iommu-debug-pagealloc.h
> 
> Do you need to update the MAINTAINERS file, since a new file (iommu-
> debug-pagealloc.h) is being added?
> 
> > 
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> > index a8d0afde7f85..d484d9d8d0a4 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > @@ -2675,6 +2675,15 @@ Kernel parameters
> >   			1 - Bypass the IOMMU for DMA.
> >   			unset - Use value of CONFIG_IOMMU_DEFAULT_PASSTHROUGH.
> > +	iommu.debug_pagealloc=
> > +			[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 behaves the same way as a kernel
> > +			built without CONFIG_IOMMU_DEBUG_PAGEALLOC.
> > +			Format: { "0" | "1" }
> > +			0 - Sanitizer disabled.
> > +			1 - Sanitizer enabled, expect runtime overhead.
> 
> "iommu.debug_pagealloc=0" has the same meaning as "unset". Would
> "iommu=debug_pagealloc" look more appropriate?

"iommu=" seems to be x86 specific. I was following the pattern for
"iommu.passthrough=", "iommu.strict=" and also as "debug_pagealloc="
has it's own command line, it made sense to design this way.

Thanks,
Mostafa

> 
> > +
> >   	io7=		[HW] IO7 for Marvel-based Alpha systems
> >   			See comment before marvel_specify_io7 in
> >   			arch/alpha/kernel/core_marvel.c.
> 
> [ ... ]
> 
> Other changes look good to me.
> 
> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

  reply	other threads:[~2025-12-12 18:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 12:59 [PATCH v4 0/4] iommu: Add IOMMU_DEBUG_PAGEALLOC sanitizer Mostafa Saleh
2025-12-11 12:59 ` [PATCH v4 1/4] iommu: Add page_ext for IOMMU_DEBUG_PAGEALLOC Mostafa Saleh
2025-12-12  2:17   ` Baolu Lu
2025-12-12 18:37     ` Mostafa Saleh [this message]
2025-12-11 12:59 ` [PATCH v4 2/4] iommu: Add calls " Mostafa Saleh
2025-12-12  2:33   ` Baolu Lu
2025-12-12 18:44     ` Mostafa Saleh
2025-12-11 12:59 ` [PATCH v4 3/4] iommu: debug-pagealloc: Track IOMMU pages Mostafa Saleh
2025-12-12  2:45   ` Baolu Lu
2025-12-11 12:59 ` [PATCH v4 4/4] iommu: debug-pagealloc: Check mapped/unmapped kernel memory Mostafa Saleh
2025-12-12  2:51   ` Baolu Lu
2025-12-12 18:47     ` Mostafa Saleh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTxg6yHWdFrW41ZC@google.com \
    --to=smostafa@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=iommu@lists.linux.dev \
    --cc=jackmanb@google.com \
    --cc=joro@8bytes.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=will@kernel.org \
    --cc=xiaqinxin@huawei.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).