linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@linaro.org>
To: Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Subject: BUG in ext4_ind_remove_space
Date: Thu, 24 Feb 2022 17:12:56 -0800	[thread overview]
Message-ID: <48308b02-149b-1c47-115a-1a268dac6e24@linaro.org> (raw)


Hi,
Syzbot found an issue [1] in fallocate() that looks to me like a loss of precision.
The C reproducer [2] calls fallocate() and passes the size 0xffeffeff000ul, and
offset 0x1000000ul, which is then used to calculate the first_block and
stop_block using ext4_lblk_t type (u32). I think this gets the MSB of the size
truncated and leads to invalid calculations, and eventually his BUG() in
https://elixir.bootlin.com/linux/v5.16.11/source/fs/ext4/indirect.c#L1244
The issue can be reproduced on 5.17.0-rc5, but I don't think it's a new
regression. I spent some time debugging it, but could spot anything obvious.
Can someone have a look please.


[1] https://syzkaller.appspot.com/bug?id=b80bd9cf348aac724a4f4dff251800106d721331
[2] https://syzkaller.appspot.com/text?tag=ReproC&x=14ba0238700000

-- 
Thanks,
Tadeusz

             reply	other threads:[~2022-02-25  1:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  1:12 Tadeusz Struk [this message]
2022-02-25 17:10 ` BUG in ext4_ind_remove_space Ritesh Harjani
2022-02-25 19:19   ` Tadeusz Struk
2022-03-02 23:14     ` Tadeusz Struk
2022-03-03 14:56       ` Ritesh Harjani
2022-03-03 15:37         ` Tadeusz Struk
2022-03-03 20:08           ` Ritesh Harjani
2022-03-07  5:45             ` Ritesh Harjani
2022-03-08 17:58               ` Tadeusz Struk
2022-03-14 21:27               ` Tadeusz Struk
2022-03-15 17:50               ` Tadeusz Struk
2022-03-15 19:15                 ` [PATCH] ext4: check if offset+length is within a valid range in fallocate Tadeusz Struk
2022-03-15 20:39                   ` Tadeusz Struk
2022-03-16  1:22                   ` kernel test robot
2022-03-16  1:22                   ` kernel test robot
2022-03-16  2:14                     ` Tadeusz Struk

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=48308b02-149b-1c47-115a-1a268dac6e24@linaro.org \
    --to=tadeusz.struk@linaro.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).