mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: tejas bharambe <tejas.bharambe@outlook.com>,
	"mark@fasheh.com" <mark@fasheh.com>,
	"jlbec@evilplan.org" <jlbec@evilplan.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"syzbot+a49010a0e8fcdeea075f@syzkaller.appspotmail.com"
	<syzbot+a49010a0e8fcdeea075f@syzkaller.appspotmail.com>,
	"ocfs2-devel@lists.linux.dev" <ocfs2-devel@lists.linux.dev>
Subject: Re: [PATCH v3] ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY
Date: Thu, 2 Apr 2026 15:09:56 +0800	[thread overview]
Message-ID: <e6a5b222-bdd8-4423-9561-05bd5b1aaa3e@linux.alibaba.com> (raw)
In-Reply-To: <20260401211700.0749e640e5f7c67a062c2deb@linux-foundation.org>



On 4/2/26 12:17 PM, Andrew Morton wrote:
> On Thu, 2 Apr 2026 11:47:12 +0800 Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
> 
>>
>>
>> On 4/2/26 11:08 AM, tejas bharambe wrote:
>>> filemap_fault() may drop the mmap_lock before returning VM_FAULT_RETRY,
>>> as documented in mm/filemap.c:
>>>
>>>   "If our return value has VM_FAULT_RETRY set, it's because the mmap_lock
>>>   may be dropped before doing I/O or by lock_folio_maybe_drop_mmap()."
>>>
>>> When this happens, a concurrent munmap() can call remove_vma() and free
>>> the vm_area_struct via RCU. The saved 'vma' pointer in ocfs2_fault() then
>>> becomes a dangling pointer, and the subsequent trace_ocfs2_fault() call
>>> dereferences it -- a use-after-free.
>>>
>>> Fix this by saving the inode reference before calling filemap_fault(),
>>> and removing vma from the trace event. The inode remains valid across
>>> the lock drop since the file is still open, so the trace can fire in
>>> all cases without dereferencing the potentially freed vma.
>>>
>>> Reported-by: syzbot+a49010a0e8fcdeea075f@syzkaller.appspotmail.com
>>> Closes: https://syzkaller.appspot.com/bug?extid=a49010a0e8fcdeea075f
>>> Suggested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
>>> Signed-off-by: Tejas Bharambe <tejas.bharambe@outlook.com>
>>
>> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> 
> Cool.
> 
> I think a cc:stable is needed?
> 
> The code looks like it dates back to 2011, so Fixes: isn't needed.
> 
> 
> A process thing: as far as I know, the -stable maintainers will
> automatically gather any patch which has a Fixes:.  But they've been
> asked not to do that for MM patches, so there's a risk they'll see an
> ocfs2 patch is from my tree and not backport it.  I like to add
> a cc:stable just to be sure.
> 
> Also, because this one doesn't have a Fixes: it might not be grabbed by
> the -stable trees.  An explicit cc:stable again removes doubt.
> 
> But that's just my late night waffling which can be ignored.  For every
> single patch I always consider cc:stable so other people don't have to ;)

Yes, cc stable is preferred here.

Thanks,
Joseph


  reply	other threads:[~2026-04-02  7:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02  3:08 tejas bharambe
2026-04-02  3:47 ` Joseph Qi
2026-04-02  4:17   ` Andrew Morton
2026-04-02  7:09     ` Joseph Qi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-02  4:02 Tejas Bharambe
2026-04-02  4:19 ` Andrew Morton
2026-04-02  3:10 tejas bharambe
2026-04-02  3:32 ` Joseph Qi
2026-04-02  3:58   ` tejas bharambe
2026-04-01  4:20 [PATCH v2] " tejas bharambe
2026-04-01  8:29 ` Joseph Qi
2026-04-01 12:55   ` [PATCH v3] " tejas bharambe
2026-04-02  1:06     ` Joseph Qi

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=e6a5b222-bdd8-4423-9561-05bd5b1aaa3e@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=syzbot+a49010a0e8fcdeea075f@syzkaller.appspotmail.com \
    --cc=tejas.bharambe@outlook.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

all inboxes | Powered by JetHome®