public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+d2125fcb6aa8c4276fd2@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [syzbot] [fs?] general protection fault in iter_file_splice_write
Date: Thu, 23 May 2024 18:30:00 -0700	[thread overview]
Message-ID: <0000000000002c52e50619291b07@google.com> (raw)
In-Reply-To: <0000000000002fd2de0618de2e65@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [syzbot] [fs?] general protection fault in iter_file_splice_write
Author: lizhi.xu@windriver.com

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 33e02dc69afb

diff --git a/fs/splice.c b/fs/splice.c
index 60aed8de21f8..c6d812684d4e 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -745,16 +745,30 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 		if (ret <= 0)
 			break;
 
+		printk("ret: %ld, total len: %lu, %s\n", ret, sd.total_len, __func__);
+		if (ret > sd.total_len) {
+			ret = -EINVAL;
+			goto done;
+		}
 		sd.num_spliced += ret;
 		sd.total_len -= ret;
 		*ppos = sd.pos;
 
 		/* dismiss the fully eaten buffers, adjust the partial one */
 		tail = pipe->tail;
-		while (ret) {
+		n = 0;
+		while (ret > 0 && n < nbufs) {
 			struct pipe_buffer *buf = &pipe->bufs[tail & mask];
+			printk("ret: %ld, nbufs: %d, buf:%p, buf len: %u, m: %u, t: %u,ring size: %u, t&m: %u, n:%d, %s\n", 
+					ret, nbufs, buf, buf->len, mask, tail, pipe->ring_size, tail & mask, n, __func__);
+			n++;
+			if (!buf->len) {
+				tail++;
+				continue;
+			}
 			if (ret >= buf->len) {
 				ret -= buf->len;
+				printk("ret: %ld, %s\n", ret, __func__);
 				buf->len = 0;
 				pipe_buf_release(pipe, buf);
 				tail++;
diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c
index 1121601536d1..f7c32835b094 100644
--- a/fs/netfs/buffered_write.c
+++ b/fs/netfs/buffered_write.c
@@ -510,6 +510,7 @@ ssize_t netfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	netfs_end_io_write(inode);
 	if (ret > 0)
 		ret = generic_write_sync(iocb, ret);
+	printk("ret: %ld, %s\n", ret, __func__);
 	return ret;
 }
 EXPORT_SYMBOL(netfs_file_write_iter);
diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c
index 608ba6416919..8157b4e6d7b3 100644
--- a/fs/netfs/direct_write.c
+++ b/fs/netfs/direct_write.c
@@ -190,6 +190,7 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from)
 			   FSCACHE_INVAL_DIO_WRITE);
 	ret = netfs_unbuffered_write_iter_locked(iocb, from, NULL);
 out:
+	printk("ret: %ld, %s\n", ret, __func__);
 	netfs_end_io_direct(inode);
 	return ret;
 }

  parent reply	other threads:[~2024-05-24  1:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20  8:06 [syzbot] [fs?] general protection fault in iter_file_splice_write syzbot
2024-05-22  5:21 ` Edward Adam Davis
2024-05-22  5:45   ` syzbot
2024-05-22 10:37 ` Edward Adam Davis
2024-05-22 10:57   ` syzbot
2024-05-22 11:30 ` Edward Adam Davis
2024-05-22 11:56   ` syzbot
2024-05-22 12:49 ` Edward Adam Davis
2024-05-22 13:13   ` syzbot
2024-05-22 13:29 ` Edward Adam Davis
2024-05-22 13:54   ` syzbot
2024-05-22 14:05 ` Edward Adam Davis
2024-05-22 14:30   ` syzbot
2024-05-23  8:33 ` [syzbot] " syzbot
2024-05-23  9:23 ` syzbot
2024-05-23 12:33 ` Edward Adam Davis
2024-05-23 12:58   ` syzbot
2024-05-23 14:13 ` Edward Adam Davis
2024-05-23 14:37   ` syzbot
2024-05-24  0:52 ` [syzbot] " syzbot
2024-05-24  1:30 ` syzbot [this message]
2024-05-24  2:07 ` syzbot
2024-05-24  3:51 ` syzbot
2024-05-24  5:35 ` [PATCH] netfs: if extracting pages from user iterator fails return 0 Lizhi Xu
2024-08-11 22:43 ` [syzbot] [fs?] general protection fault in iter_file_splice_write syzbot
2025-09-23 19:59 ` syzbot
2025-09-25 12:47   ` David Howells

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=0000000000002c52e50619291b07@google.com \
    --to=syzbot+d2125fcb6aa8c4276fd2@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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