linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Deepanshu Kartikey <kartikey406@gmail.com>
To: Kairui Song <ryncsn@gmail.com>
Cc: akpm@linux-foundation.org, chrisl@kernel.org,
	shikemeng@huaweicloud.com,  nphamcs@gmail.com, bhe@redhat.com,
	baohua@kernel.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org,
	YoungJun Park <youngjun.park@lge.com>,
	 syzbot+d7bc9ec4a100437aa7a2@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm/swapfile: validate swap offset in unuse_pte_range()
Date: Sat, 6 Dec 2025 17:58:10 +0530	[thread overview]
Message-ID: <CADhLXY6FgG3sdZ1CSSp5X8huFPhyKQ+LKNkd0rbo_-=gV40RoA@mail.gmail.com> (raw)
In-Reply-To: <CAMgjq7B7+=_hfo+BZr-cyYayUCUhVQWRDsC7FGpMKAXdvY5_wQ@mail.gmail.com>

On Wed, Dec 3, 2025 at 8:24 AM Kairui Song <ryncsn@gmail.com> wrote:
> > If softleaf v3 has fixed the underlying issue, I can withdraw this
> > patch. Or if you think a defensive sanity check still has value, I can
> > update the commit message to reflect that it is defensive hardening
> > rather than a fix for an active bug.
>
> A sanity check here is acceptable since swapoff is cold and the
> overhead is hardly visible. No strong opinion on this one.

Hi Kairui,

Thank you for the link and clarification!

I'll study Lorenzo's fix to understand the root cause better.

Since you mentioned a sanity check is acceptable here, should I update
the commit message to frame this as defensive hardening rather than a
bug fix? Something like:

    mm/swapfile: add defensive bounds check in unuse_pte_range()

    Add a sanity check to validate the swap offset is within bounds
    before using it. While there is no known code path that can
    trigger an out-of-bounds offset, this provides defense against
    potential edge cases or memory corruption.

    The overhead is negligible since swapoff is a cold path.

Thanks,
Deepanshu


      reply	other threads:[~2025-12-06 12:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01  9:37 Deepanshu Kartikey
2025-12-01 10:27 ` YoungJun Park
2025-12-01 10:40 ` Kairui Song
2025-12-01 10:48   ` Deepanshu Kartikey
2025-12-03  2:53     ` Kairui Song
2025-12-06 12:28       ` Deepanshu Kartikey [this message]

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='CADhLXY6FgG3sdZ1CSSp5X8huFPhyKQ+LKNkd0rbo_-=gV40RoA@mail.gmail.com' \
    --to=kartikey406@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bhe@redhat.com \
    --cc=chrisl@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=ryncsn@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=syzbot+d7bc9ec4a100437aa7a2@syzkaller.appspotmail.com \
    --cc=youngjun.park@lge.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