linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: syzbot <syzbot+6fc7fb214625d82af7d1@syzkaller.appspotmail.com>
Cc: bingjingc@synology.com, cccheng@synology.com, jack@suse.cz,
	linux-kernel@vger.kernel.org, pali@kernel.org,
	robbieko@synology.com, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] KASAN: use-after-free Read in __isofs_iget
Date: Mon, 18 Oct 2021 12:42:13 +0200	[thread overview]
Message-ID: <20211018104213.GD29715@quack2.suse.cz> (raw)
In-Reply-To: <00000000000081a7bc05ce6d7c7a@google.com>

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

On Fri 15-10-21 17:35:19, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    d3134eb5de85 Add linux-next specific files for 20211011
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=13f5fd98b00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=b9662326d2be383b
> dashboard link: https://syzkaller.appspot.com/bug?extid=6fc7fb214625d82af7d1
> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15ca2e47300000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17869bd4b00000
> 
> Bisection is inconclusive: the issue happens on the oldest tested release.
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=10808570b00000
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=12808570b00000
> console output: https://syzkaller.appspot.com/x/log.txt?x=14808570b00000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+6fc7fb214625d82af7d1@syzkaller.appspotmail.com

Let's try this:

#sys test 519d81956ee277b4419c723adfb154603c2565ba

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

[-- Attachment #2: 0001-isofs-Fix-out-of-bound-access-for-corrupted-isofs-im.patch --]
[-- Type: text/x-patch, Size: 939 bytes --]

From 5d06a4f26133fa8d45254febce7a46085e998ee7 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 18 Oct 2021 12:37:41 +0200
Subject: [PATCH] isofs: Fix out of bound access for corrupted isofs image

When isofs image is suitably corrupted isofs_read_inode() can read data
beyond the end of buffer. Sanity-check the directory entry length before
using it.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/isofs/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 678e2c51b855..0c6eacfcbeef 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1322,6 +1322,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 
 	de = (struct iso_directory_record *) (bh->b_data + offset);
 	de_len = *(unsigned char *) de;
+	if (de_len < sizeof(struct iso_directory_record))
+		goto fail;
 
 	if (offset + de_len > bufsize) {
 		int frag1 = bufsize - offset;
-- 
2.26.2


  reply	other threads:[~2021-10-18 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-16  0:35 [syzbot] KASAN: use-after-free Read in __isofs_iget syzbot
2021-10-18 10:42 ` Jan Kara [this message]
2021-10-19  9:16   ` Jan Kara
2021-10-19  9:48     ` 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=20211018104213.GD29715@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=bingjingc@synology.com \
    --cc=cccheng@synology.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=robbieko@synology.com \
    --cc=syzbot+6fc7fb214625d82af7d1@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;
as well as URLs for NNTP newsgroup(s).