mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	syzbot <syzbot+7bb7cd3595533513a9e7@syzkaller.appspotmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	christian.brauner@ubuntu.com,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Jeff Layton <jlayton@kernel.org>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller-bugs@googlegroups.com,
	Matthew Wilcox <willy@infradead.org>,
	ZhangPeng <zhangpeng362@huawei.com>,
	linux-m68k@lists.linux-m68k.org
Subject: Re: [syzbot] [hfs?] WARNING in hfs_write_inode
Date: Wed, 4 Jan 2023 20:37:16 -0800	[thread overview]
Message-ID: <46F233BB-E587-4F2B-AA62-898EB46C9DCE@dubeyko.com> (raw)
In-Reply-To: <2575F983-D170-4B79-A6BA-912D4ED2CC73@dubeyko.com>



> On Jan 4, 2023, at 4:36 PM, Viacheslav Dubeyko <slava@dubeyko.com> wrote:
> 
> Hi Arnd,
> 
>> On Jan 4, 2023, at 2:33 PM, Arnd Bergmann <arnd@arndb.de> wrote:

<skipped>

>>> 
>>> Something like this ENTIRELY UNTESTED patch?
>>> 
>>> Do we have anybody who looks at hfs?
>> 
>> Adding Viacheslav Dubeyko to Cc, he's at least been reviewing
>> patches for HFS and HFS+ somewhat recently. The linux-m68k
>> list may have some users dual-booting old MacOS.
>> 
>> Viacheslav, see the start of the thread at
>> https://lore.kernel.org/lkml/000000000000dbce4e05f170f289@google.com/
>> 
> 
> Let me take a look into the issue.
> 

As far as I can see, I cannot reproduce the issue for newly created HFS volume
with simple operation of creation of several files of 4MB in size. The sync_fs
operation definitely calls hfs_write_inode() method. But I don't see such issue.

The hfs_write_inode() allocates struct hfs_find_data fd variable on stack
(fs/hfs/inode.c:426). The fd.entrylength is initialized in __hfs_brec_find()
(fs/hfs/bfind.c:100). Technically, fd->entrylength = len - keylen can introduce
overflow. But, such issue can take place for corrupted volume. Internal logic
error should result with returning error by hfs_brec_find (fs/hfs/inode.c:466):

if (hfs_brec_find(&fd))
     /* panic? */
     goto out;

And, finally, logic should end without going into the issue.

Also, as far as I can see, available volume in report (mount_0.gz) somehow corrupted already:

sudo losetup /dev/loop20 ./mount_0
sudo fsck.hfs -d /dev/loop20
** /dev/loop20
Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
** Checking HFS volume.
hfs_swap_BTNode: record #1 invalid offset (0xFFF8)
   Invalid node structure
(3, 0)
   Invalid B-tree node size
(3, 0)
** Volume check failed.
volume check failed with error 7 
volume type is HFS 
primary MDB is at block 2 0x02 
alternate MDB is at block 62 0x3e 
primary VHB is at block 0 0x00 
alternate VHB is at block 0 0x00 
sector size = 512 0x200 
VolumeObject flags = 0x19 
total sectors for volume = 64 0x40 
total sectors for embedded volume = 0 0x00

So, HFS volume corruption had happened somehow earlier.
The reported issue is only a side effect of volume corruption.
The real issue of HFS volume corruption had taken place before.
And it was a silent issue somehow.

Finally, I don’t see any issue with WARN_ON() in fs/hfs/inode.c:489.
If we have some issue, then it could happen in b-tree logic or
HFS volume was corrupted somehow else. But available report doesn’t
provide any hint what could be wrong during testing.

Thanks,
Slava.



  reply	other threads:[~2023-01-05  4:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 14:24 syzbot
2023-01-04 14:43 ` Arnd Bergmann
2023-01-04 19:06   ` Linus Torvalds
2023-01-04 22:33     ` Arnd Bergmann
2023-01-04 22:42       ` John Paul Adrian Glaubitz
2023-01-05  0:36       ` Viacheslav Dubeyko
2023-01-05  4:37         ` Viacheslav Dubeyko [this message]
2023-01-05 15:46           ` Matthew Wilcox
2023-01-05 16:45             ` Viacheslav Dubeyko
2023-07-20 15:27               ` Dmitry Vyukov
2023-07-20 17:30                 ` Matthew Wilcox
2023-07-20 17:50                   ` John Paul Adrian Glaubitz
2023-07-20 17:59                     ` Matthew Wilcox
2023-07-20 18:27                       ` Jeff Layton
2023-07-20 22:20                         ` Dave Chinner
2023-07-21  1:03                           ` Finn Thain
2023-07-21  1:11                             ` Matthew Wilcox
2023-07-21  1:25                               ` Michael Schmitz
2023-07-21  1:45                               ` Finn Thain
2023-07-21  6:42                               ` Kirsten Bromilow
2023-07-21  8:14                               ` Finn Thain
2023-07-21 13:10                                 ` Theodore Ts'o
2023-07-20 21:38                       ` Jeffrey Walton
2023-07-20 22:37                         ` Matthew Wilcox
2023-07-20 22:53                           ` Linus Torvalds
2023-07-21  1:28                             ` Mike Hosken
2023-07-20 17:56                   ` John Paul Adrian Glaubitz
2023-07-20 19:05                     ` Michael Schmitz
2023-07-21  5:07                       ` John Paul Adrian Glaubitz
2023-07-21  5:40                 ` Eric W. Biederman
2023-01-05 21:34       ` Michael Schmitz
2023-01-05 21:53         ` Linus Torvalds
2023-01-05 23:46           ` Michael Schmitz
2023-01-06  7:09             ` Michael Schmitz

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=46F233BB-E587-4F2B-AA62-898EB46C9DCE@dubeyko.com \
    --to=slava@dubeyko.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=christian.brauner@ubuntu.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=syzbot+7bb7cd3595533513a9e7@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    --cc=zhangpeng362@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®