From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Richard Weinberger <richard@nod.at>,
Chengsong Ke <kechengsong@huawei.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>,
linux-mtd <linux-mtd@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
wangfangpeng1 <wangfangpeng1@huawei.com>
Subject: Re: [PATCH v2] ubifs: Fix read out-of-bounds in ubifs_jnl_write_inode()
Date: Thu, 24 Dec 2020 09:14:20 +0800 [thread overview]
Message-ID: <a45eb291-c3e5-23c6-239d-88347cf688e4@huawei.com> (raw)
In-Reply-To: <244303467.160590.1608764840819.JavaMail.zimbra@nod.at>
在 2020/12/24 7:07, Richard Weinberger 写道:
>> Reproducer:
>> 0. config KASAN && apply print.patch
>> 1. mount ubifs on /root/temp
>> 2. run test.sh
>
> What does test.sh do?
Go to Link: https://bugzilla.kernel.org/show_bug.cgi?id=210865.
test.sh creates a very long path file test_file, and then create a
symbol link link_file for test_file, so ubifs inode for link_file will
be assigned a big value for ui->data_len.
When we change atime for link_file, ubifs_jnl_write_inode will be
executed by wb_writeback. By this way, write_len could be not aligned
with 8 bytes.
>
>> 3. cd /root/temp && ls // change atime for link_file
>> 4. wait 1~2 minutes
>>
>> In order to solve the read oob problem in ubifs_wbuf_write_nolock, just align
>> the write_len to
>> 8 bytes when alloc the memory. So that this patch will not affect the use of
>> write_len in other
>> functions, such as ubifs_jnl_write_inode->make_reservation and
>> ubifs_jnl_write_inode->ubifs_node_calc_hash.
>
> I gave this a second thought and I'm not so sure anymore what exactly is going on.
> The problem is real, I fully agree with you but I need to dig deeper into
> the journal and wbuf code to double check that we really fix the right thing
> and not just paper other something.
>
> Thanks,
> //richard
> .
>
next prev parent reply other threads:[~2020-12-24 1:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 12:15 Chengsong Ke
2020-12-23 23:07 ` Richard Weinberger
2020-12-24 1:14 ` Zhihao Cheng [this message]
2021-03-04 1:50 ` [v2] " Chengsong Ke
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=a45eb291-c3e5-23c6-239d-88347cf688e4@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=kechengsong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=s.hauer@pengutronix.de \
--cc=wangfangpeng1@huawei.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®