From: Shakeel Butt <shakeel.butt@linux.dev>
To: Barry Song <baohua@kernel.org>
Cc: mambaxin@163.com, hannes@cmpxchg.org, mhocko@kernel.org,
roman.gushchin@linux.dev, shakeelb@google.com,
muchun.song@linux.dev, akpm@linux-foundation.org,
david@redhat.com, v-songbaohua@oppo.com, hughd@google.com,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
jose.fernandez@linux.dev, stable@vger.kernel.org,
syzbot+e12bd9ca48157add237a@syzkaller.appspotmail.com,
David Hildenbrand <david@kernel.org>,
Kairui Song <ryncsn@gmail.com>, Sasha Levin <sashal@kernel.org>,
chenxin <chenxinxin@xiaomi.com>
Subject: Re: [PATCH] mm: swap_cgroup: fix NULL deref in lookup_swap_cgroup_id on swapless host
Date: Fri, 14 Aug 2026 17:36:32 -0700 [thread overview]
Message-ID: <an-yt4a6td75VvHw@linux.dev> (raw)
In-Reply-To: <CAGsJ_4y+kGUH7TjKEGU+hbwCotHeubNdbJtoBExP+Ya-Wf3fWA@mail.gmail.com>
On Fri, Aug 14, 2026 at 07:23:41PM +0800, Barry Song wrote:
> On Fri, Aug 14, 2026 at 3:48 PM <mambaxin@163.com> wrote:
> >
> > From: "Jose Fernandez (Anthropic)" <jose.fernandez@linux.dev>
> >
> > [ Upstream commit 63b02a9409cb5180398491b093e48bcb5315f5fb ]
> >
> > lookup_swap_cgroup_id() passes swap_cgroup_ctrl[type].map to
> > __swap_cgroup_id_lookup() without checking that the type was ever
> > registered via swap_cgroup_swapon(). On a swapless host every ctrl->map
> > is NULL, so __swap_cgroup_id_lookup() dereferences NULL + a scaled
> > swp_offset().
> >
> > Since commit bea67dcc5eea ("mm: attempt to batch free swap entries for
> > zap_pte_range()"), zap_pte_range() -> swap_pte_batch() calls
> > lookup_swap_cgroup_id() on any non-present, non-none PTE that decodes as a
> > real swap entry, without first validating it against swap_info[]. A
> > single PTE corrupted into a type-0 swap entry takes the host down at
> > process exit.
>
> Thanks for the patch. However, we have a strict check to ensure that
> this is only done for valid swap entries:
This patch is already in the upstream linus tree.
Mambaxin, what do you want to do with this patch? Are you requesting to backport
this to stable tree? Which one? It already had stable CCed, so I would expect
the stable tree maintainers would pick this up automatically.
next prev parent reply other threads:[~2026-08-15 0:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 7:47 [PATCH] mm: swap_cgroup: fix NULL deref in lookup_swap_cgroup_id on swapless host mambaxin
2026-08-14 11:23 ` Barry Song
2026-08-15 0:36 ` Shakeel Butt [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 12:55 Jose Fernandez (Anthropic)
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=an-yt4a6td75VvHw@linux.dev \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=chenxinxin@xiaomi.com \
--cc=david@kernel.org \
--cc=david@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=jose.fernandez@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mambaxin@163.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=ryncsn@gmail.com \
--cc=sashal@kernel.org \
--cc=shakeelb@google.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+e12bd9ca48157add237a@syzkaller.appspotmail.com \
--cc=v-songbaohua@oppo.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