mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+33f23b49ac24f986c9e8@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [btrfs?] KASAN: slab-out-of-bounds Read in getname_kernel (2)
Date: Tue, 19 Dec 2023 16:27:40 +0800	[thread overview]
Message-ID: <tencent_23960436F84A82754D76C767CE3C75373809@qq.com> (raw)
In-Reply-To: <000000000000d1a1d1060cc9c5e7@google.com>

please test slab-out-of-bounds Read in getname_kernel

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3bd7d7488169

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index f9544fda38e9..31218d3aebe8 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -741,7 +741,8 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
 	}
 
 	if ((args->start.srcdevid == 0 && args->start.srcdev_name[0] == '\0') ||
-	    args->start.tgtdev_name[0] == '\0')
+	    args->start.tgtdev_name[0] == '\0' ||
+	    args->start.tgtdev_name[0] == 0)
 		return -EINVAL;
 
 	ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 4e50b62db2a8..20822e62f8b5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3283,7 +3283,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info,
 		return -EINVAL;
 	}
 
-	p = memdup_user(arg, sizeof(*p));
+	p = memdup_user(arg, 1042);
 	if (IS_ERR(p))
 		return PTR_ERR(p);
 
diff --git a/mm/util.c b/mm/util.c
index 744b4d7e3fae..2581d687df87 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -194,7 +194,7 @@ void *memdup_user(const void __user *src, size_t len)
 {
 	void *p;
 
-	p = kmalloc_track_caller(len, GFP_USER | __GFP_NOWARN);
+	p = kmalloc_track_caller(len, GFP_USER | __GFP_NOWARN | __GFP_ZERO);
 	if (!p)
 		return ERR_PTR(-ENOMEM);
 


  parent reply	other threads:[~2023-12-19  8:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 14:43 syzbot
2023-12-19  2:44 ` Edward Adam Davis
2023-12-19  2:50   ` syzbot
2023-12-19  3:06 ` Edward Adam Davis
2023-12-19  3:25   ` syzbot
2023-12-19  4:05 ` Edward Adam Davis
2023-12-19  4:38   ` syzbot
2023-12-19  4:59 ` Edward Adam Davis
2023-12-19  7:38   ` syzbot
2023-12-19  8:23 ` Edward Adam Davis
2023-12-19  8:35   ` syzbot
2023-12-19  8:27 ` Edward Adam Davis [this message]
2023-12-19  8:46   ` syzbot
2023-12-19  9:26 ` Edward Adam Davis
2023-12-19  9:39   ` syzbot
2023-12-19  9:46 ` Edward Adam Davis
2023-12-19 10:04   ` syzbot
2023-12-19 10:19 ` [PATCH] btrfs: fix oob Read in getname_kernel Edward Adam Davis
2024-01-10 15:55   ` David Sterba
2024-01-15 19:08     ` David Sterba
2024-01-16  1:09       ` [syzbot] [btrfs?] KASAN: slab-out-of-bounds Read in getname_kernel (2) Edward Adam Davis
2024-01-17 20:08         ` David Sterba
2024-01-31 18:43         ` David Sterba
2024-01-15 23:32 ` Edward Adam Davis
2024-01-15 23:47   ` syzbot
2024-01-15 23:58 ` Edward Adam Davis
2024-01-16  0:15   ` syzbot
2024-01-16  0:46 ` Edward Adam Davis
2024-01-16  1:06   ` 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=tencent_23960436F84A82754D76C767CE3C75373809@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+33f23b49ac24f986c9e8@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®