Re: [syzbot] [fs?] [mm?] WARNING in page_copy_sane

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/17/23 11:41 PM, syzbot wrote:
Hello,

syzbot found the following issue on:

HEAD commit:    98897dc735cf Add linux-next specific files for 20230914
git tree:       linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1548728c680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=1502c503717ada5c
dashboard link: https://syzkaller.appspot.com/bug?extid=c225dea486da4d5592bd
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=171fffd8680000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17bbbf1c680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/00e4c0af5a8a/disk-98897dc7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7b54a00eee56/vmlinux-98897dc7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/100094353b8e/bzImage-98897dc7.xz

The issue was bisected to:

commit 591a2520fbfd6565d9a5c732afa53f62228798e6
Author: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
Date:   Mon Sep 11 21:53:19 2023 +0000

     mm/filemap: remove hugetlb special casing in filemap.c

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=15e15464680000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=17e15464680000
console output: https://syzkaller.appspot.com/x/log.txt?x=13e15464680000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c225dea486da4d5592bd@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 591a2520fbfd ("mm/filemap: remove hugetlb special casing in filemap.c")

------------[ cut here ]------------
WARNING: CPU: 1 PID: 5040 at lib/iov_iter.c:463 page_copy_sane+0xc2/0x2c0 lib/iov_iter.c:463
Modules linked in:
CPU: 1 PID: 5040 Comm: syz-executor204 Not tainted 6.6.0-rc1-next-20230914-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
RIP: 0010:page_copy_sane+0xc2/0x2c0 lib/iov_iter.c:463
Code: e8 73 db 63 fd 66 90 e8 6c db 63 fd e8 67 db 63 fd 4c 89 ee 48 89 ef e8 6c d6 63 fd 49 39 ed 0f 83 eb 00 00 00 e8 4e db 63 fd <0f> 0b 31 db e8 45 db 63 fd 89 d8 5b 5d 41 5c 41 5d 41 5e 41 5f c3
RSP: 0018:ffffc90003eefa58 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff88807a01d940 RSI: ffffffff84241482 RDI: 0000000000000006
RBP: 0000000000200000 R08: 0000000000000006 R09: 0000000000201000
R10: 0000000000200000 R11: 0000000000000000 R12: 0000000000000009
R13: 0000000000201000 R14: 0000000000000001 R15: ffffea0001fe0000
FS:  0000555556937380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000200001c0 CR3: 000000002911d000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  <TASK>
  copy_page_to_iter+0x35/0x180 lib/iov_iter.c:472
  hugetlbfs_read_iter+0x3d7/0xa60 fs/hugetlbfs/inode.c:385
  call_read_iter include/linux/fs.h:1980 [inline]
  do_iter_readv_writev+0x2f2/0x3c0 fs/read_write.c:733
  do_iter_read+0x315/0x870 fs/read_write.c:795
  vfs_readv+0x12d/0x1a0 fs/read_write.c:915
  do_preadv fs/read_write.c:1007 [inline]
  __do_sys_preadv fs/read_write.c:1057 [inline]
  __se_sys_preadv fs/read_write.c:1052 [inline]
  __x64_sys_preadv+0x228/0x300 fs/read_write.c:1052
  do_syscall_x64 arch/x86/entry/common.c:50 [inline]
  do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
  entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f85cc7932e9
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffda50bbbd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
RAX: ffffffffffffffda RBX: 00007ffda50bbdb8 RCX: 00007f85cc7932e9
RDX: 0000000000000002 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00007f85cc806610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffda50bbda8 R14: 0000000000000001 R15: 0000000000000001
  </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
#syz test
From 37a6528d0dda934ce1d023cb7d8c9a3d2063b57e Mon Sep 17 00:00:00 2001
From: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
Date: Mon, 18 Sep 2023 11:40:07 -0500
Subject: [PATCH] mm/hugetlb: fix warning in page_copy_sane

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
---
 fs/hugetlbfs/inode.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 14d3d28e41b0..629dcd4856bf 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -334,7 +334,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
 	ssize_t retval = 0;
 
 	while (iov_iter_count(to)) {
-		struct page *page;
+		struct folio *folio;
 		size_t nr, copied, want;
 
 		/* nr is the maximum number of bytes to copy from this page */
@@ -352,18 +352,18 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
 		}
 		nr = nr - offset;
 
-		/* Find the page */
-		page = find_lock_page(mapping, index);
-		if (unlikely(page == NULL)) {
+		/* Find the folio */
+		folio = filemap_lock_hugetlb_folio(h, mapping, index);
+		if (unlikely(folio == NULL)) {
 			/*
 			 * We have a HOLE, zero out the user-buffer for the
 			 * length of the hole or request.
 			 */
 			copied = iov_iter_zero(nr, to);
 		} else {
-			unlock_page(page);
+			folio_unlock(folio);
 
-			if (!PageHWPoison(page))
+			if (!folio_test_has_hwpoisoned(folio))
 				want = nr;
 			else {
 				/*
@@ -371,9 +371,9 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
 				 * touching the 1st raw HWPOISON subpage after
 				 * offset.
 				 */
-				want = adjust_range_hwpoison(page, offset, nr);
+				want = adjust_range_hwpoison(&folio->page, offset, nr);
 				if (want == 0) {
-					put_page(page);
+					folio_put(folio);
 					retval = -EIO;
 					break;
 				}
@@ -382,8 +382,8 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
 			/*
 			 * We have the page, copy it to user space buffer.
 			 */
-			copied = copy_page_to_iter(page, offset, want, to);
-			put_page(page);
+			copied = copy_page_to_iter(&folio->page, offset, want, to);
+			folio_put(folio);
 		}
 		offset += copied;
 		retval += copied;
-- 
2.41.0


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux