All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Huang Shijie" <huangsj@hygon.cn>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 2/4] mm: use get_i_mmap_root to access the file's i_mmap
Date: Thu, 11 Jun 2026 06:31:58 +0000	[thread overview]
Message-ID: <20260611063158.94DCC1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260611061915.2354307-3-huangsj@hygon.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] In `nommu_shrink_inode_mappings`, `get_i_mmap_root()` is incorrectly called with `&inode->i_mapping` instead of `inode->i_mapping`, causing an invalid pointer calculation and subsequent memory corruption.
--

commit af3e57c8cfc7072a4088af8cf0bf41f373c9261b
Author: Huang Shijie <huangsj@hygon.cn>

mm: use get_i_mmap_root to access the file's i_mmap

This patch introduces the get_i_mmap_root() helper to encapsulate direct 
accesses to the i_mmap interval tree root within struct address_space. It 
updates various architectures and core memory management subsystems to use 
the new helper.

> diff --git a/mm/nommu.c b/mm/nommu.c
> index ed3934bc2de48..0f18ffc658e95 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
[ ... ]
> @@ -1804,6 +1804,7 @@ EXPORT_SYMBOL_GPL(copy_remote_vm_str);
>  int nommu_shrink_inode_mappings(struct inode *inode, size_t size,
>  				size_t newsize)
>  {
> +	struct rb_root_cached *root = get_i_mmap_root(&inode->i_mapping);

[Severity: High]
Does this code pass a double pointer to get_i_mmap_root()? 

Since inode->i_mapping is already a pointer to struct address_space, passing 
&inode->i_mapping provides a struct address_space ** instead of the expected 
struct address_space *. 

This will cause get_i_mmap_root() to calculate an invalid address by adding 
the structure offset to the address of the i_mapping pointer itself. The 
subsequent call to vma_interval_tree_foreach() will interpret garbage memory 
as an rb_root_cached structure, leading to a panic when it attempts to 
dereference the fake rb_node pointers. Should this be called with 
inode->i_mapping instead?

>  	struct vm_area_struct *vma;
>  	struct vm_region *region;
>  	pgoff_t low, high;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260611061915.2354307-1-huangsj@hygon.cn?part=2

  reply	other threads:[~2026-06-11  6:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11  6:18 [PATCH v2 0/4] mm: split the file's i_mmap tree for NUMA Huang Shijie
2026-06-11  6:18 ` [PATCH v2 1/4] mm: use mapping_mapped to simplify the code Huang Shijie
2026-06-11 11:13   ` Pedro Falcato
2026-06-11  6:18 ` [PATCH v2 2/4] mm: use get_i_mmap_root to access the file's i_mmap Huang Shijie
2026-06-11  6:31   ` sashiko-bot [this message]
2026-06-11  6:18 ` [PATCH v2 3/4] mm/fs: split the file's i_mmap tree Huang Shijie
2026-06-11  6:37   ` sashiko-bot
2026-06-11 11:11   ` Pedro Falcato
2026-06-11  6:19 ` [PATCH v2 4/4] docs/mm: update document for split " Huang Shijie
2026-06-11  6:26   ` sashiko-bot

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=20260611063158.94DCC1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=huangsj@hygon.cn \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.