mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+14d047423f40dc1dac89@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [mm?] [xfs?] KASAN: slab-use-after-free Read in filemap_map_pages
Date: Wed,  1 Jan 2025 14:49:59 +0800	[thread overview]
Message-ID: <20250101065000.1243-1-hdanton@sina.com> (raw)
In-Reply-To: <6774bf44.050a0220.25abdd.098a.GAE@google.com>

On Tue, 31 Dec 2024 20:06:28 -0800
> syzbot found the following issue on:
> 
> HEAD commit:    8155b4ef3466 Add linux-next specific files for 20241220
> git tree:       linux-next
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17ed90b0580000

#syz test

--- x/mm/filemap.c
+++ y/mm/filemap.c
@@ -3703,6 +3703,7 @@ vm_fault_t filemap_map_pages(struct vm_f
 	struct address_space *mapping = file->f_mapping;
 	pgoff_t file_end, last_pgoff = start_pgoff;
 	unsigned long addr;
+	unsigned long pmd_end;
 	XA_STATE(xas, &mapping->i_pages, start_pgoff);
 	struct folio *folio;
 	vm_fault_t ret = 0;
@@ -3731,6 +3732,11 @@ vm_fault_t filemap_map_pages(struct vm_f
 	if (end_pgoff > file_end)
 		end_pgoff = file_end;
 
+	pmd_end = ALIGN(addr, PMD_SIZE);
+	pmd_end = (pmd_end - addr) >> PAGE_SHIFT;
+	if (end_pgoff - start_pgoff > pmd_end)
+		end_pgoff = start_pgoff + pmd_end;
+
 	folio_type = mm_counter_file(folio);
 	do {
 		unsigned long end;
--

  reply	other threads:[~2025-01-01  6:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-01  4:06 syzbot
2025-01-01  6:49 ` Hillf Danton [this message]
2025-01-01  7:20   ` syzbot
2025-11-06 11:06 ` [syzbot] [mm?] " syzbot

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=20250101065000.1243-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+14d047423f40dc1dac89@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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®